[8.9] [Discover] Fix shared links flaky test (#161172) (#161212)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Discover] Fix shared links flaky test
(#161172)](https://github.com/elastic/kibana/pull/161172)

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

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

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2023-07-04T16:46:47Z","message":"[Discover]
Fix shared links flaky test (#161172)\n\n- Closes
https://github.com/elastic/kibana/issues/158465\r\n\r\n100x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2550","sha":"bfab1b0659269cf67d6a864d6a80ee29632b4b4c","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:DataDiscovery","backport:prev-minor","v8.10.0"],"number":161172,"url":"https://github.com/elastic/kibana/pull/161172","mergeCommit":{"message":"[Discover]
Fix shared links flaky test (#161172)\n\n- Closes
https://github.com/elastic/kibana/issues/158465\r\n\r\n100x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2550","sha":"bfab1b0659269cf67d6a864d6a80ee29632b4b4c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161172","number":161172,"mergeCommit":{"message":"[Discover]
Fix shared links flaky test (#161172)\n\n- Closes
https://github.com/elastic/kibana/issues/158465\r\n\r\n100x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2550","sha":"bfab1b0659269cf67d6a864d6a80ee29632b4b4c"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
Kibana Machine 2023-07-04 13:46:17 -04:00 committed by GitHub
parent 474c1813f3
commit 4af53fe273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,7 @@
import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common';
import expect from '@kbn/expect';
import { decompressFromBase64 } from 'lz-string';
import { FtrProviderContext } from '../ftr_provider_context';
@ -21,8 +22,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const toasts = getService('toasts');
const deployment = getService('deployment');
// Failing: See https://github.com/elastic/kibana/issues/158465
describe.skip('shared links', function describeIndexTests() {
describe('shared links', function describeIndexTests() {
let baseUrl: string;
async function setup({ storeStateInSessionStorage }: { storeStateInSessionStorage: boolean }) {
@ -75,14 +75,29 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('permalink', function () {
it('should allow for copying the snapshot URL', async function () {
const lz =
'N4IgjgrgpgTgniAXKSsGJCANCANgQwDsBzCfYqJEAa2nhAF8cBnAexgBckBtbkAAQ4BLALZRmHfCIAO2EABNxAYxABdVTiWtcEEYWY8N' +
'IIYUUAPKrlbEJ%2BZgAsAtACo5JjrABu%2BXFXwQOVjkAMyFcDxgDRG4jeXxJADUhKAB3AEl5S2tbBxc5YTEAJSIKJFBgmFYRKgAmAAY' +
'ARgBWRzqATkcGtoAVOoA2RABmBsQAFlGAOjrpgC18oIx65taOmsHuhoAOIZHxqdnGHBgoCvF7NMII719kEGvoJD7p6Zxpf2ZKRA4YaAY' +
'GIA%3D';
const actualUrl = await PageObjects.share.getSharedUrl();
expect(actualUrl).to.contain(`?l=${DISCOVER_APP_LOCATOR}`);
expect(actualUrl).to.contain(`&lz=${lz}`);
const urlSearchParams = new URLSearchParams(actualUrl);
expect(JSON.parse(decompressFromBase64(urlSearchParams.get('lz')!)!)).to.eql({
query: {
language: 'kuery',
query: '',
},
sort: [['@timestamp', 'desc']],
columns: [],
index: 'logstash-*',
interval: 'auto',
filters: [],
dataViewId: 'logstash-*',
timeRange: {
from: '2015-09-19T06:31:44.000Z',
to: '2015-09-23T18:31:44.000Z',
},
refreshInterval: {
value: 60000,
pause: true,
},
});
});
it('should allow for copying the snapshot URL as a short URL', async function () {