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
  • Loading branch information
mbondyra authored Aug 27, 2024
1 parent fae0139 commit 2a033c1
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 15 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 @@ -112,15 +112,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 @@ -1380,6 +1380,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 @@ -21,9 +21,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');

describe('Goal', function describeIndexTests() {
// fails on MKI, see https://github.com/elastic/kibana/issues/191238
this.tags(['failsOnMKI']);

const fixture =
'x-pack/test_serverless/functional/fixtures/kbn_archiver/lens/open_in_lens/agg_based/goal.json';

Expand All @@ -49,6 +46,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it('should convert to Lens', async () => {
await panelActions.convertToLensByTitle('Goal - Basic');
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 +76,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 @@ -104,6 +106,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 @@ -132,6 +136,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 @@ -20,8 +20,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const panelActions = getService('dashboardPanelActions');
const kibanaServer = getService('kibanaServer');

// Failing: See https://github.com/elastic/kibana/issues/191153
describe.skip('Metric', function describeIndexTests() {
describe('Metric', function describeIndexTests() {
const fixture =
'x-pack/test_serverless/functional/fixtures/kbn_archiver/lens/open_in_lens/agg_based/metric.json';

Expand All @@ -44,6 +43,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await panelActions.convertToLensByTitle('Metric - Basic');
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 All @@ -70,6 +71,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 @@ -97,6 +100,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 @@ -129,6 +134,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 @@ -84,11 +84,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 2a033c1

Please sign in to comment.