Skip to content

Commit

Permalink
Add test that would have failed with previous bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bargs committed Dec 5, 2019
1 parent e17f9cc commit e022480
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/functional/apps/discover/_saved_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);
const browser = getService('browser');

const defaultSettings = {
defaultIndex: 'logstash-*',
Expand Down Expand Up @@ -86,6 +87,17 @@ export default function ({ getService, getPageObjects }) {
expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime);
});

it('preserves the currently loaded query when the page is reloaded', async () => {
await browser.refresh();
const timePickerValues = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes();
expect(await filterBar.hasFilter('extension.raw', 'jpg')).to.be(true);
expect(timePickerValues.start).to.not.eql(PageObjects.timePicker.defaultStartTime);
expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime);
expect(await PageObjects.discover.getHitCount()).to.be('2,792');
expect(await savedQueryManagementComponent.getCurrentlyLoadedQueryID()).to.be('OkResponse');
});


it('allows saving changes to a currently loaded query via the saved query management component', async () => {
await queryBar.setQuery('response:404');
await savedQueryManagementComponent.updateCurrentlyLoadedQuery(
Expand Down
9 changes: 9 additions & 0 deletions test/functional/services/saved_query_management_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export function SavedQueryManagementComponentProvider({ getService }: FtrProvide
const retry = getService('retry');

class SavedQueryManagementComponent {
public async getCurrentlyLoadedQueryID() {
await this.openSavedQueryManagementComponent();
try {
return await testSubjects.getVisibleText('~saved-query-list-item-selected');
} catch {
return undefined;
}
}

public async saveNewQuery(
name: string,
description: string,
Expand Down

0 comments on commit e022480

Please sign in to comment.