Skip to content

Commit

Permalink
A11y base tests (#51893)
Browse files Browse the repository at this point in the history
a11y base tests
  • Loading branch information
bhavyarm committed Dec 12, 2019
1 parent 7e822c5 commit 4765ed0
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ function EditorUI() {
<button
onClick={sendCurrentRequestToES}
data-test-subj="sendRequestButton"
aria-label={i18n.translate('console.sendRequestButtonTooltip', {
defaultMessage: 'click to send request',
})}
className="conApp__editorActionButton conApp__editorActionButton--success"
>
<EuiIcon type="play" />
Expand Down
40 changes: 40 additions & 0 deletions test/accessibility/apps/console.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

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

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

describe('Dev tools console', () => {
before(async () => {
await PageObjects.common.navigateToApp('console');
});

it('Dev tools console view', async () => {
await a11y.testAppSnapshot();
});

it('Dev tools settings page', async () => {
await PageObjects.console.setFontSizeSetting(20);
await a11y.testAppSnapshot();
});
});
}
57 changes: 57 additions & 0 deletions test/accessibility/apps/dashboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

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

export default function({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'dashboard', 'header']);
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');

describe('Dashboard', () => {
const dashboardName = 'Dashboard Listing A11y';
before(async () => {
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.update({
defaultIndex: 'logstash-*',
});
await PageObjects.common.navigateToApp('dashboard');
});

it('dashboard', async () => {
await a11y.testAppSnapshot();
});

it('create dashboard button', async () => {
await PageObjects.dashboard.clickCreateDashboardPrompt();
await a11y.testAppSnapshot();
});

it('save empty dashboard', async () => {
await PageObjects.dashboard.saveDashboard(dashboardName);
await a11y.testAppSnapshot();
});

it('Dashboard listing table', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
await a11y.testAppSnapshot();
});
});
}
12 changes: 11 additions & 1 deletion test/accessibility/apps/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { FtrProviderContext } from '../ftr_provider_context';

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

describe('Kibana Home', () => {
Expand All @@ -31,5 +31,15 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
it('Kibana Home view', async () => {
await a11y.testAppSnapshot();
});

it('Add Kibana sample data page', async () => {
await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData');
await a11y.testAppSnapshot();
});

it('Add flights sample data set', async () => {
await PageObjects.home.addSampleDataSet('flights');
await a11y.testAppSnapshot();
});
});
}
8 changes: 8 additions & 0 deletions test/accessibility/apps/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { FtrProviderContext } from '../ftr_provider_context';

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

const testSubjects = getService('testSubjects');
const a11y = getService('a11y');

describe('Management', () => {
Expand All @@ -42,6 +44,12 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});

it('Create Index pattern wizard', async () => {
await PageObjects.settings.clickKibanaIndexPatterns();
await (await testSubjects.find('createIndexPatternButton')).click();
await a11y.testAppSnapshot();
});

it('Saved objects view', async () => {
await PageObjects.settings.clickKibanaSavedObjects();
await a11y.testAppSnapshot();
Expand Down
45 changes: 45 additions & 0 deletions test/accessibility/apps/visualize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

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

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

describe('Visualize', () => {
before(async () => {
await PageObjects.common.navigateToApp('visualize');
});

it('visualize', async () => {
await a11y.testAppSnapshot();
});

it('click on create visualize wizard', async () => {
await PageObjects.visualize.navigateToNewVisualization();
await a11y.testAppSnapshot();
});

it.skip('create visualize button', async () => {
await PageObjects.visualize.clickNewVisualization();
await a11y.testAppSnapshot();
});
});
}
3 changes: 3 additions & 0 deletions test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {

testFiles: [
require.resolve('./apps/discover'),
require.resolve('./apps/dashboard'),
require.resolve('./apps/visualize'),
require.resolve('./apps/management'),
// require.resolve('./apps/console'),
require.resolve('./apps/home'),
],
pageObjects,
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {

return {
...functionalConfig.getAll(),

testFiles: [require.resolve('./apps/login_page')],

pageObjects,
services,

Expand Down

0 comments on commit 4765ed0

Please sign in to comment.