Skip to content

Commit

Permalink
Fixing a11y test failure on discover app (elastic#59975) (elastic#77614)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyarm authored and scottybollinger committed Sep 28, 2020
1 parent b731b01 commit 8b50baa
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 64 deletions.
97 changes: 35 additions & 62 deletions test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,14 @@ import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'header', 'share', 'timePicker']);
const retry = getService('retry');
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const inspector = getService('inspector');
const docTable = getService('docTable');
const filterBar = getService('filterBar');
const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
['geo.src', 'IN'],
];

// Failing: See https://github.com/elastic/kibana/issues/59975
describe.skip('Discover', () => {
const testSubjects = getService('testSubjects');
const TEST_COLUMN_NAMES = ['extension', 'geo.src'];

describe('Discover a11y tests', () => {
before(async () => {
await esArchiver.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
Expand All @@ -46,105 +39,85 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

it('main view', async () => {
it('Discover main page', async () => {
await a11y.testAppSnapshot();
});

it('Click save button', async () => {
it('a11y test on save button', async () => {
await PageObjects.discover.clickSaveSearchButton();
await a11y.testAppSnapshot();
});

it('Save search panel', async () => {
it('a11y test on save search panel', async () => {
await PageObjects.discover.inputSavedSearchTitle('a11ySearch');
await a11y.testAppSnapshot();
});

it('Confirm saved search', async () => {
it('a11y test on clicking on confirm save', async () => {
await PageObjects.discover.clickConfirmSavedSearch();
await a11y.testAppSnapshot();
});

it('Click on new to clear the search', async () => {
it('a11y test on click new to reload discover', async () => {
await PageObjects.discover.clickNewSearchButton();
await a11y.testAppSnapshot();
});

it('Open load saved search panel', async () => {
it('a11y test on load saved search panel', async () => {
await PageObjects.discover.openLoadSavedSearchPanel();
await a11y.testAppSnapshot();
await PageObjects.discover.closeLoadSavedSearchPanel();
});

it('Open inspector panel', async () => {
it('a11y test on inspector panel', async () => {
await inspector.open();
await a11y.testAppSnapshot();
await inspector.close();
});

it('Open add filter', async () => {
await PageObjects.discover.openAddFilterPanel();
await a11y.testAppSnapshot();
});

it('Select values for a filter', async () => {
await filterBar.addFilter('extension.raw', 'is one of', 'jpg');
await a11y.testAppSnapshot();
});

it('Load a new search from the panel', async () => {
await PageObjects.discover.clickSaveSearchButton();
await PageObjects.discover.inputSavedSearchTitle('filterSearch');
await PageObjects.discover.clickConfirmSavedSearch();
await PageObjects.discover.openLoadSavedSearchPanel();
await PageObjects.discover.loadSavedSearch('filterSearch');
await a11y.testAppSnapshot();
});

it('click share button', async () => {
it('a11y test on share panel', async () => {
await PageObjects.share.clickShareTopNavButton();
await a11y.testAppSnapshot();
});

it('Open sidebar filter', async () => {
it('a11y test on open sidenav filter', async () => {
await PageObjects.discover.openSidebarFieldFilter();
await a11y.testAppSnapshot();
});

it('Close sidebar filter', async () => {
await PageObjects.discover.closeSidebarFieldFilter();
await a11y.testAppSnapshot();
});

it('Add a field from sidebar', async () => {
it('a11y test on tables with columns view', async () => {
for (const columnName of TEST_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemAdd(columnName);
await PageObjects.discover.clickFieldListItemToggle(columnName);
}
await a11y.testAppSnapshot();
});

it('Add more fields from sidebar', async () => {
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
it('a11y test on save queries popover', async () => {
await PageObjects.discover.clickSavedQueriesPopOver();
await a11y.testAppSnapshot();
});

// Context view test
it('should open context view on a doc', async () => {
await retry.try(async () => {
await docTable.clickRowToggle();
// click the open action
const rowActions = await docTable.getRowActions();
if (!rowActions.length) {
throw new Error('row actions empty, trying again');
}
await rowActions[0].click();
});
it('a11y test on save queries panel', async () => {
await PageObjects.discover.clickCurrentSavedQuery();
await a11y.testAppSnapshot();
});

// Adding rest of the tests after https://github.com/elastic/kibana/issues/53888 is resolved
it('a11y test on toggle include filters option on saved queries panel', async () => {
await PageObjects.discover.setSaveQueryFormTitle('test');
await PageObjects.discover.toggleIncludeFilters();
await a11y.testAppSnapshot();
await PageObjects.discover.saveCurrentSavedQuery();
});

// issue - https://github.com/elastic/kibana/issues/78488
it.skip('a11y test on saved queries list panel', async () => {
await PageObjects.discover.clickSavedQueriesPopOver();
await testSubjects.moveMouseTo(
'saved-query-list-item load-saved-query-test-button saved-query-list-item-selected saved-query-list-item-selected'
);
await testSubjects.find('delete-saved-query-test-button');
await a11y.testAppSnapshot();
});
});
}
39 changes: 37 additions & 2 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider

public async loadSavedSearch(searchName: string) {
await this.openLoadSavedSearchPanel();
const searchLink = await find.byButtonText(searchName);
await searchLink.click();
await testSubjects.click(`savedObjectTitle${searchName.split(' ').join('-')}`);
await header.waitUntilLoadingHasFinished();
}

Expand Down Expand Up @@ -387,6 +386,42 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
return await this.isDiscoverAppOnScreen();
});
}

public async showAllFilterActions() {
await testSubjects.click('showFilterActions');
}

public async clickSavedQueriesPopOver() {
await testSubjects.click('saved-query-management-popover-button');
}

public async clickCurrentSavedQuery() {
await testSubjects.click('saved-query-management-save-button');
}

public async setSaveQueryFormTitle(savedQueryName: string) {
await testSubjects.setValue('saveQueryFormTitle', savedQueryName);
}

public async toggleIncludeFilters() {
await testSubjects.click('saveQueryFormIncludeFiltersOption');
}

public async saveCurrentSavedQuery() {
await testSubjects.click('savedQueryFormSaveButton');
}

public async deleteSavedQuery() {
await testSubjects.click('delete-saved-query-TEST-button');
}

public async confirmDeletionOfSavedQuery() {
await testSubjects.click('confirmModalConfirmButton');
}

public async clearSavedQuery() {
await testSubjects.click('saved-query-management-clear-button');
}
}

return new DiscoverPage();
Expand Down

0 comments on commit 8b50baa

Please sign in to comment.