-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Kibana Overview] First round of functional tests (#134680)
* [Kibana Overview] First round of functional tests * Update tests * Update snapshot * Update failing test * Fix failing test * Fix failing test * Fix failing test * Fix failing test Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
52fa9c3
commit 8ae497a
Showing
12 changed files
with
373 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 20 additions & 20 deletions
40
src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { WebElementWrapper } from '../../services/lib/web_element_wrapper'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const find = getService('find'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'header']); | ||
|
||
describe('overview page - Analytics apps', function describeIndexTests() { | ||
before(async () => { | ||
await esArchiver.load('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.load( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.unload( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
}); | ||
|
||
const apps = ['dashboard', 'discover', 'canvas', 'maps', 'ml']; | ||
|
||
it('should display Analytics apps cards', async () => { | ||
const kbnOverviewAppsCards = await find.allByCssSelector('.kbnOverviewApps__item'); | ||
expect(kbnOverviewAppsCards.length).to.be(apps.length); | ||
|
||
const verifyImageUrl = async (el: WebElementWrapper, imgName: string) => { | ||
const image = await el.findByCssSelector('img'); | ||
const imageUrl = await image.getAttribute('src'); | ||
expect(imageUrl.includes(imgName)).to.be(true); | ||
}; | ||
|
||
for (let i = 0; i < apps.length; i++) { | ||
verifyImageUrl(kbnOverviewAppsCards[i], `kibana_${apps[i]}_light.svg`); | ||
} | ||
}); | ||
|
||
it('click on a card should lead to the appropriate app', async () => { | ||
const kbnOverviewAppsCards = await find.allByCssSelector('.kbnOverviewApps__item'); | ||
const dashboardCard = kbnOverviewAppsCards.at(0); | ||
expect(dashboardCard).not.to.be(undefined); | ||
if (dashboardCard) { | ||
await dashboardCard.click(); | ||
await PageObjects.common.waitUntilUrlIncludes('app/dashboards'); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const find = getService('find'); | ||
const esArchiver = getService('esArchiver'); | ||
const retry = getService('retry'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'header']); | ||
|
||
const defaultSettings = { | ||
default_route: 'app/home', | ||
}; | ||
|
||
describe('overview page - footer', function describeIndexTests() { | ||
before(async () => { | ||
await esArchiver.load('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.load( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await kibanaServer.uiSettings.replace(defaultSettings); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.unload( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
await kibanaServer.uiSettings.replace(defaultSettings); | ||
}); | ||
|
||
it('clicking footer updates landing page', async () => { | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
let footerButton = await find.byCssSelector('.kbnOverviewPageFooter__button'); | ||
await footerButton.click(); | ||
|
||
await retry.try(async () => { | ||
footerButton = await find.byCssSelector('.kbnOverviewPageFooter__button'); | ||
const text = await ( | ||
await footerButton.findByCssSelector('.euiButtonEmpty__text') | ||
).getVisibleText(); | ||
expect(text.toString().includes('Display a different page on log in')).to.be(true); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const find = getService('find'); | ||
const testSubjects = getService('testSubjects'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'header']); | ||
|
||
describe('overview page - no data', function describeIndexTests() { | ||
before(async () => { | ||
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); | ||
kibanaServer.savedObjects.clean({ types: ['index-pattern'] }); | ||
await kibanaServer.importExport.unload( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
}); | ||
|
||
it('should display no data page', async () => { | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
const exists = await find.byClassName('kbnNoDataPageContents'); | ||
expect(exists).not.to.be(undefined); | ||
}); | ||
|
||
it('click on add data opens integrations', async () => { | ||
const addIntegrations = await testSubjects.find('kbnOverviewAddIntegrations'); | ||
await addIntegrations.click(); | ||
await PageObjects.common.waitUntilUrlIncludes('integrations/browse'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const find = getService('find'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'header', 'dashboard']); | ||
|
||
describe('overview page - page header', function describeIndexTests() { | ||
before(async () => { | ||
await esArchiver.load('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.load( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await kibanaServer.importExport.unload( | ||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' | ||
); | ||
}); | ||
|
||
it('click on integrations leads to integrations', async () => { | ||
const headerItems = await find.byCssSelector('.euiPageHeaderContent__rightSideItems'); | ||
const items = await headerItems.findAllByCssSelector('.kbnRedirectCrossAppLinks'); | ||
expect(items!.length).to.be(3); | ||
|
||
const integrations = await items!.at(0); | ||
await integrations!.click(); | ||
await PageObjects.common.waitUntilUrlIncludes('app/integrations/browse'); | ||
}); | ||
|
||
it('click on management leads to management', async () => { | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
const headerItems = await find.byCssSelector('.euiPageHeaderContent__rightSideItems'); | ||
const items = await headerItems.findAllByCssSelector('.kbnRedirectCrossAppLinks'); | ||
|
||
const management = await items!.at(1); | ||
await management!.click(); | ||
await PageObjects.common.waitUntilUrlIncludes('app/management'); | ||
}); | ||
|
||
it('click on dev tools leads to dev tools', async () => { | ||
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true }); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
const headerItems = await find.byCssSelector('.euiPageHeaderContent__rightSideItems'); | ||
const items = await headerItems.findAllByCssSelector('.kbnRedirectCrossAppLinks'); | ||
|
||
const devTools = await items!.at(2); | ||
await devTools!.click(); | ||
await PageObjects.common.waitUntilUrlIncludes('app/dev_tools'); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.