mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] Docs screenshots - support to set window size per screenshot (#135111)
This PR enhances the service method that takes screenshots for the docs to specify the browser window size.
This commit is contained in:
parent
14c640573c
commit
68143891fd
3 changed files with 19 additions and 2 deletions
|
@ -173,5 +173,10 @@ export function MachineLearningAnomaliesTableProvider({ getService }: FtrProvide
|
|||
async scrollTableIntoView() {
|
||||
await testSubjects.scrollIntoView('mlAnomaliesTable');
|
||||
},
|
||||
|
||||
async scrollRowIntoView(rowIndex: number) {
|
||||
const rowSubj = await this.getRowSubjByRowIndex(rowIndex);
|
||||
await testSubjects.scrollIntoView(rowSubj);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -109,8 +109,14 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
await ml.anomalyExplorer.scrollChartsContainerIntoView();
|
||||
await ml.anomaliesTable.ensureDetailsOpen(0);
|
||||
await ml.anomaliesTable.scrollRowIntoView(0);
|
||||
await ml.testExecution.logTestStep('take screenshot');
|
||||
await mlScreenshots.takeScreenshot('ml-population-anomaly', screenshotDirectories);
|
||||
await mlScreenshots.takeScreenshot(
|
||||
'ml-population-anomaly',
|
||||
screenshotDirectories,
|
||||
1500,
|
||||
1300
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,12 +8,18 @@
|
|||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function MachineLearningScreenshotsProvider({ getService }: FtrProviderContext) {
|
||||
const browser = getService('browser');
|
||||
const ml = getService('ml');
|
||||
const screenshot = getService('screenshots');
|
||||
|
||||
const DEFAULT_WIDTH = 1920;
|
||||
const DEFAULT_HEIGHT = 1080;
|
||||
|
||||
return {
|
||||
async takeScreenshot(name: string, subDirectories: string[]) {
|
||||
async takeScreenshot(name: string, subDirectories: string[], width?: number, height?: number) {
|
||||
await browser.setWindowSize(width ?? DEFAULT_WIDTH, height ?? DEFAULT_HEIGHT);
|
||||
await screenshot.take(`${name}_new`, undefined, subDirectories);
|
||||
await browser.setWindowSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
},
|
||||
|
||||
async removeFocusFromElement() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue