Skip to content

Commit

Permalink
accessibility test for Painless lab (#75688) (#76335)
Browse files Browse the repository at this point in the history
* accessibility test for painless lab

* skipped a test due to aria-violation

* skipped tests due to aria-violation and added datatestsubj

* removed the unwanted import

* incorporate review comments

* feedback incorporated

* review comments incorporated

* removed unwanted expect
  • Loading branch information
rashmivkulkarni authored Aug 31, 2020
1 parent d52cd53 commit a30b2f7
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const OutputPane: FunctionComponent<Props> = ({ isLoading, response }) =>
<EuiPanel className="painlessLabRightPane">
<EuiTabbedContent
className="painlessLabRightPane__tabs"
data-test-subj="painlessTabs"
size="s"
tabs={[
{
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/painless_lab/public/application/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const painlessContextOptions = [
{
value: 'painless_test',
inputDisplay: defaultLabel,
'data-test-subj': 'basicButtonDropdown',
dropdownDisplay: (
<>
<strong>{defaultLabel}</strong>
Expand All @@ -41,6 +42,7 @@ export const painlessContextOptions = [
{
value: 'filter',
inputDisplay: filterLabel,
'data-test-subj': 'filterButtonDropdown',
dropdownDisplay: (
<>
<strong>{filterLabel}</strong>
Expand All @@ -57,6 +59,7 @@ export const painlessContextOptions = [
{
value: 'score',
inputDisplay: scoreLabel,
'data-test-subj': 'scoreButtonDropdown',
dropdownDisplay: (
<>
<strong>{scoreLabel}</strong>
Expand Down
65 changes: 65 additions & 0 deletions x-pack/test/accessibility/apps/painless_lab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.
*/

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

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

describe('Accessibility Painless Lab Editor', () => {
before(async () => {
await PageObjects.common.navigateToApp('painlessLab');
});

it('renders the page without a11y errors', async () => {
await PageObjects.common.navigateToApp('painlessLab');
await a11y.testAppSnapshot();
});

it('click on the output button', async () => {
const painlessTabsOutput = await find.byCssSelector(
'[data-test-subj="painlessTabs"] #output'
);
await painlessTabsOutput.click();
await a11y.testAppSnapshot();
});

it('click on the parameters button', async () => {
const painlessTabsParameters = await find.byCssSelector(
'[data-test-subj="painlessTabs"] #parameters'
);
await painlessTabsParameters.click();
await a11y.testAppSnapshot();
});

// github.com/elastic/kibana/issues/75876
it.skip('click on the context button', async () => {
const painlessTabsContext = await find.byCssSelector(
'[data-test-subj="painlessTabs"] #context'
);
await painlessTabsContext.click();
await a11y.testAppSnapshot();
});

it.skip('click on the Basic button', async () => {
await testSubjects.click('basicButtonDropdown');
await a11y.testAppSnapshot();
});

it.skip('click on the Filter button', async () => {
await testSubjects.click('filterButtonDropdown');
await a11y.testAppSnapshot();
});

it.skip('click on the Score button', async () => {
await testSubjects.click('scoreButtonDropdown');
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 @@ -20,6 +20,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/grok_debugger'),
require.resolve('./apps/search_profiler'),
require.resolve('./apps/uptime'),
require.resolve('./apps/painless_lab'),
],
pageObjects,
services,
Expand Down
4 changes: 4 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export default async function ({ readConfigFile }) {
pathname: '/app/dev_tools',
hash: '/searchprofiler',
},
painlessLab: {
pathname: '/app/dev_tools',
hash: '/painless_lab',
},
spaceSelector: {
pathname: '/',
},
Expand Down

0 comments on commit a30b2f7

Please sign in to comment.