[8.8] [ML] Stabilize and reenable notifications tests (#158546) (#158575)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[ML] Stabilize and reenable notifications tests
(#158546)](https://github.com/elastic/kibana/pull/158546)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Oskamp","email":"robert.oskamp@elastic.co"},"sourceCommit":{"committedDate":"2023-05-26T15:31:10Z","message":"[ML]
Stabilize and reenable notifications tests (#158546)\n\n##
Summary\r\n\r\nThis PR stabilizes ML notifications tests by introducing
leniency when\r\nchecking for the notifications table in loading state.
It also reenables\r\nthe test suite.\r\n\r\n### Other
changes\r\n\r\nAfter the test cleanup was done, we still had a left-over
saved object.\r\nThis was caused by the test creating a job for `space1`
without actually\r\ncreating that space. In order to fix this, we now
let the test properly\r\ncreate and cleanup that
space.","sha":"dbf0a07a564630277780b432718705e7e20f5cb4","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","test_ui_functional","release_note:skip","backport:prev-minor","v8.9.0","v8.8.1"],"number":158546,"url":"https://github.com/elastic/kibana/pull/158546","mergeCommit":{"message":"[ML]
Stabilize and reenable notifications tests (#158546)\n\n##
Summary\r\n\r\nThis PR stabilizes ML notifications tests by introducing
leniency when\r\nchecking for the notifications table in loading state.
It also reenables\r\nthe test suite.\r\n\r\n### Other
changes\r\n\r\nAfter the test cleanup was done, we still had a left-over
saved object.\r\nThis was caused by the test creating a job for `space1`
without actually\r\ncreating that space. In order to fix this, we now
let the test properly\r\ncreate and cleanup that
space.","sha":"dbf0a07a564630277780b432718705e7e20f5cb4"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158546","number":158546,"mergeCommit":{"message":"[ML]
Stabilize and reenable notifications tests (#158546)\n\n##
Summary\r\n\r\nThis PR stabilizes ML notifications tests by introducing
leniency when\r\nchecking for the notifications table in loading state.
It also reenables\r\nthe test suite.\r\n\r\n### Other
changes\r\n\r\nAfter the test cleanup was done, we still had a left-over
saved object.\r\nThis was caused by the test creating a job for `space1`
without actually\r\ncreating that space. In order to fix this, we now
let the test properly\r\ncreate and cleanup that
space.","sha":"dbf0a07a564630277780b432718705e7e20f5cb4"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
This commit is contained in:
Kibana Machine 2023-05-26 12:28:54 -04:00 committed by GitHub
parent b7375b08d8
commit ec17499aa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View file

@ -15,22 +15,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml');
const browser = getService('browser');
const spacesService = getService('spaces');
const idSpace1 = 'space1';
const configs = [
{ jobId: 'fq_001', spaceId: undefined },
{ jobId: 'fq_002', spaceId: 'space1' },
{ jobId: 'fq_002', spaceId: idSpace1 },
];
const failConfig = { jobId: 'fq_fail', spaceId: undefined };
// Failing: See https://github.com/elastic/kibana/issues/154578
describe.skip('Notifications list', function () {
describe('Notifications list', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote');
await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser();
// Prepare jobs to generate notifications
await spacesService.create({ id: idSpace1, name: 'space_one', disabledFeatures: [] });
for (const config of configs) {
await ml.api.createAnomalyDetectionJob(
ml.commonConfig.getADFqSingleMetricJobConfig(config.jobId),
@ -38,7 +42,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
}
await ml.securityUI.loginAsMlPowerUser();
await PageObjects.common.navigateToApp('ml', {
basePath: '',
});
@ -48,6 +51,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
for (const { jobId } of [...configs, failConfig]) {
await ml.api.deleteAnomalyDetectionJobES(jobId);
}
await spacesService.delete(idSpace1);
await ml.testResources.cleanMLSavedObjects();
await ml.api.cleanMlIndices();
await ml.testResources.deleteIndexPatternByTitle('ft_farequote');

View file

@ -64,7 +64,12 @@ export function MlTableServiceProvider({ getPageObject, getService }: FtrProvide
public async waitForTableToStartLoading() {
await testSubjects.existOrFail(`~${this.tableTestSubj}`, { timeout: 60 * 1000 });
await testSubjects.existOrFail(`${this.tableTestSubj} loading`, { timeout: 30 * 1000 });
// After invoking an action that caused the table to start loading, the loading
// should start quickly after the table exists. Sometimes it is even so quick that
// the loading is already done when we try to check for it, so we're not failing
// in that case and just move on.
await testSubjects.exists(`${this.tableTestSubj} loading`, { timeout: 3 * 1000 });
}
public async waitForTableToLoad() {