angular / protractor Goto Github PK
View Code? Open in Web Editor NEWE2E test framework for Angular apps
Home Page: http://www.protractortest.org
License: MIT License
E2E test framework for Angular apps
Home Page: http://www.protractortest.org
License: MIT License
Currently, an error from webdriver (such as an element not found) immediately exits and prints the stack trace, and does not quit the driver. This is useful when in-depth debugging one test, but not very nice if you just want to run the entire suite and see your failures. There should be an option to just have errors turn into failures.
For example:
var slowHttpStatus =
ptor.findElement(protractor.By.binding('slowHttpStatus'));
var button = ptor.findElement(protractor.By.css('[ng-click="slowHttp()"]'));
expect(slowHttpStatus.getText()).toEqual('not started');
button.click();
expect(slowHttpStatus.getText()).toEqual('done');
Because slowHttpStatus is being reused instead of found again with ptor.findElement
it does wait for Angular to finish up $http requests.
Currently it is not possible to access other features from selenium-webdriver that are not provided in that package's WebDriver class.
In particular, this was biting me because I needed access to ActionSequence. Currently the only way for me to reach it is to require another copy of selenium-webdriver within my test script:
var webdriver = require('selenium-webdriver');
// ...
ptor.findElement(protractor.by.id("Something"))
.then(function(e)) {
new webdriver.ActionSequence(ptor.driver)
.dragAndDrop(elem, somewhereElse)
.perform();
});
One solution would be for protractor to mix the other webdriver exports into its own exports.
Our app has a poller which makes calls to an API every 3 seconds. When I load a page with has an active instance of the poller Protractor will always time out.
The poller is started when the page loads and uses the Angular $timeout
function.
Is there a way to get Protractor to ignore the poller or send a signal to the app to pause the poller momentarily so the E2E test can finish running?
This could be a nice way to get info about what's going on in Angular:
ptor.findElement(...).evaluateInScope('user.name');
Someway to make the Protractor sleep for the given amount of time, would be helpful to have in case of fast traversing pages, where not much activities are happening.
Similar to karma,if I want to run same test case in multiple browsers, how can I pass my browser name from gruntfile instead of hard code in test case?
Also, if i want to run post build e2e testing , how can I pass pram to the URL from grunt file? You know Karma provides powerful configuration options , can we have similar in protractor?
I can run my end 2 end with protractor, but it is just not so perfect, like auto download selenium stnadalone/chromedriver , and run same test cases in multiple browsers.
Is this within the scope of the project or would you rather see it as a plugin?
Using chromedriver (on Mac), if tests fail or Webdriver throws an error, the browser windows remain open until I manually close them. Although this is just a nuissance on the desktop, it's problematic for CI environments.
Folks may want to introduce most custom configuration via the command line than just the baseUrl. Should allow for this.
When trying to create a test which checks the result of an option
+ click()
event in my app, Keys is not defined
.
This is the test being run (apologies if the JS looks malformed, it's converted from CoffeeScript):
var driver = new webdriver.Builder()
.usingServer('http://localhost:4444/wd/hub')
.withCapabilities(webdriver.Capabilities.chrome()).build()
driver.manage().timeouts().setScriptTimeout(30000)
var ptor = protractor.wrapDriver(driver)
it('opens new tab with OPTION+click', function() {
ptor.keyDown(Keys.ALT)
.then(function() {
ptor.findElement(protractor.By.repeater('item in ses.items').row(4).column("{{item.subject}}")).click();
ptor.keyUp(Keys.ALT);
})
ptor.findElements(protractor.By.repeater('item in ses.navItems'));
.then(function(tabs) {
expect(tabs.length).toBe(1);
});
});
I've also tried the following variations for Keys.ALT
: ptor.driver.Keys.ALT
, ptor.driver.Key.ALT
, and Key.ALT
It's entirely possible I'm not writing this test correctly. If that's the case I'd appreciate any pointers in testing clicks with key modifiers.
I am new to angular JS testing , I followed you instruction for setup the protractor with sample. While on execute the testcases I getting a error
C:\Documents and Settings\sweet\Application Data\npm\node_modules\protractor\bin>protractor e:\protractor_workspace\protractor-master\example\protractorConf.js
Using the selenium server at http://localhost:4444/wd/hub
FF
Failures:
I changed browser name and path only in "protractorConf.js".
capabilities: {
'browserName': 'firefox'
},
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
// Spec folders are relative to the current working directly when
// protractor is called. This can be folders or files.
specFolders: ['e:/protractor_workspace/protractor-master/example/onProtractor.js'],
isVerbose: false,
showColors: true,
includeStackTrace: true
}
};
let me know I made any mistake ?
Would make initial setup easier.
For example, "foo in foos" should match for
Tips & tricks for debugging should be documented.
Currently I'm running my tests against a server which responds to my AJAX requests with canned chunks of JSON. It would be great to be able to make assertions against these requests in a similar way to karma
$httpBackend.expectGET('some/url').respond({some: 'JSON'});
The only solution I have right now is to run protractor and my connect server in the same process and then write an interface a bit like this manually.
I'd love to get a discussion going about plans to deal with this in protractor.
When wrapping a driver, shouldn't protractor expose the underlying driver methods as well as angular-specific ones? For example:
ptor.get("http://www.smashingmagazine.com");
ptor.getTitle().then(function(title) {
expect(title).to.equal('Smashing Magazine โ For Professional Web Designers and Developers');
done();
});
getTitle
is a method on the wrapped driver, but not available after being wrapped.
I am trying protractor to conduct my e2e test on angular app . At beginning i have just written two test cases with simple DOM assertions sometime my test run successfully but majority of time they fail with Message timeout:timed out after 5000 msec waiting for spec to complete .Could you guide me how to resolve this issue
If you have something like
With no children of the ng-repeated element, protractor.By.repeater() won't find the column.
Note that it will still find rows.
Currently, isElementPresent won't work with all protractor bindings.
If protractor.get() gets to the page before AngularJS is loaded, it just dies with an ugly error message. It should retry once or twice, and then fail with a nice message.
Is there a plan in the short term to document the angular.js / protractor integration? Right now the only way to see the angular specific protractor functions is by browsing the codebase.
I've been attempting to use Protractor to test some of my angular code but I can't seem to get any assertions to work. I can see my web app fire up, and selenium is running properly but I immediately see: 1 test, 0 assertions, 0 failures
even though I have assertions in place.
Here's a screenshot of my .conf
file, my login_spec.js
and the output I'm seeing in console.
Here's another screenshot that shows the angular template file that is injected into my ng-view:
The console.log
correctly fires, and I can see the output in my terminal, but the assertion doesn't seem to have any effect.
"An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code." http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-and-implicit-waits
Is it possible to do something like ptor.until(mycondition_to_continue_testing)
?
This question has been asked on stackoverflow also.
Is there a way to click on a hidden value. I would like to be able to do something like
driver.findElement(protractor.By.xpath('/html/body/div/div/a')).mouseover.then(function() {
ptor.findElement(protractor.By.className('name').getText().then(function(result) {
expect(result).toBe('Me');
});
});
when the menu item is not visible, or are we limited with this at the moment. If this is not possible would this be a likely addition to Protractor in the future and is there a way around this issue at present.
Question cross-posted on SO. http://stackoverflow.com/q/18394261/1226721
I have gone around this as many ways as I can think, and still can't get this to work. I am trying to switch to a popUp as a way to automate a login. Protractor goes to my main page, clicks the login button and waits for the loggin popup.
The setup:
var ptor;
beforeEach(function() {
var handlesDone = false;
ptor = protractor.getInstance();
ptor.get('#/');
runs(function() {
return ptor.findElement(protractor.By.className('btn')).click();
});
waits(3000);
runs(function() {
return ptor.getAllWindowHandles().then(function(handles) {
popUpHandle = handles[1];
parentHandle = handles[0];
return handlesDone = true;
});
});
waitsFor(function() {
return handlesDone;
});
});
So far so good, next I want to make sure that I have, in fact, a window handle for my pop-up:
describe('login', function() {
it('should switch to popUp\'s handle', function() {
expect(popUpHandle).toBeDefined();
finally, I try to switch to this window:
ptor.switchTo().window(popUpHandle).getWindowHandle().then(function(handle) {
expect(handle).toEqual(popUpHandle);
});
});
});
Yet no matter what I have tried, I keep getting the following error:
login
should switch to popUp's handle
Failures:
Finished in 5.388 seconds
1 test, 2 assertions, 1 failure
as you can see, I have 2 assertions:
that popUpHandle is defined
that the handle after the switchTo is the same as the popUpHandle
I have tested that I have 2 handles total. I have tested that they are both strings. I have tested that they are different from each other. In this example I test that popUpHandle is defined. All those test pass. Yet no mater what I do, when I try to plug a handle into the .switchTo().window() method I get the same "nameOrHandle is not defined".
I'm stumped. There is so little documentation on WebDriverjs I can't even be sure that switchTo is implemented. Does anyone know what is going on here?
Thanks.
I want to let the protractor runner launch my selenium standalone server, but I need it to launch chromedriver from a manually-specified path to the binary. Presently, protractor will only launch with chromedriver if the chromedriver binary is available in my PATH.
I propose adding a string property to config:
seleniumJarArgs: "-Dwebdriver.chrome.driver=/path/to/chromedriver"
Which would be executed as
java -jar path/to/selenium-standalone.jar -Dwebdriver.chrome.driver=/path/to/chromedriver
This question is on stackoverflow.
I am testing an application written predominantly in angularjs however some elements of the application are written in .NET C#, such as the login form.
My question is this.
Can I leverage Protractor and test my application fully with e2e testing.
I have tried using protractor and I am happy with it thus far. However I do not seem to be able to test a page that written in .NET. I am not sure if this is because protractor only tests the elements of an angular application or if it is the way I have written my tests.
I have tried searching for the elements in the page like the example below.
ptor.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).sendKeys('xxx');
But this only returns an UnknownError: javascript error: cannot call method 'get' of undefined.
I know that this error means the elements are not visible on the page, however I have placed a timeout in my test shown below to see if this helps. I have also tried sleep(5000) but this doesn't help either.
it('test if div apears', function () {
ptor = protractor.getInstance();
ptor.get('/Test/Index');
var text = ptor.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).sendKeys('xxx');
expect(text).toEqual('Index');
}, 10000);
all I require is to be able to add text to a dynamically created input box, created by Html.TextBoxFor()
You should be able to write:
var myElem = ptor.findElement(protractor.by.Id('#yourelem'));
expect(myElem.getText()).toEqual('foobar');
With 0.5.0 I can setup my conf.js
file to point to a directory of spec files, which are automatically found and run:
// 0.5.0
jasmineNodeOpts: {
specFolders: ['spec-dir']
}
With 0.6.1 and the change to minijasminenode this behaviour no longer works and users are required to enumerate each spec manually
// 0.6.1
specs: ['spec-dir/some_spec.js', 'spec-dir/some_other_spec.js']
This is a problematic regression as being able to point to specs-dir
(or even a glob matcher) is preferable to enumerating each spec file manually IMHO.
Hi,
This is a repost of issue #14 (apologies as I couldn't figure out how to reopen the closed issue per the closing comments). Some of the comments in that post seem to suggest that this may be a windows related issue. I'm running Win7 64 and am experiencing the same symptoms described in the original issue. I've added more details to the original issue thread.
I've added a timer test to attempt to wait for the browser to open and discovered that the browser doesn't actually open until my tests are complete. Putting a monster delay in the spec file (10 seconds) simply delayed the browser from opening until it completed running.
Thanks again for any help you can provide.
I'd like to be able to run the runner from Grunt instead of bash, but the runner is currently just a CLI that gets the config from the process args. I propose making the runner an exported node library, and creating a separate CLI script to wrap it.
In Jenkins, I had one test failure using protractor runner, but Jenkins considered it a success because the process is not being explicitly exited by the runner, and is therefore not exiting with an appropriate error code (e.g. anything other than 0).
I am testing web application with some access restrictions. Main part of this application is developed using AngularJS framework however to access this part user needs to be authenticated by "none Angular" web page. When I am trying to get instance of protractor to enter credentials on "none Angular" page using following code
var ptor = protractor.getInstance();
ptor.get('http://localhost:3000');
I get error
15:26:19.740 INFO - Executing: [new session: {browserName=chrome}] at URL: /session)
15:26:19.742 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Started ChromeDriver
port=34098
version=26.0.1383.0
log=C:\opt\selenium-server\chromedriver.log
15:26:20.489 INFO - Done: /session
15:26:20.496 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@5bb48c07 at URL: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6)
15:26:20.498 INFO - Done: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6
15:26:20.528 INFO - Executing: [set script timeoutt: 100000] at URL: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6/timeouts/async_script)
15:26:20.559 INFO - Done: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6/timeouts/async_script
15:26:20.596 INFO - Executing: [execute async script: return (function () {
var callback = arguments[arguments.length - 1];
angular.element(document.body).injector().get('$browser').
notifyWhenNoOutstandingRequests(callback);
}).apply(null, arguments);, []] at URL: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6/execute_async)
15:26:21.239 WARN - Exception thrown
org.openqa.selenium.WebDriverException: Script execution failed. Script: return (function () {
var callback = arguments[arguments.length - 1];
angular.element(document.body).injector().get('$browser').
notifyWhenNoOutstandingRequests(callback);
}).apply(null, arguments);;
angular is not defined (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13 milliseconds
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Session ID: 7c5980b1f3b725539e6b4ce7af942af0
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=28.0.1500.95, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.executeAsyncScript(RemoteWebDriver.java:481)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.executeAsyncScript(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.executeAsyncScript(EventFiringWebDriver.java:221)
at org.openqa.selenium.remote.server.handler.ExecuteAsyncScript.call(ExecuteAsyncScript.java:57)
at org.openqa.selenium.remote.server.handler.ExecuteAsyncScript.call(ExecuteAsyncScript.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
15:26:21.245 WARN - Exception: Script execution failed. Script: return (function () {
var callback = arguments[arguments.length - 1];
angular.element(document.body).injector().get('$browser').
notifyWhenNoOutstandingRequests(callback);
}).apply(null, arguments);;
angular is not defined (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13 milliseconds
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Session ID: 7c5980b1f3b725539e6b4ce7af942af0
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=28.0.1500.95, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
15:26:21.459 INFO - Executing: [delete session: b01e86b3-7e7a-4dc1-afd5-f95232bb69c6] at URL: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6)
15:26:22.771 INFO - Done: /session/b01e86b3-7e7a-4dc1-afd5-f95232bb69c6
I think it would be nice to allow for using protractor also in cases similar to mine
Hello,
I've just started looking at protractor for our angularjs apps and looks very promising.
I want to use ptor.getCurrentUrl() to get url after login to make sure that I actually got logged in. My code looks something like this:
var util = require('util');
describe('Sign In Page', function() {
var ptor;
beforeEach(function() {
ptor = protractor.getInstance();
ptor.get('#/login/');
ptor.waitForAngular();
});
it ('Login', function(){
ptor.findElement(protractor.By.css('input[name=email]')).sendKeys("***");
ptor.findElement(protractor.By.css('input[name=password]')).sendKeys("***");
ptor.waitForAngular();
var currentUrl = ptor.getCurrentUrl();
console.log(currentUrl);
}, 20000);
it('afterAll', function(){
});
});
I'm using
var currentUrl = ptor.getCurrentUrl();
console.log(currentUrl);
to see what exactly gets stored and in console I see following result:
APankov$ node_modules/.bin/protractor conf.js
Using the selenium server at http://localhost:4444/wd/hub
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
What am doing wrong in this case?
Thank you
Moving from angular/angular.js#3090
I ran into this when installing protractor globally with npm install -g protractor
and attempting to run with protractor example/protractorConf.js
, it seems that with protractor installed globally there is a problem with protractor.getInstance()
returning undefined which leads me to think this is a path issue with one of the module imports within the protractor code.
The two lines of code that trigger the below exception are:
https://github.com/juliemr/protractor/blob/master/example/onProtractor.js#L10
https://github.com/juliemr/protractor/blob/master/example/onProtractor.js#L21
npm install -g protractor
cd [path-where-you-have-protractor-checked-out]
protractor example/protractorConf.js
$ pwd
/Users/davidmosher/code/protractor
davidmosher@localhost:~/code/protractor (master) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [11:30:57]
$ protractor example/protractorConf.js
Using the selenium server at http://localhost:4444/wd/hub
FF
Failures:
1) angularjs homepage should greet using binding
Message:
TypeError: Cannot call method 'get' of undefined
Stacktrace:
TypeError: Cannot call method 'get' of undefined
at null.<anonymous> (/Users/davidmosher/code/protractor/example/onProtractor.js:10:10)
at /Users/davidmosher/code/protractor/jasminewd/index.js:54:12
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/davidmosher/code/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1431:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/Users/davidmosher/code/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1296:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
==== async task ====
at null.<anonymous> (/Users/davidmosher/code/protractor/jasminewd/index.js:53:12)
at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
2) angularjs homepage should list todos
Message:
TypeError: Cannot call method 'get' of undefined
Stacktrace:
TypeError: Cannot call method 'get' of undefined
at null.<anonymous> (/Users/davidmosher/code/protractor/example/onProtractor.js:21:10)
at /Users/davidmosher/code/protractor/jasminewd/index.js:54:12
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/davidmosher/code/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1431:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/Users/davidmosher/code/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1296:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
==== async task ====
at null.<anonymous> (/Users/davidmosher/code/protractor/jasminewd/index.js:53:12)
at null.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/minijasminenode/lib/async-callback.js:45:37)
Finished in 0.044 seconds
2 tests, 2 assertions, 2 failures
$ java -jar /usr/local/opt/selenium-server-standalone/selenium-server-standalone-2.33.0.jar -p 4444 -Dwebdriver.chrome.driver=/usr/local/opt/chromedriver/bin/chromedriver
Jul 20, 2013 11:34:03 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
Setting system property webdriver.chrome.driver to /usr/local/opt/chromedriver/bin/chromedriver
11:34:08.149 INFO - Java: Apple Inc. 20.51-b01-457
11:34:08.150 INFO - OS: Mac OS X 10.8.4 x86_64
11:34:08.161 INFO - v2.33.0, with Core v2.33.0. Built from revision 4e90c97
11:34:08.287 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:34:08.288 INFO - Version Jetty/5.1.x
11:34:08.289 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:34:08.289 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:34:08.290 INFO - Started HttpContext[/,/]
11:34:08.332 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@47d62270
11:34:08.333 INFO - Started HttpContext[/wd,/wd]
11:34:08.342 INFO - Started SocketListener on 0.0.0.0:4444
11:34:08.342 INFO - Started org.openqa.jetty.jetty.Server@54cbf30e
11:34:34.683 INFO - Executing: [new session: {browserName=chrome}] at URL: /session)
11:34:34.697 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Started ChromeDriver
port=47466
version=26.0.1383.0
log=/Users/davidmosher/code/protractor/chromedriver.log
objc[38541]: Object 0x79a75480 of class NSPathStore2 autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[38541]: Object 0x79c752a0 of class NSPathStore2 autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[38541]: Object 0x79c75550 of class NSConcreteData autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[38541]: Object 0x79a75510 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[38541]: Object 0x79c75210 of class NSBundle autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
11:34:36.265 INFO - Done: /session
11:34:36.281 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@472462b3 at URL: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a)
11:34:36.281 INFO - Done: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a
11:34:36.295 INFO - Executing: [set script timeoutt: 100000] at URL: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a/timeouts/async_script)
11:34:36.301 INFO - Done: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a/timeouts/async_script
11:34:36.306 INFO - Executing: [delete session: 0307b782-d185-4af4-acd8-8dbe4b52be6a] at URL: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a)
11:34:36.874 INFO - Done: /session/0307b782-d185-4af4-acd8-8dbe4b52be6a
This does not occur when using the local binary ./bin/protractor example/protractorConf.js
or if you have used npm link
within the protractor project directory (which makes sense as it just provides a global alias for the protractor
command that points to the local binary in ./bin/protractor).
I also tested this against my own project and tests and could not get specs to execute using globally installed protractor. My workaround for the time being has just been to execute specs using ./node_modules/protractor/bin/protractor config/spec-e2e.js
as can be seen here
querySelectorAll throws an error when there's a '.' in the model name.
I'm not sure if Protractor is intended to to be used with, in addition to, or instead of Karma.
Maybe a few words in the Readme would be helpful?
protractor.By.cssSelector is not defined. The webdriver API includes this functionality and so should protractor.js.
Trace:
TypeError: Object [object Object] has no method 'cssSelector'
I started with a new project via yo angular
and first tried to replace e2e with protractor. Here's my main.html:
<div class="hero-unit">
<h1>'Allo, 'Allo!</h1>
<p>You now have</p>
<ul>
<li ng-repeat="thing in awesomeThings">{{thing}}</li>
</ul>
<p>installed.</p>
<h3>Enjoy coding! - Yeoman</h3>
<button id="sendMessage" ng-click="sendMessage()">Send Message</button>
<input type="text" id="msg" ng-model="message">
</div>
Here's my main controller:
'use strict';
angular.module('tradeblastApp')
.controller('MainCtrl', function ($scope) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
$scope.sendMessage = function () {
$scope.message = 'Message Received';
};
});
Here's my protractor test:
describe('App', function () {
describe('Index', function () {
var ptor = protractor.getInstance();
beforeEach(function () {
ptor.get('');
});
it('should send a message', function () {
var button = ptor.findElement(protractor.By.id('sendMessage'));
var message = ptor.findElement(protractor.By.id('msg')).getText();
expect(message).toBe('');
button.click();
expect(message).toBe('Message Received');
});
});
});
Here's my protractor.conf.js:
exports.config = {
seleniumServerJar: './selenium/selenium-server-standalone-2.34.0.jar',
seleniumPort: null,
chromeDriver: './selenium/chromedriver',
seleniumArgs: [],
specs: [
'test/scenarios.js',
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:9000',
jasmineNodeOpts: {
// onComplete will be called before the driver quits.
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true
}
};
Here's my error message:
$ protractor protractor.conf.js
Starting selenium standalone server...
Selenium standalone server started at http://10.211.55.10:58088/wd/hub
F
Failures:
1) App Index should send a message
Message:
Expected '' to be 'Message Received'.
Stacktrace:
Error: Expected '' to be 'Message Received'.
at /usr/lib/node_modules/protractor/jasminewd/index.js:79:32
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1438:20)
at notify (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
at notifyAll (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
at fulfill (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
at Object.webdriver.promise.asap (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:672:5)
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1449:25)
Finished in 4.604 seconds
1 test, 2 assertions, 1 failure
Shutting down selenium standalone server
I think this test should pass though as I literally see the appropriate message displayed in the browser before the test concludes and the browser closes. Also, I've tried changing var message = ptor.findElement(protractor.By.id('msg')).getText();
to var message = ptor.findElement(protractor.By.binding('{{message}}')).getText();
but then it can't even find the element, which is strange. Any thoughts?
Hi. I cloned the repo, followed all instructions but when I execute the example suite or the testapp suite, I always get the same error:
TypeError: Cannot call method 'get' of undefined
When I look at the code, it is always referring at ptor instance being undefined.
Context:
The test application is up and running on port 8000 and the angularjs site is accesible as well. Both suites should be able to fulfill its purpose.
Im running on osx, using chrome driver and the standalone selenium server.
I have not made any change on the code.
As an example of the error:
1) test application finding elements in forms should find an element by binding
Message:
TypeError: Cannot call method 'get' of undefined
Stacktrace:
TypeError: Cannot call method 'get' of undefined
at null.<anonymous> (/Users/sesteva/Development/Projects/protractor/spec/testAppSpec.js:26:12)
at jasmine.Block.execute (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:1064:17)
at jasmine.Queue.next_ (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2096:31)
at jasmine.Queue.start (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2049:8)
at jasmine.Spec.execute (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2376:14)
at jasmine.Queue.next_ (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2096:31)
at jasmine.Queue.start (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2049:8)
at jasmine.Suite.execute (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2521:14)
at jasmine.Queue.next_ (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2096:31)
at jasmine.Queue.start (/usr/local/share/npm/lib/node_modules/protractor/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2049:8)
Thanks
This issue may not be Protractor related but I'm not sure where else to look. My setup is using Protractor with jasmine-node to test an Angular front-end to a Rails app. When I try to get how many elements are found by protractor.findElements
it always errors out.
My spec file follows the onJasmineNode example. So far I've tried the following:
ptor.findElements(protractor.By.css('.selector-string')).size();
: [object object] has no method sizeptor.findElements(protractor.By.css('.selector-string')).count();
: [object object] has no method countptor.findElements(protractor.By.css('.selector-string')).length;
: undefined is not a functionFor fun I wrapped the findElements in a console.log and it returns this:
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
This currently doesn't work in webdriver with js selectors, but it's a huge pain when there are two elements with the same binding (e.g. item.name).
I tried to start up selenium standalone server in my testing script:
var SeleniumServer = require('selenium-webdriver/remote');
var server = new SeleniumServer.SeleniumServer({
jar: 'test/e2e/selenium-server-standalone-2.33.0.jar',
port: 4444
});
server.start();
I can start up the server , and works fine in firefox. But if run test for Chrome, there is no parameter for me to pass the chromedriver's location, and it looks for the chromedriver in root path instead.
Bindings and model can fail if alternate forms are used: data-ng-foo, x-ng-foo, ng:foo and ng_foo. Should search by regexp match instead.
Would love to see this supported. Currently we are experimenting with using protractor as a library for our mocha tests; thank you, included code example ;)
If there is some high-level conceptual understanding that someone could present that would describe how to accomplish this, I would love to fork this and do it myself. Some guidance as to the right direction to head would be awesome, if anyone has any ideas.
We want to run protractor tests on Jenkins, so it would be very useful if there was a junit reporter (like karma has) so the status of the tests can be reported by Jenkins
Why not look at Cucumber.js? It also uses Selenium and is a full stack web testing framework. Looks awesome!!!
https://github.com/cucumber/cucumber-js
Would be nice with a Cucumber.js integration with AngularJS IMO. What are the pros/cons of protractor vs cucumber for e2e testing?
They are even building a common DSL, "Kite" for use with both headless and browser testing etc. :)
Should provide best practices for how to organize testing a page, such as the DSL that Angular Scenario Runner provided.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.