Skip to content

Commit

Permalink
A11y tests for user page (#79199)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyarm committed Oct 5, 2020
1 parent f6729dc commit 14e58fb
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export class EditUserPage extends Component<Props, State> {

{isNewUser || showChangePasswordForm ? null : (
<EuiFormRow label="Password">
<EuiLink onClick={this.toggleChangePasswordForm}>
<EuiLink data-test-subj="changePassword" onClick={this.toggleChangePasswordForm}>
<FormattedMessage
id="xpack.security.management.users.editUser.changePasswordButtonLabel"
defaultMessage="Change password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export class UsersGridPage extends Component<Props, State> {
toolsRight: this.renderToolsRight(),
box: {
incremental: true,
'data-test-subj': 'searchUsers',
},
onChange: (query: any) => {
this.setState({
Expand Down
106 changes: 106 additions & 0 deletions x-pack/test/accessibility/apps/users.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// a11y tests for spaces, space selection and spacce creation and feature controls

import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['security', 'settings']);
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const retry = getService('retry');

describe('Kibana users page a11y tests', () => {
before(async () => {
await esArchiver.load('empty_kibana');
await PageObjects.security.clickElasticsearchUsers();
});

it('a11y test for user page', async () => {
await a11y.testAppSnapshot();
});

it('a11y test for search user bar', async () => {
await testSubjects.click('searchUsers');
await a11y.testAppSnapshot();
});

it('a11y test for searching a user', async () => {
await testSubjects.setValue('searchUsers', 'test');
await a11y.testAppSnapshot();
await testSubjects.setValue('searchUsers', '');
});

it('a11y test for toggle button for show reserved users only', async () => {
await retry.waitFor(
'show reserved users toggle button is visible',
async () => await testSubjects.exists('showReservedUsersSwitch')
);
await testSubjects.click('showReservedUsersSwitch');
await a11y.testAppSnapshot();
await testSubjects.click('showReservedUsersSwitch');
});

it('a11y test for toggle button for show reserved users only', async () => {
await retry.waitFor(
'show reserved users toggle button is visible',
async () => await testSubjects.exists('showReservedUsersSwitch')
);
await testSubjects.click('showReservedUsersSwitch');
await a11y.testAppSnapshot();
await testSubjects.click('showReservedUsersSwitch');
});

it('a11y test for create user panel', async () => {
await testSubjects.click('createUserButton');
await a11y.testAppSnapshot();
});

// https://github.com/elastic/eui/issues/2841
it.skip('a11y test for roles drop down', async () => {
await testSubjects.setValue('userFormUserNameInput', 'a11y');
await testSubjects.setValue('passwordInput', 'password');
await testSubjects.setValue('passwordConfirmationInput', 'password');
await testSubjects.setValue('userFormFullNameInput', 'a11y user');
await testSubjects.setValue('userFormEmailInput', 'example@example.com');
await testSubjects.click('rolesDropdown');
await a11y.testAppSnapshot();
});

it('a11y test for display of delete button on users page ', async () => {
await testSubjects.setValue('userFormUserNameInput', 'deleteA11y');
await testSubjects.setValue('passwordInput', 'password');
await testSubjects.setValue('passwordConfirmationInput', 'password');
await testSubjects.setValue('userFormFullNameInput', 'DeleteA11y user');
await testSubjects.setValue('userFormEmailInput', 'example@example.com');
await testSubjects.click('rolesDropdown');
await testSubjects.setValue('rolesDropdown', 'roleOption-apm_user');
await testSubjects.click('userFormSaveButton');
await testSubjects.click('checkboxSelectRow-deleteA11y');
await a11y.testAppSnapshot();
});

it('a11y test for delete user panel ', async () => {
await testSubjects.click('deleteUserButton');
await a11y.testAppSnapshot();
});

it('a11y test for edit user panel', async () => {
await testSubjects.click('confirmModalCancelButton');
await PageObjects.settings.clickLinkText('deleteA11y');
await a11y.testAppSnapshot();
});

// https://github.com/elastic/eui/issues/2841
it.skip('a11y test for Change password screen', async () => {
await PageObjects.settings.clickLinkText('deleteA11y');
await testSubjects.click('changePassword');
await a11y.testAppSnapshot();
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/spaces'),
require.resolve('./apps/advanced_settings'),
require.resolve('./apps/dashboard_edit_panel'),
require.resolve('./apps/users'),
],

pageObjects,
Expand Down

0 comments on commit 14e58fb

Please sign in to comment.