test: 💍 re-enable Dashboard sample data functional tests (#54717) (#54732)

Closes: #40670
This commit is contained in:
Vadim Dalecky 2020-01-14 07:49:58 -08:00 committed by GitHub
parent 6cc6fc014c
commit 1e87504dc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View file

@ -19,8 +19,9 @@
import expect from '@kbn/expect';
import moment from 'moment';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function({ getService, getPageObjects }) {
export default function({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const find = getService('find');
const log = getService('log');
@ -76,9 +77,8 @@ export default function({ getService, getPageObjects }) {
expect(isInstalled).to.be(true);
});
// FLAKY: https://github.com/elastic/kibana/issues/40670
describe.skip('dashboard', () => {
afterEach(async () => {
describe('dashboard', () => {
beforeEach(async () => {
await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData');
await PageObjects.header.waitUntilLoadingHasFinished();
});
@ -99,7 +99,6 @@ export default function({ getService, getPageObjects }) {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
log.debug('Checking pie charts rendered');
await pieChart.expectPieSliceCount(4);
log.debug('Checking area, bar and heatmap charts rendered');
@ -142,6 +141,11 @@ export default function({ getService, getPageObjects }) {
// needs to be in describe block so it is run after 'dashboard describe block'
describe('uninstall', () => {
beforeEach(async () => {
await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData');
await PageObjects.header.waitUntilLoadingHasFinished();
});
it('should uninstall flights sample data set', async () => {
await PageObjects.home.removeSampleDataSet('flights');
const isInstalled = await PageObjects.home.isSampleDataSetInstalled('flights');

View file

@ -22,7 +22,6 @@ import { FtrProviderContext } from '../ftr_provider_context';
export function HomePageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const find = getService('find');
class HomePage {
async clickSynopsis(title: string) {
@ -38,12 +37,15 @@ export function HomePageProvider({ getService }: FtrProviderContext) {
}
async isSampleDataSetInstalled(id: string) {
return await testSubjects.exists(`removeSampleDataSet${id}`);
return !(await testSubjects.exists(`addSampleDataSet${id}`));
}
async addSampleDataSet(id: string) {
await testSubjects.click(`addSampleDataSet${id}`);
await this._waitForSampleDataLoadingAction(id);
const isInstalled = await this.isSampleDataSetInstalled(id);
if (!isInstalled) {
await testSubjects.click(`addSampleDataSet${id}`);
await this._waitForSampleDataLoadingAction(id);
}
}
async removeSampleDataSet(id: string) {
@ -62,13 +64,8 @@ export function HomePageProvider({ getService }: FtrProviderContext) {
}
async launchSampleDataSet(id: string) {
if (await find.existsByCssSelector(`#sampleDataLinks${id}`)) {
// omits cloud test failures
await find.clickByCssSelectorWhenNotDisabled(`#sampleDataLinks${id}`);
await find.clickByCssSelector('.euiContextMenuItem:nth-of-type(1)');
} else {
await testSubjects.click(`launchSampleDataSet${id}`);
}
await this.addSampleDataSet(id);
await testSubjects.click(`launchSampleDataSet${id}`);
}
async loadSavedObjects() {