diff --git a/.betterer.results b/.betterer.results
index 50c4ffb3006..7f1610b1ff5 100644
--- a/.betterer.results
+++ b/.betterer.results
@@ -1139,9 +1139,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"]
],
- "public/app/core/components/ForgottenPassword/ChangePassword.tsx:5381": [
- [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
- ],
"public/app/core/components/ForgottenPassword/ForgottenPassword.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
],
@@ -1178,38 +1175,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "3"],
[0, 0, 0, "Styles should be written using objects.", "4"]
],
- "public/app/core/components/Login/LoginForm.tsx:5381": [
- [0, 0, 0, "Styles should be written using objects.", "0"],
- [0, 0, 0, "Styles should be written using objects.", "1"],
- [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"],
- [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"]
- ],
- "public/app/core/components/Login/LoginLayout.tsx:5381": [
- [0, 0, 0, "Styles should be written using objects.", "0"],
- [0, 0, 0, "Styles should be written using objects.", "1"],
- [0, 0, 0, "Styles should be written using objects.", "2"],
- [0, 0, 0, "Styles should be written using objects.", "3"],
- [0, 0, 0, "Styles should be written using objects.", "4"],
- [0, 0, 0, "Styles should be written using objects.", "5"],
- [0, 0, 0, "Styles should be written using objects.", "6"],
- [0, 0, 0, "Styles should be written using objects.", "7"],
- [0, 0, 0, "Styles should be written using objects.", "8"],
- [0, 0, 0, "Styles should be written using objects.", "9"],
- [0, 0, 0, "Styles should be written using objects.", "10"]
- ],
- "public/app/core/components/Login/LoginPage.tsx:5381": [
- [0, 0, 0, "Styles should be written using objects.", "0"]
- ],
- "public/app/core/components/Login/LoginServiceButtons.tsx:5381": [
- [0, 0, 0, "Styles should be written using objects.", "0"],
- [0, 0, 0, "Styles should be written using objects.", "1"],
- [0, 0, 0, "Styles should be written using objects.", "2"],
- [0, 0, 0, "Styles should be written using objects.", "3"],
- [0, 0, 0, "Styles should be written using objects.", "4"]
- ],
- "public/app/core/components/Login/UserSignup.tsx:5381": [
- [0, 0, 0, "Styles should be written using objects.", "0"]
- ],
"public/app/core/components/NestedFolderPicker/Trigger.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
],
@@ -1331,9 +1296,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"]
],
- "public/app/core/components/PasswordField/PasswordField.tsx:5381": [
- [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
- ],
"public/app/core/components/QueryOperationRow/OperationRowHelp.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
],
diff --git a/.pa11yci-pr.conf.js b/.pa11yci-pr.conf.js
index 71990e6a115..326925d0495 100644
--- a/.pa11yci-pr.conf.js
+++ b/.pa11yci-pr.conf.js
@@ -72,8 +72,8 @@ var config = {
"wait for element input[name='user'] to be added",
"set field input[name='user'] to admin",
"set field input[name='password'] to admin",
- "click element button[aria-label='Login button']",
- "wait for element [aria-label='Skip change password button'] to be visible",
+ "click element button[data-testid='data-testid Login button']",
+ "wait for element button[data-testid='data-testid Skip change password button'] to be visible",
],
threshold: 15,
rootElement: '.main-view',
diff --git a/.pa11yci.conf.js b/.pa11yci.conf.js
index b15b7c7d80a..5c8256c3f3e 100644
--- a/.pa11yci.conf.js
+++ b/.pa11yci.conf.js
@@ -61,8 +61,8 @@ var config = {
"wait for element input[name='user'] to be added",
"set field input[name='user'] to admin",
"set field input[name='password'] to admin",
- "click element button[aria-label='Login button']",
- "wait for element [aria-label='Skip change password button'] to be visible",
+ "click element button[data-testid='data-testid Login button']",
+ "wait for element button[data-testid='data-testid Skip change password button'] to be visible",
],
wait: 500,
rootElement: '.main-view',
diff --git a/packages/grafana-e2e-selectors/src/selectors/pages.ts b/packages/grafana-e2e-selectors/src/selectors/pages.ts
index 65d92211882..e73278d243e 100644
--- a/packages/grafana-e2e-selectors/src/selectors/pages.ts
+++ b/packages/grafana-e2e-selectors/src/selectors/pages.ts
@@ -8,10 +8,10 @@ import { Components } from './components';
export const Pages = {
Login: {
url: '/login',
- username: 'Username input field',
- password: 'Password input field',
- submit: 'Login button',
- skip: 'Skip change password button',
+ username: 'data-testid Username input field',
+ password: 'data-testid Password input field',
+ submit: 'data-testid Login button',
+ skip: 'data-testid Skip change password button',
},
Home: {
url: '/',
diff --git a/public/app/core/components/ForgottenPassword/ChangePassword.tsx b/public/app/core/components/ForgottenPassword/ChangePassword.tsx
index d24442a91e1..989ab9f81b2 100644
--- a/public/app/core/components/ForgottenPassword/ChangePassword.tsx
+++ b/public/app/core/components/ForgottenPassword/ChangePassword.tsx
@@ -1,9 +1,9 @@
import React, { SyntheticEvent } from 'react';
import { selectors } from '@grafana/e2e-selectors';
-import { Tooltip, Form, Field, VerticalGroup, Button, Alert } from '@grafana/ui';
+import { Tooltip, Form, Field, VerticalGroup, Button, Alert, useStyles2 } from '@grafana/ui';
-import { submitButton } from '../Login/LoginForm';
+import { getStyles } from '../Login/LoginForm';
import { PasswordField } from '../PasswordField/PasswordField';
interface Props {
onSubmit: (pw: string) => void;
@@ -17,6 +17,7 @@ interface PasswordDTO {
}
export const ChangePassword = ({ onSubmit, onSkip, showDefaultPasswordWarning }: Props) => {
+ const styles = useStyles2(getStyles);
const submit = (passwords: PasswordDTO) => {
onSubmit(passwords.newPassword);
};
@@ -29,24 +30,24 @@ export const ChangePassword = ({ onSubmit, onSkip, showDefaultPasswordWarning }:
)}
v === getValues().newPassword || 'Passwords must match!',
})}
+ id="confirm-new-password"
+ autoComplete="new-password"
/>
-