|
| 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 | +} |
0 commit comments