[8.11] [Search] Unskip Search examples handling warnings test (#168367) (#168669)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Search] Unskip Search examples handling warnings test
(#168367)](https://github.com/elastic/kibana/pull/168367)

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

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

<!--BACKPORT [{"author":{"name":"Matthias
Wilhelm","email":"matthias.wilhelm@elastic.co"},"sourceCommit":{"committedDate":"2023-10-12T05:35:12Z","message":"[Search]
Unskip Search examples handling warnings test (#168367)\n\n##
Summary\r\n\r\nImproves and unskips the code testing search source
warning in our Search examples.\r\n\r\nFlaky test runner
200x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3440\r\n\r\nResolves
#166484","sha":"4302059b4ec4776d12578840ab4a649719ef81f4","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Search","release_note:skip","Team:DataDiscovery","backport:prev-minor","v8.12.0"],"number":168367,"url":"https://github.com/elastic/kibana/pull/168367","mergeCommit":{"message":"[Search]
Unskip Search examples handling warnings test (#168367)\n\n##
Summary\r\n\r\nImproves and unskips the code testing search source
warning in our Search examples.\r\n\r\nFlaky test runner
200x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3440\r\n\r\nResolves
#166484","sha":"4302059b4ec4776d12578840ab4a649719ef81f4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168367","number":168367,"mergeCommit":{"message":"[Search]
Unskip Search examples handling warnings test (#168367)\n\n##
Summary\r\n\r\nImproves and unskips the code testing search source
warning in our Search examples.\r\n\r\nFlaky test runner
200x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3440\r\n\r\nResolves
#166484","sha":"4302059b4ec4776d12578840ab4a649719ef81f4"}}]}]
BACKPORT-->

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
This commit is contained in:
Kibana Machine 2023-10-12 02:39:20 -04:00 committed by GitHub
parent 0ecce7a628
commit d07ab61a4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,9 +25,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const comboBox = getService('comboBox');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const monacoEditor = getService('monacoEditor');
// Failing: See https://github.com/elastic/kibana/issues/166484
describe.skip('handling warnings with search source fetch', function () {
describe('handling warnings with search source fetch', function () {
const dataViewTitle = 'sample-01,sample-01-rollup';
const fromTime = 'Jun 17, 2022 @ 00:00:00.000';
const toTime = 'Jun 23, 2022 @ 00:00:00.000';
@ -104,6 +104,35 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should show search warnings as toasts', async () => {
await testSubjects.click('searchSourceWithOther');
await retry.try(async () => {
const toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});
});
// click "see full error" button in the toast
const [openShardModalButton] = await testSubjects.findAll('viewWarningBtn');
await openShardModalButton.click();
// request
await retry.try(async () => {
await testSubjects.click('inspectorRequestDetailRequest');
const requestText = await monacoEditor.getCodeEditorValue(0);
expect(requestText).to.contain(testRollupField);
});
// response
await retry.try(async () => {
await testSubjects.click('inspectorRequestDetailResponse');
const responseText = await monacoEditor.getCodeEditorValue(0);
expect(responseText).to.contain(shardFailureReason);
});
await testSubjects.click('euiFlyoutCloseButton');
// wait for response - toasts appear before the response is rendered
let response: estypes.SearchResponse | undefined;
await retry.try(async () => {
@ -111,29 +140,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(response).not.to.eql({});
});
// toasts
const toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});
// click "see full error" button in the toast
const [openShardModalButton] = await testSubjects.findAll('openIncompleteResultsModalBtn');
await openShardModalButton.click();
// request
await testSubjects.click('showRequestButton');
const requestBlock = await testSubjects.find('incompleteResultsModalRequestBlock');
expect(await requestBlock.getVisibleText()).to.contain(testRollupField);
// response
await testSubjects.click('showResponseButton');
const responseBlock = await testSubjects.find('incompleteResultsModalResponseBlock');
expect(await responseBlock.getVisibleText()).to.contain(shardFailureReason);
await testSubjects.click('closeIncompleteResultsModal');
// response tab
assert(response && response._shards.failures);
expect(response._shards.total).to.be(4);
@ -158,10 +164,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await retry.try(async () => {
toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
});
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});
});
// warnings tab