Skip to content

Commit

Permalink
[Managed Content] fix flaky tests (elastic#191388)
Browse files Browse the repository at this point in the history
## Summary

Fixes elastic#190227

Fixes elastic#190737
elastic#190990
elastic#190802
elastic#179307 (couldn't find the
rootcause so just decided to align the solution with other files that
follow similar path and are not flaky)

Fixes elastic#191151
elastic#191152
elastic#191176
elastic#191177
elastic#191178
elastic#191153
elastic#191238

Fixes elastic#190711

(cherry picked from commit 2a033c1)
  • Loading branch information
mbondyra committed Aug 27, 2024
1 parent ed44e9a commit d062a5f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await browser.switchToWindow(discoverWindowHandle);

await PageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.existOrFail('unifiedHistogramChart');
await PageObjects.discover.waitUntilSearchingHasFinished();
await testSubjects.existOrFail('unifiedDataTableToolbar');
// check the table columns
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'extension.raw', 'bytes']);
Expand Down
19 changes: 12 additions & 7 deletions x-pack/test/functional/apps/lens/open_in_lens/tsvb/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,20 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

await dashboard.waitForRenderComplete();
const originalEmbeddableCount = await canvas.getEmbeddableCount();
await retry.try(async () => {
await dashboardPanelActions.customizePanel();
await dashboardCustomizePanel.enableCustomTimeRange();

await panelActions.customizePanel();
await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutOpen();
await dashboardCustomizePanel.enableCustomTimeRange();
await retry.waitFor('quick menu', async () => {
await dashboardCustomizePanel.openDatePickerQuickMenu();
await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_30 days');
await dashboardCustomizePanel.clickSaveButton();
await dashboard.waitForRenderComplete();
await dashboardBadgeActions.expectExistsTimeRangeBadgeAction();
return await testSubjects.exists('superDatePickerCommonlyUsed_Last_30 days');
});
await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_30 days');
await dashboardCustomizePanel.clickSaveButton();
await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed();
await dashboard.waitForRenderComplete();
await dashboardBadgeActions.expectExistsTimeRangeBadgeAction();

await panelActions.openContextMenu();
await panelActions.clickEdit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,17 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it('maps', async () => {
await PageObjects.common.navigateToActualUrl(
'maps',
'map/managed-d7ab-46eb-a807-8fed28ed8566'
'map/managed-d7ab-46eb-a807-8fed28ed8566',
{ ensureCurrentUrl: false }
);
await PageObjects.maps.waitForLayerAddPanelClosed();

await expectManagedContentSignifiers(true, 'mapSaveButton');

await PageObjects.common.navigateToActualUrl(
'maps',
'map/unmanaged-d7ab-46eb-a807-8fed28ed8566'
'map/unmanaged-d7ab-46eb-a807-8fed28ed8566',
{ ensureCurrentUrl: false }
);
await PageObjects.maps.waitForLayerAddPanelClosed();

Expand Down
5 changes: 5 additions & 0 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,11 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
};
},

async hoverOverDimensionButton(index = 0) {
const dimensionButton = (await testSubjects.findAll('lns-dimensionTrigger'))[index];
await dimensionButton.moveMouseTo();
},

async getMetricVisualizationData() {
const tiles = await this.getMetricTiles();
const showingBar = Boolean(await findService.existsByCssSelector('.echSingleMetricProgress'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const visPanel = await panelActions.getPanelHeading('Goal - Basic');
await panelActions.convertToLens(visPanel);
await lens.waitForVisualization('mtrVis');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -76,6 +79,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await dimensions[0].getVisibleText()).to.be('Average machine.ram');
expect(await dimensions[1].getVisibleText()).to.be('Static value: 1');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -105,6 +110,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await dimensions[1].getVisibleText()).to.be('Static value: 1');
expect(await dimensions[2].getVisibleText()).to.be('@timestamp');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -134,6 +141,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await dimensions[1].getVisibleText()).to.be('Static value: 13300000000');
expect(await dimensions[2].getVisibleText()).to.be('machine.os.raw: Descending');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(6);
expect(data).to.eql([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await panelActions.convertToLens(visPanel);
await lens.waitForVisualization('mtrVis');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -71,6 +73,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(dimensions).to.have.length(1);
expect(await dimensions[0].getVisibleText()).to.be('Average machine.ram');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -99,6 +103,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await dimensions[0].getVisibleText()).to.be('Overall Max of Count');
expect(await dimensions[1].getVisibleText()).to.be('@timestamp');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
expect(data).to.eql([
Expand Down Expand Up @@ -131,6 +137,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(dimensions).to.have.length(2);
expect(await dimensions[0].getVisibleText()).to.be('Average machine.ram');
expect(await dimensions[1].getVisibleText()).to.be('machine.os.raw: Descending');

// hovering over dimension button to make sure neither of metrics are hovered so the color is stable
await lens.hoverOverDimensionButton();

const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(6);
expect(data).to.eql([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,18 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

await dashboard.waitForRenderComplete();
const originalEmbeddableCount = await canvas.getEmbeddableCount();

await dashboardPanelActions.customizePanel();
await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutOpen();
await dashboardCustomizePanel.enableCustomTimeRange();
await dashboardCustomizePanel.openDatePickerQuickMenu();
await retry.waitFor('quick menu', async () => {
await dashboardCustomizePanel.openDatePickerQuickMenu();
return await testSubjects.exists('superDatePickerCommonlyUsed_Last_30 days');
});
await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_30 days');
await dashboardCustomizePanel.clickSaveButton();
await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed();
await dashboard.waitForRenderComplete();
await dashboardBadgeActions.expectExistsTimeRangeBadgeAction();

Expand Down

0 comments on commit d062a5f

Please sign in to comment.