mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
separate wait for when we’re expecting login not to succeed
This commit is contained in:
@@ -58,4 +58,12 @@ export class LoginPage extends Page {
|
||||
loginWithAdmin(): promise.Promise<any> {
|
||||
return this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD);
|
||||
}
|
||||
|
||||
tryLoginWith(username: string, password?: string): promise.Promise<void> {
|
||||
const pass = password || username;
|
||||
return this.login.enterCredentials(username, pass).submit()
|
||||
.then(() => {
|
||||
browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ describe('Login', () => {
|
||||
|
||||
it('shows error when entering nonexistent user', () => {
|
||||
loginPage
|
||||
.loginWith('nonexistent-user', 'any-password')
|
||||
.tryLoginWith('nonexistent-user', 'any-password')
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
expect(errorMessage.isDisplayed()).toBe(true);
|
||||
@@ -161,7 +161,7 @@ describe('Login', () => {
|
||||
const { username } = johnDoe;
|
||||
|
||||
loginPage
|
||||
.loginWith(username, 'incorrect-password')
|
||||
.tryLoginWith(username, 'incorrect-password')
|
||||
.then(() => {
|
||||
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
|
||||
expect(errorMessage.isDisplayed()).toBe(true);
|
||||
|
Reference in New Issue
Block a user