Skip to content

Commit

Permalink
fix deleteAllVisualizations() (#41062)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Drengenberg authored Jul 16, 2019
1 parent ea2cb5d commit 236bc83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion test/functional/apps/visualize/_visualize_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function ({ getPageObjects }) {
it('create new viz', async function () {
// type markdown is used for simplicity
await PageObjects.visualize.createSimpleMarkdownViz(vizName);

await PageObjects.visualize.gotoVisualizationLandingPage();
const visCount = await PageObjects.visualize.getCountOfItemsInListingTable();
expect(visCount).to.equal(1);
Expand Down
4 changes: 3 additions & 1 deletion test/functional/page_objects/common_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
*/
async ensureModalOverlayHidden() {
return retry.try(async () => {
const shown = await testSubjects.exists('modalOverlay');
const shown = await testSubjects.exists('confirmModalTitleText');
if (shown) {
throw new Error('Modal overlay is showing');
}
Expand All @@ -294,6 +294,8 @@ export function CommonPageProvider({ getService, getPageObjects }) {

async clickConfirmOnModal() {
log.debug('Clicking modal confirm');
// make sure this data-test-subj 'confirmModalTitleText' exists because we're going to wait for it to be gone later
await testSubjects.exists('confirmModalTitleText');
await testSubjects.click('confirmModalConfirmButton');
await this.ensureModalOverlayHidden();
}
Expand Down
13 changes: 10 additions & 3 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,17 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
return await this.createVisualizationPromptButton();
}

/*
This method should use retry loop to delete visualizations from multiple pages until we find the createVisualizationPromptButton.
Perhaps it *could* set the page size larger than the default 10, but it might still need to loop anyway.
*/
async deleteAllVisualizations() {
await this.checkListingSelectAllCheckbox();
await this.clickDeleteSelected();
await PageObjects.common.clickConfirmOnModal();
await retry.try(async () => {
await this.checkListingSelectAllCheckbox();
await this.clickDeleteSelected();
await PageObjects.common.clickConfirmOnModal();
await testSubjects.find('createVisualizationPromptButton');
});
}

async createSimpleMarkdownViz(vizName) {
Expand Down

0 comments on commit 236bc83

Please sign in to comment.