Skip to content

Commit

Permalink
SO Tagging: fix flaky test and re-enable it (#82930) (#83653)
Browse files Browse the repository at this point in the history
* fix flaky test and re-enable it

* wait for table to load before to perform operations

* move everything out of ciGroup2 for flaky test runner

* add debug block for flaky runner

* use correct vis name

* remove test sync

* Revert "move everything out of ciGroup2 for flaky test runner"

This reverts commit db86c3b
  • Loading branch information
pgayvallet authored Nov 18, 2020
1 parent 3e6f716 commit 5d0917f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
14 changes: 14 additions & 0 deletions test/functional/services/listing_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ export function ListingTableProvider({ getService, getPageObjects }: FtrProvider
return visualizationNames;
}

public async waitUntilTableIsLoaded() {
return retry.try(async () => {
const isLoaded = await find.existsByDisplayedByCssSelector(
'[data-test-subj="itemsInMemTable"]:not(.euiBasicTable-loading)'
);

if (isLoaded) {
return true;
} else {
throw new Error('Waiting');
}
});
}

/**
* Navigates through all pages on Landing page and returns array of items names
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
const find = getService('find');
const PageObjects = getPageObjects(['dashboard', 'tagManagement', 'common']);
const PageObjects = getPageObjects(['dashboard', 'tagManagement', 'common', 'header']);

/**
* Select tags in the searchbar's tag filter.
Expand All @@ -31,6 +31,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// click elsewhere to close the filter dropdown
const searchFilter = await find.byCssSelector('main .euiFieldSearch');
await searchFilter.click();
// wait until the table refreshes
await listingTable.waitUntilTableIsLoaded();
};

describe('dashboard integration', () => {
Expand All @@ -47,6 +49,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
beforeEach(async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();
});

it('allows to manually type tag filter query', async () => {
Expand Down Expand Up @@ -96,6 +99,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-1');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('my-new-dashboard');
Expand Down Expand Up @@ -128,8 +133,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await tagModal.isOpened()).to.be(false);

await PageObjects.dashboard.clickSave();
await PageObjects.common.waitForSaveModalToClose();

await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('my-new-tag');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('dashboard-with-new-tag');
Expand All @@ -140,6 +148,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
beforeEach(async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();
});

it('allows to select tags for an existing dashboard', async () => {
Expand All @@ -152,6 +161,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-3');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('dashboard 4 with real data (tag-1)');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
const find = getService('find');
const PageObjects = getPageObjects(['visualize', 'tagManagement', 'visEditor']);
const PageObjects = getPageObjects(['visualize', 'tagManagement', 'visEditor', 'common']);

/**
* Select tags in the searchbar's tag filter.
Expand All @@ -31,6 +31,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// click elsewhere to close the filter dropdown
const searchFilter = await find.byCssSelector('main .euiFieldSearch');
await searchFilter.click();
// wait until the table refreshes
await listingTable.waitUntilTableIsLoaded();
};

const selectSavedObjectTags = async (...tagNames: string[]) => {
Expand All @@ -56,6 +58,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('listing', () => {
beforeEach(async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.waitUntilTableIsLoaded();
});

it('allows to manually type tag filter query', async () => {
Expand Down Expand Up @@ -83,7 +86,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

describe('creating', () => {
it.skip('allows to assign tags to the new visualization', async () => {
it('allows to assign tags to the new visualization', async () => {
await PageObjects.visualize.navigateToNewVisualization();

await PageObjects.visualize.clickMarkdownWidget();
Expand All @@ -95,7 +98,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await selectSavedObjectTags('tag-1');

await testSubjects.click('confirmSaveSavedObjectButton');
await PageObjects.common.waitForSaveModalToClose();

await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-1');
const itemNames = await listingTable.getAllItemsNames();
Expand Down Expand Up @@ -133,7 +139,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await tagModal.isOpened()).to.be(false);

await testSubjects.click('confirmSaveSavedObjectButton');
await PageObjects.common.waitForSaveModalToClose();

await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('my-new-tag');
const itemNames = await listingTable.getAllItemsNames();
Expand All @@ -144,6 +153,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('editing', () => {
beforeEach(async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.waitUntilTableIsLoaded();
});

it('allows to assign tags to an existing visualization', async () => {
Expand All @@ -153,7 +163,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await selectSavedObjectTags('tag-2');

await testSubjects.click('confirmSaveSavedObjectButton');
await PageObjects.common.waitForSaveModalToClose();

await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-2');
const itemNames = await listingTable.getAllItemsNames();
Expand Down

0 comments on commit 5d0917f

Please sign in to comment.