From f1b675b12e078585989010787570acaf2efc5c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Thu, 19 Dec 2019 07:51:32 +0100 Subject: [PATCH] e2e: Waits for login before moving forward (#21185) --- packages/grafana-e2e/src/flows/login.ts | 6 ++++++ packages/grafana-e2e/src/pages/login.ts | 1 + public/app/core/components/Login/ChangePassword.tsx | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/grafana-e2e/src/flows/login.ts b/packages/grafana-e2e/src/flows/login.ts index cef9231d2ea..d87331f50e1 100644 --- a/packages/grafana-e2e/src/flows/login.ts +++ b/packages/grafana-e2e/src/flows/login.ts @@ -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 }); }; diff --git a/packages/grafana-e2e/src/pages/login.ts b/packages/grafana-e2e/src/pages/login.ts index 73ede1a931c..c17f70ab8ce 100644 --- a/packages/grafana-e2e/src/pages/login.ts +++ b/packages/grafana-e2e/src/pages/login.ts @@ -6,5 +6,6 @@ export const Login = pageFactory({ username: 'Username input field', password: 'Password input field', submit: 'Login button', + skip: 'Skip change password button', }, }); diff --git a/public/app/core/components/Login/ChangePassword.tsx b/public/app/core/components/Login/ChangePassword.tsx index 89459416b50..db29c963032 100644 --- a/public/app/core/components/Login/ChangePassword.tsx +++ b/public/app/core/components/Login/ChangePassword.tsx @@ -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 { placement="bottom" content="If you skip you will be prompted to change password next time you login." > - + Skip