Skip to content

Commit

Permalink
Add functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 20, 2021
1 parent d52d77d commit bbe79df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/functional/apps/discover/_shared_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const toasts = getService('toasts');
const deployment = getService('deployment');
const docTable = getService('docTable');

describe('shared links', function describeIndexTests() {
let baseUrl: string;
Expand Down Expand Up @@ -87,6 +88,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
});

it('should load snapshot URL with empty sort param correctly', async function () {
const expectedUrl =
baseUrl +
'/app/discover?_t=1453775307251#' +
'/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time' +
":(from:'2015-09-19T06:31:44.000Z',to:'2015-09" +
"-23T18:31:44.000Z'))&_a=(columns:!(),filters:!(),index:'logstash-" +
"*',interval:auto,query:(language:kuery,query:'')" +
',sort:!())';
await browser.navigateTo(expectedUrl);
await PageObjects.discover.waitUntilSearchingHasFinished();
const url = await browser.getCurrentUrl();
// url fallback default sort should have been pushed to URL
expect(url).to.contain('sort:!(!(%27@timestamp%27,desc))');
const firstRow = await docTable.getRow({ rowIndex: 0 });
const firstRowText = await firstRow.getVisibleText();
// sorting requested by ES should be correct
expect(firstRowText).to.contain('Sep 22, 2015 @ 23:50:13.253');
});

it('should allow for copying the snapshot URL as a short URL', async function () {
const re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$');
await PageObjects.share.checkShortenUrl();
Expand Down

0 comments on commit bbe79df

Please sign in to comment.