-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBedtype: bug/fix
Description
Steps to reproduce and a minimal demo of the problem
Setup a basic NG1 -> NG2 hybrid application and run E2E tests with protractor
Main entry point
upgradeAdapter.addProvider([...PROVIDERS, ...ENV_PROVIDERS, ...DIRECTIVES, ...PIPES]);
return upgradeAdapter.bootstrap(document.documentElement,
['app'], {strictDi: true});Protractor config
const defaultConfig = {
multiCapabilities: [
{
browserName: 'chrome', true, maxInstances: 6,
chromeOptions: { args: ['--lang=en', '--window-size=360,600'] }
}
],
getPageTimeout: 10000, // How long to wait for a page to load in ms.
allScriptsTimeout: 22000,
baseUrl: 'http://localhost:3001',
specs: `${__dirname}/../test/e2e/*.spec.js`,
jasmineNodeOpts: {
// If true, print colors to the terminal.
showColors: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
}
};
module.exports = { config: defaultConfig };Sample test
const LoginPage = require('./page-objects/login.page');
const NavPage = require('./page-objects/nav.page');
const LogHelpers = require('./helpers/log.helper');
describe('login', () => {
const loginPage = new LoginPage();
const navPage = new NavPage();
const logHelpers = new LogHelpers();
beforeEach(() => {
browser.get('login');
});
afterEach(() => {
logHelpers.expectNoErrors();
});
describe('when valid credentals are given', () => {
it('takes user to home', () => {
expect(loginPage.submit.isEnabled()).toBe(false);
loginPage.loginUser().then(() => {
return navPage.logout.click();
}).then(() => {
return expect(browser.getCurrentUrl()).toMatch(/home/);
});
});
});
});Current behavior
Protractor throws the following error, no matter the timeout-
[chrome #1-10] Message:
[chrome #1-10] Failed: Timed out waiting for Protractor to synchronize with the page after 22 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md[UPDATE] -
I have tracked down the behavior to timeout when trying to use the getCurrentUrl method.
this.loginUser = () => {
return this.username.sendKeys('test').then(() => { // this succeeds
return this.password.sendKeys('test'); // this succeeds
}).then(() => {
return this.submit.click(); // this succeeds
}).then(() => {
expect(browser.getCurrentUrl()).not.toMatch(/login/); // this times out
});
};Expected/desired behavior
A successful test
Other information
Angular 1.x Version = 1.5.3
Angular 2.x Version = 2.0.0-rc.1
Protractor Version = 3.3.0
Possibly related to this PR - #7603
Metadata
Metadata
Assignees
Labels
area: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBedtype: bug/fix