-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[performance] enable journeys on serverless - part 1 (#162902)
## Summary This PR is the Step 1 to enable performance journeys run for serverless projects. The focus is to re-design journeys to be compatible both for stateful & serverless Kibana. I created `KibanaPage` class to have some shared UI actions across different journeys. `ProjectPage` extends `KibanaPage` and allows us to override actions, that are different (or have different locators) in Kibana Project UI (generic project at the moment) `kibanaPage` is available in Step context and based on TEST_SERVERLESS env var appropriate class instance is used. ```typescript .step('Go to Discover Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/discover`)); await kibanaPage.waitForHeader(); await page.waitForSelector('[data-test-subj="discoverDocTable"][data-render-complete="true"]'); await page.waitForSelector(subj('globalLoadingIndicator-hidden')); }) ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
2fd6af9
commit 4dadcbb
Showing
23 changed files
with
182 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { ToolingLog } from '@kbn/tooling-log'; | ||
import { Page } from 'playwright'; | ||
import { KibanaPage } from './kibana_page'; | ||
import { ProjectPage } from './project_page'; | ||
|
||
export function getNewPageObject(isServerless: boolean, page: Page, log: ToolingLog) { | ||
return isServerless ? new ProjectPage(page, log) : new KibanaPage(page, log); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { subj } from '@kbn/test-subj-selector'; | ||
import { ToolingLog } from '@kbn/tooling-log'; | ||
import { Page } from 'playwright'; | ||
|
||
interface WaitForRenderArgs { | ||
expectedItemsCount: number; | ||
itemLocator: string; | ||
checkAttribute: string; | ||
} | ||
|
||
export class KibanaPage { | ||
readonly page: Page; | ||
readonly log: ToolingLog; | ||
|
||
constructor(page: Page, log: ToolingLog) { | ||
this.page = page; | ||
this.log = log; | ||
} | ||
|
||
async waitForHeader() { | ||
return this.page.waitForSelector('.headerGlobalNav', { | ||
state: 'attached', | ||
}); | ||
} | ||
|
||
async backToDashboardListing() { | ||
await this.page.click(subj('breadcrumb dashboardListingBreadcrumb first')); | ||
} | ||
|
||
async waitForRender({ expectedItemsCount, itemLocator, checkAttribute }: WaitForRenderArgs) { | ||
try { | ||
await this.page.waitForFunction( | ||
function renderCompleted(args: WaitForRenderArgs) { | ||
const renderingItems = Array.from(document.querySelectorAll(args.itemLocator)); | ||
const allItemsLoaded = renderingItems.length === args.expectedItemsCount; | ||
return allItemsLoaded | ||
? renderingItems.every((e) => e.getAttribute(args.checkAttribute) === 'true') | ||
: false; | ||
}, | ||
{ expectedItemsCount, itemLocator, checkAttribute } | ||
); | ||
} catch (err) { | ||
const loaded = await this.page.$$(itemLocator); | ||
const rendered = await this.page.$$(`${itemLocator}[${checkAttribute}="true"]`); | ||
this.log.error( | ||
`'waitForRendering' failed: loaded - ${loaded.length}, rendered - ${rendered.length}, expected count - ${expectedItemsCount}` | ||
); | ||
throw err; | ||
} | ||
} | ||
|
||
async waitForVisualizations(count: number) { | ||
await this.waitForRender({ | ||
expectedItemsCount: count, | ||
itemLocator: '[data-rendering-count]', | ||
checkAttribute: 'data-render-complete', | ||
}); | ||
} | ||
|
||
async waitForCharts(count: number) { | ||
await this.waitForRender({ | ||
expectedItemsCount: count, | ||
itemLocator: '.echChartStatus', | ||
checkAttribute: 'data-ech-render-complete', | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { subj } from '@kbn/test-subj-selector'; | ||
import { KibanaPage } from './kibana_page'; | ||
|
||
export class ProjectPage extends KibanaPage { | ||
async waitForHeader() { | ||
return this.page.waitForSelector(subj('kibanaProjectHeader'), { | ||
state: 'attached', | ||
}); | ||
} | ||
|
||
async backToDashboardListing() { | ||
await this.page.click(subj('nav-item-search_project_nav.explore.dashboards')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.