Skip to content

Commit 8e963fd

Browse files
authored
A11y tests for filter panel (#78776)
a11y tests for filter panel and some test data un mounting
1 parent ae8f8e1 commit 8e963fd

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-1
lines changed

src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ class FilterEditorUI extends Component<Props, State> {
106106
</EuiFlexItem>
107107
<EuiFlexItem grow={false} className="filterEditor__hiddenItem" />
108108
<EuiFlexItem grow={false}>
109-
<EuiButtonEmpty size="xs" onClick={this.toggleCustomEditor}>
109+
<EuiButtonEmpty
110+
size="xs"
111+
data-test-subj="editQueryDSL"
112+
onClick={this.toggleCustomEditor}
113+
>
110114
{this.state.isCustomEditorOpen ? (
111115
<FormattedMessage
112116
id="data.filter.filterEditor.editFilterValuesButtonLabel"
@@ -133,6 +137,7 @@ class FilterEditorUI extends Component<Props, State> {
133137

134138
<EuiSwitch
135139
id="filterEditorCustomLabelSwitch"
140+
data-test-subj="createCustomLabel"
136141
label={this.props.intl.formatMessage({
137142
id: 'data.filter.filterEditor.createCustomLabelSwitchLabel',
138143
defaultMessage: 'Create custom label?',

test/accessibility/apps/discover.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
3939
await PageObjects.timePicker.setDefaultAbsoluteRange();
4040
});
4141

42+
after(async () => {
43+
await esArchiver.unload('logstash_functional');
44+
});
45+
4246
it('Discover main page', async () => {
4347
await a11y.testAppSnapshot();
4448
});
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { FtrProviderContext } from '../ftr_provider_context';
21+
22+
export default function ({ getService, getPageObjects }: FtrProviderContext) {
23+
const PageObjects = getPageObjects(['common', 'discover', 'home']);
24+
const a11y = getService('a11y');
25+
const filterBar = getService('filterBar');
26+
const testSubjects = getService('testSubjects');
27+
const browser = getService('browser');
28+
29+
describe('Filter panel', () => {
30+
before(async () => {
31+
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
32+
useActualUrl: true,
33+
});
34+
await PageObjects.home.addSampleDataSet('flights');
35+
await PageObjects.common.navigateToApp('discover');
36+
await PageObjects.discover.selectIndexPattern('kibana_sample_data_flights');
37+
});
38+
39+
it('a11y test on add filter panel', async () => {
40+
await PageObjects.discover.openAddFilterPanel();
41+
await a11y.testAppSnapshot();
42+
await filterBar.addFilter('OriginCityName', 'is', 'Rome');
43+
});
44+
45+
it('a11y test on filter panel with custom label', async () => {
46+
await filterBar.clickEditFilter('OriginCityName', 'Rome');
47+
await testSubjects.click('createCustomLabel');
48+
await a11y.testAppSnapshot();
49+
});
50+
51+
it('a11y test on Edit filter as Query DSL panel', async () => {
52+
await testSubjects.click('editQueryDSL');
53+
await a11y.testAppSnapshot();
54+
await browser.pressKeys(browser.keys.ESCAPE);
55+
});
56+
57+
// the following tests filter panel options which changes UI
58+
it('a11y test on filter panel options panel', async () => {
59+
await filterBar.addFilter('DestCountry', 'is', 'AU');
60+
await testSubjects.click('showFilterActions');
61+
await a11y.testAppSnapshot();
62+
});
63+
64+
it('a11y test on disable all filter options view', async () => {
65+
await testSubjects.click('disableAllFilters');
66+
await a11y.testAppSnapshot();
67+
});
68+
69+
it('a11y test on pin filters view', async () => {
70+
await testSubjects.click('showFilterActions');
71+
await testSubjects.click('enableAllFilters');
72+
await testSubjects.click('showFilterActions');
73+
await testSubjects.click('pinAllFilters');
74+
await a11y.testAppSnapshot();
75+
});
76+
77+
it('a11y test on unpin all filters view', async () => {
78+
await testSubjects.click('showFilterActions');
79+
await testSubjects.click('unpinAllFilters');
80+
await a11y.testAppSnapshot();
81+
});
82+
83+
it('a11y test on invert inclusion of all filters view', async () => {
84+
await testSubjects.click('showFilterActions');
85+
await testSubjects.click('invertInclusionAllFilters');
86+
await a11y.testAppSnapshot();
87+
});
88+
89+
it('a11y test on remove all filtes view', async () => {
90+
await testSubjects.click('showFilterActions');
91+
await testSubjects.click('removeAllFilters');
92+
await a11y.testAppSnapshot();
93+
});
94+
});
95+
}

test/accessibility/apps/management.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
3535
await PageObjects.settings.navigateTo();
3636
});
3737

38+
after(async () => {
39+
await esArchiver.unload('logstash_functional');
40+
});
41+
3842
it('main view', async () => {
3943
await a11y.testAppSnapshot();
4044
});

test/accessibility/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
3535
require.resolve('./apps/management'),
3636
require.resolve('./apps/console'),
3737
require.resolve('./apps/home'),
38+
require.resolve('./apps/filter_panel'),
3839
],
3940
pageObjects,
4041
services,

0 commit comments

Comments
 (0)