Giter Site home page Giter Site logo

Comments (39)

juliemr avatar juliemr commented on May 5, 2024

Definitely - we'll be moving E2E tests from Angular examples over at some point and will definitely clarify then.

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

Can you give a few pointers on how to get going with it? I mean, in terms of running tests, we can check out the samples but I don't see much in way of configuring Karma for Protactor

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Protractor and Karma should not be used together; instead they provide separate systems for running tests. Protractor and Karma cover different aspects of testing - Karma is intended mostly for unit tests, while Protractor should be used for end to end testing.

Protractor is built on top of WebDriverJS, which uses a Selenium/WebDriver server to provision browsers and drive test execution. Examples of pure WebDriverJS can be found here: http://code.google.com/p/selenium/wiki/WebDriverJs

from protractor.

tbosch avatar tbosch commented on May 5, 2024

Just an idea (not from me actually, karma-runner/karma#542): Use WebDriver to start the browser for karma. That could be a nice feature for Protractor, what do you think?

Tobias

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

Hm, I thought you may be making efforts to combine them, as runners.

Some more questions (let me know if there's a better avenue for them than this issues page):

  • Will you be making efforts to simplify assertions (without complex .then() callbacks) like the E2E scenario had?
  • I'm in two minds on whether to use protractor in JS or port it to .NET so I can write my tests in C#. If I decide to do so - what would be the best way to keep the two repositories in sync, other than manually checking your check-ins every so often?

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Tobias - I'm not sure exactly what feature you're proposing. The setup at the moment already does launch browsers using WebDriver.

I do plan to include scripts to help download the selenium standalone server and chromedriver, which should make it easier to get started with protractor.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Georgios - I think it makes sense to keep Protractor and Karma separate - for end to end tests, you want the native event driving and flexibility of webdriver, while for unit tests you want fast execution and autowatching of files.

I'm actually currently at work on simpler assertions which understand promises!

I have no current plans to port to .NET, but I will be porting to Java at some point. I haven't yet figured out the method for keeping repositories in sync, but I will definitely document the process once it's worked out.

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

That's great!

Looking at your code it won't be as simple as I thought. Not sure how easily I can access element.data() from the C# WebDriver.

Where do I have to put chromedriver.exe for this to run? I tried setting capabilities['chrome.binary'] to no avail.

Also, do you have a roadmap on the project? If so, please share

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

I'm on windows!

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Accessing element.data() shouldn't be any different in C# than in node.js, since it's done through executeScriptAsync. (C# docs: http://selenium.googlecode.com/svn/trunk/docs/api/dotnet/html/M_OpenQA_Selenium_IJavaScriptExecutor_ExecuteAsyncScript.htm)

I have chromedriver in the same directory as the selenium standalone binary, but I am on a mac so no guarantees for windows.

I'm hoping to use issues to track my roadmap, but don't have much laid our yet :)

EDIT: Where to put ChromeDriver on various systems: https://code.google.com/p/selenium/wiki/ChromeDriver

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

Still doesn't wanna play nice :S
Any further ideas, let me know.

Thanks for pointing that out - this may actually be viable. I'll keep you posted on the port if I go ahead.

from protractor.

tbosch avatar tbosch commented on May 5, 2024

I thought about something like starting karma from protractor command line interface and then make karma use the same webdriver configuration as protractor. I think usually what you want in a CI is to run your end2end and unit tests against the same browsers. If you add further scripts to e.g. download and start the webdriver server automatically, this could then be also used for running the karma tests.
But I am not sure about how much benefit this would be...

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Georgios - does this work for you?

java -jar selenium-server-standalone-2.33.0.jar -Dwebdriver.chrome.driver=./chromedriver

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

I've opted to go with WebDriver in C# after all (copying all your wonderful clientSideScripts :)) - perhaps this can help anyone searching for the same problem

from protractor.

jperl avatar jperl commented on May 5, 2024

I am also curious as to why protractor would not be built off of karma?

from protractor.

juliemr avatar juliemr commented on May 5, 2024

@jperl WebDriver provides native event firing, which allows you to test the application truly as a user would. There's also active work on WebDriver to update it to do native event firing on mobile browsers. Karma, on the other hand, loads code into an iframe, which is great for unit testing but doesn't truly interact with the site in the way a user would.

from protractor.

johnjelinek avatar johnjelinek commented on May 5, 2024

@juliemr is there support for PhantomJS/SlimerJS with Protractor?

from protractor.

juliemr avatar juliemr commented on May 5, 2024

@johnjelinek No direct support. I'm not sure what the use case for end to end tests with PhantomJS would be - certainly that's not how your users are interacting with your page. As far as I know, the only advantage of PhantomJS is that it's fast, and while fast end2end tests are better, performance isn't the same kind of issue that it is for unit tests. Is there another reason to test with it?

That said, there is this thing: https://github.com/detro/ghostdriver

so potentially, you could hook PhantomJS up to your selenium server and use it.

from protractor.

johnjelinek avatar johnjelinek commented on May 5, 2024

In my scenario, the continuous integration server doesn't have xserver and
so a headless browser, based on webkit/gecko (phantom/slimer), should
suffice to make sure everything is working in terms of smoke tests.
On Aug 22, 2013 5:39 PM, "Julie Ralph" [email protected] wrote:

@johnjelinek https://github.com/johnjelinek No direct support. I'm not
sure what the use case for end to end tests with PhantomJS would be -
certainly that's not how your users are interacting with your page. As far
as I know, the only advantage of PhantomJS is that it's fast, and while
fast end2end tests are better, performance isn't the same kind of issue
that it is for unit tests. Is there another reason to test with it?

That said, there is this thing: https://github.com/detro/ghostdriver

so potentially, you could hook PhantomJS up to your selenium server and
use it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-23131698
.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Closing this thread as I think everything has been addressed. Please open new issues if anything is lingering!

from protractor.

jaredly avatar jaredly commented on May 5, 2024

@johnjelinek fyi you can just run phantomjs --webdriver=4444, and it will act as a webdriverjs server (on port 4444).

from protractor.

johnjelinek avatar johnjelinek commented on May 5, 2024

I'll try this out!
On Sep 24, 2013 7:34 PM, "Jared Forsyth" [email protected] wrote:

@johnjelinek https://github.com/johnjelinek fyi you can just run phantomjs
--webdriver=4444, and it will act as a webdriverjs server (on port 4444).


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-25054243
.

from protractor.

atul221282 avatar atul221282 commented on May 5, 2024

can we use protractor for unit testing? I think not but just need confirmation from experts out there..

from protractor.

johnjelinek avatar johnjelinek commented on May 5, 2024

You 'could', but it's the won't tool for the job. Use karma as your test
runner.
On Oct 10, 2013 1:21 AM, "Atul" [email protected] wrote:

can we use protractor for unit testing? I think not but just need
confirmation from experts out there..


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-26031510
.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Yup - Karma is a great tool for unit testing, and you should use that.

from protractor.

dylang avatar dylang commented on May 5, 2024

Because this question comes up so frequently (not just here, but in my office, at meetups, etc) - would it be possible to say something about Karma in the Protractor readme?

For example:

Tool Purpose What sets it apart Example Usage
Protractor End-to-End Has knowledge of the whole page, not individual modules. Create account, buy a widget, sign out. Did it work as I expected?
Karma Unit You choose what modules or files to make available to test. It does not know about the whole page. When I pass various values to this service do I get the output I expected?

Disclaimer: I haven't used Protractor yet and I'm still new with Karma.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

I'll add something to the FAQ.

from protractor.

atul221282 avatar atul221282 commented on May 5, 2024

Thanking everyone for their feedback.

I like using Karma for Unit testing and I love protractor for end to end testing but can we make protractor work for unit testing because if we can do that we will be removing dependency on karma and then for testing we just have to use protractor. Just a thought..

Regards,
Atul

from protractor.

johnjelinek avatar johnjelinek commented on May 5, 2024

They should be separate.
On Oct 10, 2013 5:52 PM, "Atul" [email protected] wrote:

Thanking everyone for their feedback.

I like using Karma for Unit testing and I love protractor for end to end
testing but can we make protractor work for unit testing because if we can
do that we will be removing dependency on karma and then for testing we
just have to use protractor. Just a thought..

Regards,
Atul


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-26098343
.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

Yes, they should be separate systems. Karma is great for what it does!

from protractor.

bbaia avatar bbaia commented on May 5, 2024

@georgiosd I've started working on the .NET port: https://github.com/bbaia/protractor-net
Feedback is welcome

from protractor.

atul221282 avatar atul221282 commented on May 5, 2024

Hi @bbaia got bit excited to see your post.
What do I need to do to get this end to end test to work on ASP.Net MVC4 project.
IF i am not wrong all i have to do is to install protractor via nuget and then just start writing test case under test project?

Wait for ur reply.

Regards,
Atul Chaudhary

from protractor.

georgiosd avatar georgiosd commented on May 5, 2024

@bbaia Have you looked at https://github.com/TestStack/TestStack.Seleno at all?
I have some custom code that is a sort of hybrid between the two!

from protractor.

bbaia avatar bbaia commented on May 5, 2024

@atul221282 Yes, check out the sample.

@georgiosd Nope, but if you want to use the PageObjects pattern, Selenium provides a package (Selenium.Support) for that.
See also protractor's documentation: https://github.com/angular/protractor/blob/master/docs/getting-started.md#organizing-real-tests-page-objects

from protractor.

jfroom avatar jfroom commented on May 5, 2024

Has anyone here gotten E2E tests to run with PhantomJS? Would you be able to share your setup on this thread? #189 Thanks.

from protractor.

jfroom avatar jfroom commented on May 5, 2024

Once there's a process it seems like one of the MD docs should be updated with how to get PhantomJS running so the insights aren't hidden away in these forums. Better yet, it may be worth integrating directly into Protractor like Karma did - imho.

from protractor.

juliemr avatar juliemr commented on May 5, 2024

I'd be happy to accept a pull request with docs on how to use PhantomJS!

from protractor.

jfroom avatar jfroom commented on May 5, 2024

Sorry, meant to put that previous comment about MD docs on a different thread!

from protractor.

reddynr avatar reddynr commented on May 5, 2024

I using protractor to perform unit testing.. I am getting error if use expect function like below. Please advice is highly appreciated.
element(by.model('ctrl.formData.emailAddress')).sendKeys('[email protected]');
var emailaddress = element(by.model('ctrl.formData.emailAddress'));

expect(emailaddress.getText()).toEqual('[email protected]');

error : Expected '' to equal '[email protected]'.

from protractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.