Skip to content

Commit 709a910

Browse files
authored
[Background search test] Change notifications assertion (elastic#269280)
## Summary Closes elastic#268710 Instead of assuming that the toast is in the 2nd position this updates it to just look for the link that appears in the completion toast. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
1 parent 1aba26c commit 709a910

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/platform/test/functional/services/search_sessions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ export class SearchSessionsService extends FtrService {
8282
);
8383
}
8484

85+
public async expectCompletedSearchToast() {
86+
await this.retry.waitFor(
87+
'the toast appears indicating that the search session is completed',
88+
() => this.testSubjects.exists('backgroundSearchCompletedToastLink')
89+
);
90+
}
91+
8592
public async openCompletedSearchFromToast() {
8693
await this.retry.try(async () => {
8794
const link = await this.testSubjects.find('backgroundSearchCompletedToastLink');

x-pack/platform/test/search_sessions_integration/tests/apps/discover/notifications.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import type { FtrProviderContext } from '../../../ftr_provider_context';
99

1010
export default function ({ getService, getPageObjects }: FtrProviderContext) {
11-
const retry = getService('retry');
1211
const monacoEditor = getService('monacoEditor');
1312
const searchSessions = getService('searchSessions');
14-
const toasts = getService('toasts');
1513
const esArchiver = getService('esArchiver');
1614

1715
const { common, timePicker, discover } = getPageObjects(['common', 'discover', 'timePicker']);
@@ -34,10 +32,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
3432
await searchSessions.save({ withRefresh: true });
3533

3634
// Verify the completion toast is shown
37-
await retry.waitFor('completion toast is shown', async () => {
38-
const toastContent = await toasts.getContentByIndex(1); // 0 is the sent to background toast, 1 is the completion toast
39-
return toastContent.includes('Background search completed');
40-
});
35+
await searchSessions.expectCompletedSearchToast();
4136
});
4237
});
4338
}

0 commit comments

Comments
 (0)