Skip to content

Commit

Permalink
more euiswitch functional test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Oct 30, 2019
1 parent 0cc7a2e commit 65dab1e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ export default function ({ getService, getPageObjects }) {
describe('updateFiltersOnChange is true', () => {
before(async () => {
await PageObjects.visualize.clickVisEditorTab('options');
await PageObjects.visualize.checkCheckbox('inputControlEditorUpdateFiltersOnChangeCheckbox');
await PageObjects.visualize.checkSwitch('inputControlEditorUpdateFiltersOnChangeCheckbox');
await PageObjects.visualize.clickGo();
});

after(async () => {
await PageObjects.visualize.clickVisEditorTab('options');
await PageObjects.visualize.uncheckCheckbox('inputControlEditorUpdateFiltersOnChangeCheckbox');
await PageObjects.visualize.uncheckSwitch('inputControlEditorUpdateFiltersOnChangeCheckbox');
await PageObjects.visualize.clickGo();
});

Expand Down
22 changes: 22 additions & 0 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,28 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
}
}

async isSwitchChecked(selector) {
const checkbox = await testSubjects.find(selector);
const isChecked = await checkbox.getAttribute('aria-checked');
return isChecked === 'true';
}

async checkSwitch(selector) {
const isChecked = await this.isSwitchChecked(selector);
if (!isChecked) {
log.debug(`checking switch ${selector}`);
await testSubjects.click(selector);
}
}

async uncheckSwitch(selector) {
const isChecked = await this.isSwitchChecked(selector);
if (isChecked) {
log.debug(`unchecking switch ${selector}`);
await testSubjects.click(selector);
}
}

async setSelectByOptionText(selectId, optionText) {
const selectField = await find.byCssSelector(`#${selectId}`);
const options = await find.allByCssSelector(`#${selectId} > option`);
Expand Down
8 changes: 5 additions & 3 deletions test/functional/services/saved_query_management_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,17 @@ export function SavedQueryManagementComponentProvider({ getService }: FtrProvide
await testSubjects.setValue('saveQueryFormDescription', description);

const currentIncludeFiltersValue =
(await testSubjects.getAttribute('saveQueryFormIncludeFiltersOption', 'checked')) ===
(await testSubjects.getAttribute('saveQueryFormIncludeFiltersOption', 'aria-checked')) ===
'true';
if (currentIncludeFiltersValue !== includeFilters) {
await testSubjects.click('saveQueryFormIncludeFiltersOption');
}

const currentIncludeTimeFilterValue =
(await testSubjects.getAttribute('saveQueryFormIncludeTimeFilterOption', 'checked')) ===
'true';
(await testSubjects.getAttribute(
'saveQueryFormIncludeTimeFilterOption',
'aria-checked'
)) === 'true';
if (currentIncludeTimeFilterValue !== includeTimeFilter) {
await testSubjects.click('saveQueryFormIncludeTimeFilterOption');
}
Expand Down

0 comments on commit 65dab1e

Please sign in to comment.