diff --git a/test/accessibility/apps/dashboard.ts b/test/accessibility/apps/dashboard.ts index 5f44d7b8c2573..408e7d402a8f0 100644 --- a/test/accessibility/apps/dashboard.ts +++ b/test/accessibility/apps/dashboard.ts @@ -20,21 +20,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardName = 'Dashboard Listing A11y'; const clonedDashboardName = 'Dashboard Listing A11y Copy'; - before(async () => { - await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { - useActualUrl: true, - }); - await PageObjects.home.addSampleDataSet('flights'); - }); - - after(async () => { - await PageObjects.common.navigateToApp('dashboard'); - await listingTable.searchForItemWithName(dashboardName); - await listingTable.checkListingSelectAllCheckbox(); - await listingTable.clickDeleteSelected(); - await PageObjects.common.clickConfirmOnModal(); - }); - it('dashboard', async () => { await PageObjects.common.navigateToApp('dashboard'); await a11y.testAppSnapshot(); diff --git a/test/accessibility/apps/dashboard_panel.ts b/test/accessibility/apps/dashboard_panel.ts index 41c79be39a025..b2fc073949d73 100644 --- a/test/accessibility/apps/dashboard_panel.ts +++ b/test/accessibility/apps/dashboard_panel.ts @@ -17,11 +17,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // FLAKY: https://github.com/elastic/kibana/issues/112920 describe.skip('Dashboard Panel', () => { before(async () => { - await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { - useActualUrl: true, - }); - - await PageObjects.home.addSampleDataSet('flights'); await PageObjects.common.navigateToApp('dashboard'); await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard'); }); diff --git a/test/accessibility/apps/discover.ts b/test/accessibility/apps/discover.ts index c7794c5023bae..e05f3e2bc091d 100644 --- a/test/accessibility/apps/discover.ts +++ b/test/accessibility/apps/discover.ts @@ -11,27 +11,14 @@ import { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'discover', 'header', 'share', 'timePicker']); const a11y = getService('a11y'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); const inspector = getService('inspector'); const testSubjects = getService('testSubjects'); - const TEST_COLUMN_NAMES = ['extension', 'geo.src']; + const TEST_COLUMN_NAMES = ['dayOfWeek', 'DestWeather']; describe('Discover a11y tests', () => { before(async () => { - await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); - await kibanaServer.uiSettings.update({ - defaultIndex: 'logstash-*', - 'doc_table:legacy': true, - }); await PageObjects.common.navigateToApp('discover'); - await PageObjects.timePicker.setDefaultAbsoluteRange(); - }); - - after(async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); - await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); + await PageObjects.timePicker.setCommonlyUsedTime('Last_7 days'); }); it('Discover main page', async () => { diff --git a/test/accessibility/apps/filter_panel.ts b/test/accessibility/apps/filter_panel.ts index 0253176b14d24..78e776ce3a482 100644 --- a/test/accessibility/apps/filter_panel.ts +++ b/test/accessibility/apps/filter_panel.ts @@ -17,10 +17,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Filter panel', () => { before(async () => { - await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { - useActualUrl: true, - }); - await PageObjects.home.addSampleDataSet('flights'); await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.selectIndexPattern('kibana_sample_data_flights'); }); diff --git a/test/accessibility/apps/home.ts b/test/accessibility/apps/home.ts index f281051fc9d37..8737dee019ca6 100644 --- a/test/accessibility/apps/home.ts +++ b/test/accessibility/apps/home.ts @@ -27,10 +27,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); await a11y.testAppSnapshot(); }); - - it('Add flights sample data set', async () => { - await PageObjects.home.addSampleDataSet('flights'); - await a11y.testAppSnapshot(); - }); }); } diff --git a/test/accessibility/apps/index.ts b/test/accessibility/apps/index.ts new file mode 100644 index 0000000000000..c47689175405e --- /dev/null +++ b/test/accessibility/apps/index.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; + +export default function ({ getService, loadTestFile, getPageObjects }: FtrProviderContext) { + const kibanaServer = getService('kibanaServer'); + const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home', 'settings']); + + describe('a11y tests', function () { + describe('using flights sample data', function () { + before(async () => { + await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { + useActualUrl: true, + }); + await PageObjects.home.addSampleDataSet('flights'); + }); + + after(async () => { + await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { + useActualUrl: true, + }); + await PageObjects.home.removeSampleDataSet('flights'); + await kibanaServer.savedObjects.clean({ + types: ['search', 'index-pattern', 'visualization', 'dashboard'], + }); + }); + + loadTestFile(require.resolve('./dashboard')); + loadTestFile(require.resolve('./dashboard_panel')); + loadTestFile(require.resolve('./filter_panel')); + loadTestFile(require.resolve('./home')); + loadTestFile(require.resolve('./discover')); + loadTestFile(require.resolve('./visualize')); + loadTestFile(require.resolve('./kibana_overview_with_data')); + }); + + describe('not using sample data', function () { + loadTestFile(require.resolve('./management')); + loadTestFile(require.resolve('./console')); + loadTestFile(require.resolve('./kibana_overview_without_data')); + }); + }); +} diff --git a/test/accessibility/apps/kibana_overview_with_data.ts b/test/accessibility/apps/kibana_overview_with_data.ts new file mode 100644 index 0000000000000..d37f58550670a --- /dev/null +++ b/test/accessibility/apps/kibana_overview_with_data.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['common', 'home']); + const a11y = getService('a11y'); + + describe('Kibana overview with data', () => { + it('Overview view', async () => { + await PageObjects.common.navigateToApp('kibanaOverview'); + await a11y.testAppSnapshot(); + }); + }); +} diff --git a/test/accessibility/apps/kibana_overview.ts b/test/accessibility/apps/kibana_overview_without_data.ts similarity index 53% rename from test/accessibility/apps/kibana_overview.ts rename to test/accessibility/apps/kibana_overview_without_data.ts index 8481e2bf334aa..6a965354d1b35 100644 --- a/test/accessibility/apps/kibana_overview.ts +++ b/test/accessibility/apps/kibana_overview_without_data.ts @@ -13,29 +13,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const a11y = getService('a11y'); describe('Kibana overview', () => { - const esArchiver = getService('esArchiver'); - - before(async () => { - await esArchiver.emptyKibanaIndex(); - await PageObjects.common.navigateToApp('kibanaOverview'); - }); - - after(async () => { - await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { - useActualUrl: true, - }); - await PageObjects.home.removeSampleDataSet('flights'); - }); - - it('Getting started view', async () => { - await a11y.testAppSnapshot(); - }); - it('Overview view', async () => { - await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { - useActualUrl: true, - }); - await PageObjects.home.addSampleDataSet('flights'); await PageObjects.common.navigateToApp('kibanaOverview'); await a11y.testAppSnapshot(); }); diff --git a/test/accessibility/apps/visualize.ts b/test/accessibility/apps/visualize.ts index d0592352170fb..c1dbedb59da1e 100644 --- a/test/accessibility/apps/visualize.ts +++ b/test/accessibility/apps/visualize.ts @@ -11,18 +11,8 @@ import { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'visualize', 'header']); const a11y = getService('a11y'); - const kibanaServer = getService('kibanaServer'); describe('Visualize', () => { - before(async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); - await PageObjects.common.navigateToApp('visualize'); - }); - - after(async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); - }); - it('visualize', async () => { await a11y.testAppSnapshot(); }); diff --git a/test/accessibility/config.ts b/test/accessibility/config.ts index 81c89a253165d..59194fcb67826 100644 --- a/test/accessibility/config.ts +++ b/test/accessibility/config.ts @@ -15,22 +15,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), - - testFiles: [ - // these 5 tests all load addSampleDataSet('flights') - // only the last test does removeSampleDataSet('flights') - require.resolve('./apps/dashboard'), - require.resolve('./apps/dashboard_panel'), - require.resolve('./apps/filter_panel'), - require.resolve('./apps/home'), - require.resolve('./apps/kibana_overview'), - - // next tests don't use sample data - require.resolve('./apps/discover'), - require.resolve('./apps/visualize'), - require.resolve('./apps/management'), - require.resolve('./apps/console'), - ], + testFiles: [require.resolve('./apps')], pageObjects, services,