Closed glepretre closed 9 years ago
I have the same issue.
I can't reproduce this. Here's a config and test that I used to verify that browser.get
gets called:
exports.config = {
directConnect: true,
capabilities: {
'browserName': 'chrome'
},
framework: 'jasmine2',
specs: ['example_spec.js'],
onPrepare: function() {
browser.driver.manage().window().maximize();
browser.get('http://juliemr.github.io/protractor-demo');
}
};
describe('site', function() {
it('should do stuff', function() {
expect(browser.getTitle()).toEqual('Super Calculator');
expect(true).toBe(true);
});
});
Can you modify this to get the same failure you're seeing?
directConnect
does not affect the issue (same error with or without).
It works with framework: 'jasmine2'
. Here's the output:
Starting Protractor (https://github.com/angular/protractor)
-------------------------------------------------------------------
DEBUG - Running with --troubleshoot
DEBUG - Protractor version: 2.0.0
DEBUG - Your base url for tests is http://localhost:8000
[launcher] Running 2 instances of WebDriver
.
------------------------------------
[chrome #1] PID: 26947
[chrome #1] Specs: /home/gilles/project/e2e/app_test.js
[chrome #1]
[chrome #1] Using the selenium server at http://127.0.0.1:4444/wd/hub
[chrome #1] DEBUG - WebDriver session successfully started with capabilities { caps_:
[chrome #1] { platform: 'LINUX',
[chrome #1] acceptSslCerts: true,
[chrome #1] javascriptEnabled: true,
[chrome #1] browserName: 'chrome',
[chrome #1] chrome: { userDataDir: '/tmp/.com.google.Chrome.GgR1hJ' },
[chrome #1] rotatable: false,
[chrome #1] locationContextEnabled: true,
[chrome #1] mobileEmulationEnabled: false,
[chrome #1] 'webdriver.remote.sessionid': '51c51a3e-6ba6-4165-9fe6-255ff76fcf6b',
[chrome #1] version: '41.0.2272.101',
[chrome #1] takesHeapSnapshot: true,
[chrome #1] cssSelectorsEnabled: true,
[chrome #1] databaseEnabled: false,
[chrome #1] handlesAlerts: true,
[chrome #1] browserConnectionEnabled: false,
[chrome #1] nativeEvents: true,
[chrome #1] webStorageEnabled: true,
[chrome #1] applicationCacheEnabled: false,
[chrome #1] takesScreenshot: true } }
[chrome #1] Started
[chrome #1] .
[chrome #1]
[chrome #1]
[chrome #1] 1 spec, 0 failures
[chrome #1] Finished in 4.207 seconds
(Same for firefox)
We were considering start using jasmine 2 for a while now. I think we are going to use it for new projects (beginning with this one) but it will take us some time for older projects since we have around one hundred of e2e tests using Protractor/Jasmine 1.
Could it be related to #1981 and #1885?
Ah yes, I can reproduce now, with my config above but with framework: 'jasmine'
! Thank you. I think this is related to #1981. I'm pretty sure this is due to changes in WebDriverJS and how it handles scheduling to the control flow.
The easy fix is that onPrepare
will force a wait for any promise returned within it to resolve. So, you can change to:
onPrepare: function() {
browser.driver.manage().window().maximize();
return browser.get('http://juliemr.github.io/protractor-demo'); // Added return statement here
}
and it will work again in both jasmine 1.3 and jasmine 2.
I'm adding a note about this to the changelog!
The "easy fix" works like a charm! :ok_hand: Thank you for your help. We have started migrating to jasmine 2, it is not as difficult as I expected it to be.
But it's good to know that our older projects will still benefit from an up-to-date Protractor version while waiting for the migration to be complete. :grinning:
@glepretre "It works with framework: 'jasmine2'" It worked for me as well, thanks!
I have the same issues, but Im using 'mocha' as a framework, and I cant change it to jasmine since everything is written using mocha. any easy fix here too?
worked
Even I am getting the same error while trying to run protractor with Cucumber. When I am running in my local machine it is working fine. but when the test is triggered from Team-city on the deployed server I am getting the error. I am using selenium 2.45 jar. Please help.
leme try this solution https://github.com/angular/protractor/issues/1992
I can't run my test cases if i changed the framwork from "jasmine" to "jasmine2" in the conf file this issue doesn't recreate in my local machine only when I run it on Linux by Jenkins. Can you please help me to enlarge the screensize to maximum (or to simulate a widescreen) ? thanks.
As I said in #1962, our angular app is manually bootstrapped (mainly because of requireJS) but it never caused any issue with Protractor.
Here is the app_test.js (this is the real test, we are starting a new project, with just a Hello World directive for now, while building the app structure).
protractor.conf.js
output
(Same for
firefox #2
so I don't think it would be relevant to add its output too).I can see that the
browser.driver.manage().window().maximize();
is being called but I thinkbrowser.get('e2e/index.html');
isn't.The address bar contains
data:,
instead ofhttp://localhost:8000/project/e2e/index.html
.If I move the
browser.get()
inside the test itself, it works and pass.Please tell me if you need more info or if you want me to try ideas here :wink: