Skip to content

Commit e3a823c

Browse files
committed
fix(e2e): fix some async quirks
1 parent 536e9a1 commit e3a823c

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

templates/app/e2e/account(auth)/login/login.spec(jasmine).js

+13-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,19 @@ describe('Login View', function() {
5656
describe('with local auth', function() {
5757

5858
it('should login a user and redirecting to "/"', function() {
59-
page.login(testUser);
60-
61-
var navbar = require('../../components/navbar/navbar.po');
62-
63-
expect(browser.getCurrentUrl()).toBe(config.baseUrl + '/');
64-
expect(navbar.navbarAccountGreeting.getText()).toBe('Hello ' + testUser.name);
59+
page.login(testUser).then(() => {
60+
var navbar = require('../../components/navbar/navbar.po');
61+
let mainPage = require('../../main/main.po');
62+
63+
browser.wait(
64+
() => element(by.css('.hero-unit')),
65+
5000,
66+
`Didn't find .hero-unit after 5s`
67+
);
68+
69+
expect(browser.getCurrentUrl()).toBe(config.baseUrl + '/');
70+
expect(navbar.navbarAccountGreeting.getText()).toBe('Hello ' + testUser.name);
71+
});
6572
});
6673

6774
it('should indicate login failures', function() {

templates/app/e2e/account(auth)/login/login.spec(mocha).js

+13-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,19 @@ describe('Login View', function() {
5656
describe('with local auth', function() {
5757

5858
it('should login a user and redirecting to "/"', function() {
59-
page.login(testUser);
60-
61-
var navbar = require('../../components/navbar/navbar.po');
62-
63-
<%= expect() %>browser.getCurrentUrl()<%= to() %>.eventually.equal(config.baseUrl + '/');
64-
<%= expect() %>navbar.navbarAccountGreeting.getText()<%= to() %>.eventually.equal('Hello ' + testUser.name);
59+
page.login(testUser).then(() => {
60+
var navbar = require('../../components/navbar/navbar.po');
61+
let mainPage = require('../../main/main.po');
62+
63+
browser.wait(
64+
() => element(by.css('.hero-unit')),
65+
5000,
66+
`Didn't find .hero-unit after 5s`
67+
);
68+
69+
<%= expect() %>browser.getCurrentUrl()<%= to() %>.eventually.equal(config.baseUrl + '/');
70+
<%= expect() %>navbar.navbarAccountGreeting.getText()<%= to() %>.eventually.equal('Hello ' + testUser.name);
71+
});
6572
});
6673

6774
describe('and invalid credentials', function() {

0 commit comments

Comments
 (0)