Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Fix shared links flaky test #161172

Merged
merged 3 commits into from
Jul 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Discover] Fix this time
  • Loading branch information
jughosta committed Jul 4, 2023
commit e96d109a5cc7b7c2dc1887e432237d8f69f49b38
14 changes: 6 additions & 8 deletions test/functional/apps/discover/group1/_shared_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common';
import expect from '@kbn/expect';
import { compressToBase64 } from 'lz-string';
import { decompressFromBase64 } from 'lz-string';

import { FtrProviderContext } from '../ftr_provider_context';

Expand Down Expand Up @@ -75,7 +75,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('permalink', function () {
it('should allow for copying the snapshot URL', async function () {
const data = {
const actualUrl = await PageObjects.share.getSharedUrl();
expect(actualUrl).to.contain(`?l=${DISCOVER_APP_LOCATOR}`);
const urlSearchParams = new URLSearchParams(actualUrl);
expect(JSON.parse(decompressFromBase64(urlSearchParams.get('lz')!)!)).to.eql({
query: {
language: 'kuery',
query: '',
Expand All @@ -94,12 +97,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
value: 60000,
pause: true,
},
};
const actualUrl = await PageObjects.share.getSharedUrl();
expect(actualUrl).to.contain(`?l=${DISCOVER_APP_LOCATOR}`);
expect(actualUrl).to.contain(
`&lz=${encodeURIComponent(compressToBase64(JSON.stringify(data)))}`
);
});
});

it('should allow for copying the snapshot URL as a short URL', async function () {
Expand Down