e2e: Waits for login before moving forward (#21185)

This commit is contained in:
Hugo Häggmark 2019-12-19 07:51:32 +01:00 committed by GitHub
parent 0676189291
commit f1b675b12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -8,5 +8,11 @@ export const login = (username: string, password: string) => {
.type(username);
e2e.pages.Login.password().type(password);
e2e.pages.Login.submit().click();
e2e.pages.Login.skip()
.should('be.visible')
.click();
e2e()
.get('.login-page')
.should('not.exist');
e2e().logToConsole('Logged in with', { username, password });
};

View File

@ -6,5 +6,6 @@ export const Login = pageFactory({
username: 'Username input field',
password: 'Password input field',
submit: 'Login button',
skip: 'Skip change password button',
},
});

View File

@ -1,7 +1,9 @@
import React, { PureComponent, SyntheticEvent, ChangeEvent } from 'react';
import React, { ChangeEvent, PureComponent, SyntheticEvent } from 'react';
import { Tooltip } from '@grafana/ui';
import appEvents from 'app/core/app_events';
import { AppEvents } from '@grafana/data';
import { e2e } from '@grafana/e2e';
import appEvents from 'app/core/app_events';
interface Props {
onSubmit: (pw: string) => void;
@ -115,7 +117,7 @@ export class ChangePassword extends PureComponent<Props, State> {
placement="bottom"
content="If you skip you will be prompted to change password next time you login."
>
<a className="btn btn-link" onClick={this.onSkip}>
<a className="btn btn-link" onClick={this.onSkip} aria-label={e2e.pages.Login.selectors.skip}>
Skip
</a>
</Tooltip>