[ML] Stabilize docs screenshots suites (#141755) (#141960)

This PR stabilizes the docs screenshots suite by disabling Kibana tour popovers and wrapping the multi selection service method into a retry.

(cherry picked from commit 0446e0100b)

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
This commit is contained in:
Kibana Machine 2022-09-27 10:05:14 -06:00 committed by GitHub
parent 529da89028
commit cba548ce68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 15 deletions

View file

@ -164,22 +164,27 @@ export function MachineLearningCommonUIProvider({
},
async setMultiSelectFilter(testDataSubj: string, fieldTypes: string[]) {
await testSubjects.clickWhenNotDisabledWithoutRetry(`${testDataSubj}-button`);
await testSubjects.existOrFail(`${testDataSubj}-popover`);
await testSubjects.existOrFail(`${testDataSubj}-searchInput`);
const searchBarInput = await testSubjects.find(`${testDataSubj}-searchInput`);
await retry.tryForTime(60 * 1000, async () => {
// escape popover
await browser.pressKeys(browser.keys.ESCAPE);
for (const fieldType of fieldTypes) {
await retry.tryForTime(5000, async () => {
await searchBarInput.clearValueWithKeyboard();
await searchBarInput.type(fieldType);
if (!(await testSubjects.exists(`${testDataSubj}-option-${fieldType}-checked`))) {
await testSubjects.existOrFail(`${testDataSubj}-option-${fieldType}`);
await testSubjects.click(`${testDataSubj}-option-${fieldType}`);
await testSubjects.existOrFail(`${testDataSubj}-option-${fieldType}-checked`);
}
});
}
await testSubjects.clickWhenNotDisabledWithoutRetry(`${testDataSubj}-button`);
await testSubjects.existOrFail(`${testDataSubj}-popover`);
await testSubjects.existOrFail(`${testDataSubj}-searchInput`);
const searchBarInput = await testSubjects.find(`${testDataSubj}-searchInput`);
for (const fieldType of fieldTypes) {
await retry.tryForTime(5000, async () => {
await searchBarInput.clearValueWithKeyboard();
await searchBarInput.type(fieldType);
if (!(await testSubjects.exists(`${testDataSubj}-option-${fieldType}-checked`))) {
await testSubjects.existOrFail(`${testDataSubj}-option-${fieldType}`);
await testSubjects.click(`${testDataSubj}-option-${fieldType}`);
await testSubjects.existOrFail(`${testDataSubj}-option-${fieldType}-checked`);
}
});
}
});
// escape popover
await browser.pressKeys(browser.keys.ESCAPE);

View file

@ -46,6 +46,14 @@ export function MachineLearningTestResourcesProvider(
await kibanaServer.uiSettings.unset('dateFormat:tz');
},
async disableKibanaAnnouncements() {
await kibanaServer.uiSettings.update({ hideAnnouncements: true });
},
async resetKibanaAnnouncements() {
await kibanaServer.uiSettings.unset('hideAnnouncements');
},
async savedObjectExistsById(id: string, objectType: SavedObjectType): Promise<boolean> {
const response = await supertest.get(`/api/saved_objects/${objectType}/${id}`);
return response.status === 200;

View file

@ -22,6 +22,7 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
before(async () => {
await ml.testResources.installAllKibanaSampleData();
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.testResources.disableKibanaAnnouncements();
await browser.setWindowSize(1920, 1080);
});
@ -29,6 +30,7 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
await securityPage.forceLogout();
await ml.testResources.removeAllKibanaSampleData();
await ml.testResources.resetKibanaTimeZone();
await ml.testResources.resetKibanaAnnouncements();
});
loadTestFile(require.resolve('./anomaly_detection'));

View file

@ -23,6 +23,7 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
before(async () => {
await ml.testResources.installAllKibanaSampleData();
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.testResources.disableKibanaAnnouncements();
await browser.setWindowSize(1920, 1080);
await securityPage.login(
esTestConfig.getUrlParts().username,
@ -34,6 +35,7 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
await securityPage.forceLogout();
await ml.testResources.removeAllKibanaSampleData();
await ml.testResources.resetKibanaTimeZone();
await ml.testResources.resetKibanaAnnouncements();
});
loadTestFile(require.resolve('./stack_cases'));