unskip many_fields_lens_editor journey (#167634)

## Summary

Adding extra wait time and check for chart rendering only after the page
is loaded (relying on Chart switch popover)
I would like to merge it before #166808 so we can check metrics
stability before actual merge.

Note: it looks like a product flakiness rather than test.

Flaky test runner stats

before:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3258
16/50 failed

after:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3261
100/100 passed
This commit is contained in:
Dzmitry Lemechko 2023-09-29 17:49:10 +02:00 committed by GitHub
parent d37d8ae85c
commit 46aecbee5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 16 deletions

View file

@ -15,12 +15,14 @@ interface WaitForRenderArgs {
expectedItemsCount: number;
itemLocator: string;
checkAttribute: string;
timeout: number;
}
export class KibanaPage {
readonly page: Page;
readonly log: ToolingLog;
readonly retry: Retry;
readonly defaultTimeout = 30_000;
constructor(page: Page, log: ToolingLog, retry: Retry) {
this.page = page;
@ -38,14 +40,19 @@ export class KibanaPage {
await this.page.click(subj('breadcrumb dashboardListingBreadcrumb first'));
}
async waitForRender({ expectedItemsCount, itemLocator, checkAttribute }: WaitForRenderArgs) {
async waitForRender({
expectedItemsCount,
itemLocator,
checkAttribute,
timeout,
}: WaitForRenderArgs) {
// we can't use `page.waitForFunction` because of CSP while testing on Cloud
await this.retry.waitFor(
await this.retry.waitForWithTimeout(
`rendering of ${expectedItemsCount} elements with selector ${itemLocator} is completed`,
timeout,
async () => {
const renderingItems = await this.page.$$(itemLocator);
if (renderingItems.length === expectedItemsCount) {
// all components are loaded, checking if all are rendered
const renderStatuses = await Promise.all(
renderingItems.map(async (item) => {
return (await item.getAttribute(checkAttribute)) === 'true';
@ -67,19 +74,33 @@ export class KibanaPage {
);
}
async waitForVisualizations(count: number) {
async waitForVisualizations({
count,
timeout = this.defaultTimeout,
}: {
count: number;
timeout?: number;
}) {
await this.waitForRender({
expectedItemsCount: count,
itemLocator: '[data-rendering-count]',
checkAttribute: 'data-render-complete',
timeout,
});
}
async waitForCharts(count: number) {
async waitForCharts({
count,
timeout = this.defaultTimeout,
}: {
count: number;
timeout?: number;
}) {
await this.waitForRender({
expectedItemsCount: count,
itemLocator: '.echChartStatus',
checkAttribute: 'data-ech-render-complete',
timeout,
});
}

View file

@ -13,5 +13,5 @@ export const journey = new Journey({
}).step('Go to dashboard', async ({ page, kbnUrl, kibanaServer, kibanaPage }) => {
await kibanaServer.uiSettings.update({ 'histogram:maxBars': 100 });
await page.goto(kbnUrl.get(`/app/dashboards#/view/92b143a0-2e9c-11ed-b1b6-a504560b392c`));
await kibanaPage.waitForVisualizations(1);
await kibanaPage.waitForVisualizations({ count: 1 });
});

View file

@ -20,5 +20,5 @@ export const journey = new Journey({
.step('Go to Ecommerce Dashboard', async ({ page, kibanaPage }) => {
await page.click(subj('dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard'));
await kibanaPage.waitForVisualizations(13);
await kibanaPage.waitForVisualizations({ count: 13 });
});

View file

@ -20,5 +20,5 @@ export const journey = new Journey({
.step('Go to Ecommerce Dashboard with Saved Search only', async ({ page, kibanaPage }) => {
await page.click(subj('dashboardListingTitleLink-[eCommerce]-Saved-Search-Dashboard'));
await kibanaPage.waitForVisualizations(1);
await kibanaPage.waitForVisualizations({ count: 1 });
});

View file

@ -20,5 +20,5 @@ export const journey = new Journey({
.step('Go to Ecommerce Dashboard with TSVB Gauge only', async ({ page, kibanaPage }) => {
await page.click(subj('dashboardListingTitleLink-[eCommerce]-TSVB-Gauge-Only-Dashboard'));
await kibanaPage.waitForVisualizations(1);
await kibanaPage.waitForVisualizations({ count: 1 });
});

View file

@ -20,5 +20,5 @@ export const journey = new Journey({
.step('Go to Flights Dashboard', async ({ page, kibanaPage }) => {
await page.click(subj('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard'));
await kibanaPage.waitForVisualizations(14);
await kibanaPage.waitForVisualizations({ count: 14 });
});

View file

@ -10,7 +10,6 @@ import { subj } from '@kbn/test-subj-selector';
export const journey = new Journey({
// Failing: See https://github.com/elastic/kibana/issues/167496
skipped: true,
kbnArchives: ['x-pack/performance/kbn_archives/lens_many_fields'],
esArchives: ['test/functional/fixtures/es_archiver/stress_test'],
})
@ -21,10 +20,12 @@ export const journey = new Journey({
)
);
await page.waitForSelector(subj('table-is-ready'));
// wait extra 5 seconds: we're not sure why, but the extra sleep before loading the editor makes the metrics more consistent
await page.waitForTimeout(5000);
// wait extra 10 seconds: we're not sure why, but the extra sleep before loading the editor makes the metrics more consistent
// sometimes lens charts are not loaded
await page.waitForTimeout(10000);
})
.step('Open existing Lens visualization', async ({ page, kibanaPage }) => {
await page.click(subj('visListingTitleLink-Lens-Stress-Test'));
await kibanaPage.waitForCharts(6);
await page.waitForSelector(subj('lnsChartSwitchPopover'));
await kibanaPage.waitForCharts({ count: 6, timeout: 60000 });
});

View file

@ -50,5 +50,5 @@ export const journey = new Journey({
})
.step('Wait for visualization animations to finish', async ({ kibanaPage }) => {
await kibanaPage.waitForVisualizations(1);
await kibanaPage.waitForVisualizations({ count: 1 });
});

View file

@ -20,5 +20,5 @@ export const journey = new Journey({
.step('Go to Web Logs Dashboard', async ({ page, kibanaPage }) => {
await page.click(subj('dashboardListingTitleLink-[Logs]-Web-Traffic'));
await kibanaPage.waitForVisualizations(11);
await kibanaPage.waitForVisualizations({ count: 11 });
});