Skip to content

Commit

Permalink
Use helpers in functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwild committed May 20, 2020
1 parent 9c1453d commit 6e55e81
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions test/functional/apps/dashboard/embed_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,21 @@ export default function({ getService, getPageObjects }) {
});

it('shows or hides elements based on URL params', async () => {
const topMenuShown = await testSubjects.exists('top-nav');
expect(topMenuShown).to.be(false);
const queryInputShown = await testSubjects.exists('queryInput');
expect(queryInputShown).to.be(false);
const timeFilterShown = await testSubjects.exists('superDatePickerToggleQuickMenuButton');
expect(timeFilterShown).to.be(false);
const filterBarShown = await testSubjects.exists('showFilterActions');
expect(filterBarShown).to.be(true);
await testSubjects.missingOrFail('top-nav');
await testSubjects.missingOrFail('queryInput');
await testSubjects.missingOrFail('superDatePickerToggleQuickMenuButton');
await testSubjects.existOrFail('showFilterActions');

const currentUrl = await browser.getCurrentUrl();
const newUrl = [currentUrl].concat(urlParamExtensions).join('&');
// Embed parameter only works on a hard refresh.
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);

await retry.try(async () => {
const topMenuShown = await testSubjects.exists('top-nav');
expect(topMenuShown).to.be(true);
const queryInputShown = await testSubjects.exists('queryInput');
expect(queryInputShown).to.be(true);
const timeFilterShown = await testSubjects.exists('superDatePickerToggleQuickMenuButton');
expect(timeFilterShown).to.be(true);
const filterBarShown = await testSubjects.exists('showFilterActions');
expect(filterBarShown).to.be(false);
});
await testSubjects.existOrFail('top-nav');
await testSubjects.existOrFail('queryInput');
await testSubjects.existOrFail('superDatePickerToggleQuickMenuButton');
await testSubjects.missingOrFail('showFilterActions');
});

after(async function() {
Expand Down

0 comments on commit 6e55e81

Please sign in to comment.