Skip to content

Commit

Permalink
[Flaky test fix] Turn back on data_shared_attributes test (#25156) (#…
Browse files Browse the repository at this point in the history
…25554)

* Turn back on data_shared_attributes test and run 20x

* Add some clean up

* Be more determinism, less refactoring.

* Go back to a single test run
  • Loading branch information
stacey-gammon authored Nov 13, 2018
1 parent f3e9e8a commit 4d4c159
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports[`DashboardPanel matches snapshot 1`] = `
>
<div
class="euiPopover euiPopover--anchorDownRight euiPopover--withTitle dshPanel_optionsMenuPopover"
data-test-subj="dashboardPanelContextMenuClosed"
id="dashboardPanelContextMenu"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export function PanelOptionsMenu({
closePopover={closeContextMenu}
panelPaddingSize="none"
anchorPosition="downRight"
data-test-subj={
isPopoverOpen ? 'dashboardPanelContextMenuOpen' : 'dashboardPanelContextMenuClosed'
}
withTitle
>
<EuiContextMenu initialPanelId="mainMenu" panels={panels} />
Expand Down
3 changes: 3 additions & 0 deletions test/functional/apps/dashboard/_dashboard_filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.waitForRenderComplete();
await dashboardExpect.pieSliceCount(5);

await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();
await queryBar.setQuery('weightLbs:>50');
await queryBar.submitQuery();
Expand All @@ -259,6 +260,7 @@ export default function ({ getService, getPageObjects }) {
});

it('Nested visualization filter pills filters data as expected', async () => {
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
Expand All @@ -273,6 +275,7 @@ export default function ({ getService, getPageObjects }) {
});

it('Removing filter pills and query unfiters data as expected', async () => {
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/dashboard/_dashboard_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
await PageObjects.common.closeToast();

await PageObjects.dashboard.clickFullScreenMode();
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();

await PageObjects.dashboard.waitForRenderComplete();
const percentSimilar = await screenshot.compareAgainstBaseline('tsvb_dashboard', updateBaselines);
Expand All @@ -70,7 +71,8 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
await PageObjects.common.closeToast();

await PageObjects.dashboard.clickFullScreenMode();
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();

await PageObjects.dashboard.waitForRenderComplete();
const percentSimilar = await screenshot.compareAgainstBaseline('area_chart', updateBaselines);
Expand Down
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/_dashboard_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.closeInspector();

await PageObjects.dashboard.switchToEditMode();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();

await PageObjects.visualize.clickMapZoomIn();
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/dashboard/_data_shared_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ export default function ({ getService, getPageObjects }) {
});
});

// TODO: flaky https://github.com/elastic/kibana/issues/24287
it.skip('data-shared-item title should update a saved search when using a custom panel title', async () => {
it('data-shared-item title should update a saved search when using a custom panel title', async () => {
const CUSTOM_SEARCH_TITLE = 'ima custom title for a search!';
await dashboardPanelActions.setCustomPanelTitle(CUSTOM_SEARCH_TITLE, 'Rendering Test: saved search');
await retry.try(async () => {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/dashboard/_full_screen_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export default function ({ getService, getPageObjects }) {
});

it('displays exit full screen logo button when panel is expanded', async () => {
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();

const exists = await PageObjects.dashboard.exitFullScreenTextButtonExists();
expect(exists).to.be(true);
Expand Down
46 changes: 15 additions & 31 deletions test/functional/apps/dashboard/_panel_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.saveDashboard(dashboardName);

await dashboardPanelActions.openContextMenu();
const editLinkExists = await dashboardPanelActions.editPanelActionExists();
const removeExists = await dashboardPanelActions.removePanelActionExists();

expect(editLinkExists).to.equal(false);
expect(removeExists).to.equal(false);
await dashboardPanelActions.expectMissingEditPanelAction();
await dashboardPanelActions.expectMissingRemovePanelAction();
});

it('are shown in edit mode', async function () {
Expand All @@ -75,11 +72,8 @@ export default function ({ getService, getPageObjects }) {
expect(isContextMenuIconVisible).to.equal(true);
await dashboardPanelActions.openContextMenu();

const editLinkExists = await dashboardPanelActions.editPanelActionExists();
const removeExists = await dashboardPanelActions.removePanelActionExists();

expect(editLinkExists).to.equal(true);
expect(removeExists).to.equal(true);
await dashboardPanelActions.expectExistsEditPanelAction();
await dashboardPanelActions.expectExistsRemovePanelAction();
});

// Based off an actual bug encountered in a PR where a hard refresh in edit mode did not show the edit mode
Expand All @@ -91,11 +85,8 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.waitUntilLoadingHasFinished();

await dashboardPanelActions.openContextMenu();
const editLinkExists = await dashboardPanelActions.editPanelActionExists();
expect(editLinkExists).to.equal(true);

const removeExists = await dashboardPanelActions.removePanelActionExists();
expect(removeExists).to.equal(true);
await dashboardPanelActions.expectExistsEditPanelAction();
await dashboardPanelActions.expectExistsRemovePanelAction();

// Get rid of the timestamp in the url.
await remote.get(currentUrl.toString(), false);
Expand All @@ -104,26 +95,19 @@ export default function ({ getService, getPageObjects }) {
describe('on an expanded panel', function () {
it('are hidden in view mode', async function () {
await PageObjects.dashboard.saveDashboard(dashboardName);
await dashboardPanelActions.toggleExpandPanel();

await dashboardPanelActions.openContextMenu();
const editLinkExists = await dashboardPanelActions.editPanelActionExists();
const removeExists = await dashboardPanelActions.removePanelActionExists();

expect(editLinkExists).to.equal(false);
expect(removeExists).to.equal(false);
await dashboardPanelActions.clickExpandPanelToggle();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.expectMissingEditPanelAction();
await dashboardPanelActions.expectMissingRemovePanelAction();
});

it('in edit mode hides remove icons ', async function () {
await PageObjects.dashboard.switchToEditMode();
await dashboardPanelActions.openContextMenu();
const editLinkExists = await dashboardPanelActions.editPanelActionExists();
const removeExists = await dashboardPanelActions.removePanelActionExists();

expect(editLinkExists).to.equal(true);
expect(removeExists).to.equal(false);

await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.expectExistsEditPanelAction();
await dashboardPanelActions.expectMissingRemovePanelAction();
await dashboardPanelActions.clickExpandPanelToggle();
});
});

Expand Down Expand Up @@ -160,6 +144,7 @@ export default function ({ getService, getPageObjects }) {
});

it('opens a saved search when edit link is clicked', async () => {
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();
await PageObjects.header.waitUntilLoadingHasFinished();
const queryName = await PageObjects.discover.getCurrentQueryName();
Expand All @@ -182,8 +167,7 @@ export default function ({ getService, getPageObjects }) {
it('shown in edit mode', async function () {
await PageObjects.dashboard.gotoDashboardEditMode(dashboardName);
await dashboardPanelActions.openContextMenu();
const expandExists = await dashboardPanelActions.toggleExpandActionExists();
expect(expandExists).to.equal(true);
await dashboardPanelActions.expectExistsToggleExpandAction();
});
});
});
Expand Down
9 changes: 6 additions & 3 deletions test/functional/apps/dashboard/_panel_expand_toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default function ({ getService, getPageObjects }) {
});

it('hides other panels', async () => {
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();
await retry.try(async () => {
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.eql(1);
Expand All @@ -40,8 +41,10 @@ export default function ({ getService, getPageObjects }) {
it('shows other panels after being minimized', async () => {
const panelCount = await PageObjects.dashboard.getPanelCount();
// Panels are all minimized on a fresh open of a dashboard, so we need to re-expand in order to then minimize.
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.toggleExpandPanel();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickExpandPanelToggle();


// Add a retry to fix https://github.com/elastic/kibana/issues/14574. Perhaps the recent changes to this
Expand Down
27 changes: 11 additions & 16 deletions test/functional/page_objects/dashboard_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,25 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
*/
async onDashboardLandingPage() {
log.debug(`onDashboardLandingPage`);
const exists = await testSubjects.exists('dashboardLandingPage');
return exists;
return await testSubjects.exists('dashboardLandingPage', 5000);
}

async expectExistsDashboardLandingPage() {
log.debug(`expectExistsDashboardLandingPage`);
await testSubjects.existOrFail('dashboardLandingPage');
}

async clickDashboardBreadcrumbLink() {
log.debug('clickDashboardBreadcrumbLink');
await find.clickByCssSelector(`a[href="#${DashboardConstants.LANDING_PAGE_PATH}"]`);
await this.expectExistsDashboardLandingPage();
}

async gotoDashboardLandingPage() {
log.debug('gotoDashboardLandingPage');
const onPage = await this.onDashboardLandingPage();
if (!onPage) {
await retry.try(async () => {
await this.clickDashboardBreadcrumbLink();
const onDashboardLandingPage = await this.onDashboardLandingPage();
if (!onDashboardLandingPage) throw new Error('Not on the landing page.');
});
await this.clickDashboardBreadcrumbLink();
}
}

Expand Down Expand Up @@ -432,16 +433,10 @@ export function DashboardPageProvider({ getService, getPageObjects }) {

await this.gotoDashboardLandingPage();

await retry.try(async () => {
await this.searchForDashboardWithName(dashName);
await this.selectDashboard(dashName);
await PageObjects.header.waitUntilLoadingHasFinished();
await this.searchForDashboardWithName(dashName);
await this.selectDashboard(dashName);
await PageObjects.header.waitUntilLoadingHasFinished();

const onDashboardLandingPage = await this.onDashboardLandingPage();
if (onDashboardLandingPage) {
throw new Error('Failed to open the dashboard up');
}
});
}

async getPanelTitles() {
Expand Down
Loading

0 comments on commit 4d4c159

Please sign in to comment.