From cc79b051d952a979f314057a50b2818f22f21a29 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Tue, 4 Jul 2023 14:17:36 +0200 Subject: [PATCH] [Discover] Fix shared links flaky test --- .../apps/discover/group1/_shared_links.ts | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/test/functional/apps/discover/group1/_shared_links.ts b/test/functional/apps/discover/group1/_shared_links.ts index 11e92297aad99..a840528dc1ecf 100644 --- a/test/functional/apps/discover/group1/_shared_links.ts +++ b/test/functional/apps/discover/group1/_shared_links.ts @@ -8,6 +8,7 @@ import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common'; import expect from '@kbn/expect'; +import { compressToBase64 } 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,31 @@ 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 data = { + query: { + query: '', + language: 'kuery', + }, + 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, + }, + }; const actualUrl = await PageObjects.share.getSharedUrl(); expect(actualUrl).to.contain(`?l=${DISCOVER_APP_LOCATOR}`); - expect(actualUrl).to.contain(`&lz=${lz}`); + expect(actualUrl).to.contain( + `&lz=${encodeURIComponent(compressToBase64(JSON.stringify(data)))}` + ); }); it('should allow for copying the snapshot URL as a short URL', async function () {