Skip to content

Commit

Permalink
[ML] Stabilize accessibility tests for data frame analytics pages (#8…
Browse files Browse the repository at this point in the history
…9423) (#89691)

* [ML] Stabilize accessibility tests for data frame analytics pages

* [ML] Remove snapshot test after opening index pattern modal

* [ML] Remove snapshot test when index pattern modal opens

* [ML] Add back snapshot test at index pattern modal step
  • Loading branch information
peteharverson authored Jan 29, 2021
1 parent d26a738 commit c6d8e34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 1 addition & 5 deletions test/accessibility/services/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ export function A11yProvider({ getService }: FtrProviderContext) {
exclude: ([] as string[])
.concat(excludeTestSubj || [])
.map((ts) => [testSubjectToCss(ts)])
.concat([
[
'.leaflet-vega-container[role="graphics-document"][aria-roledescription="visualization"]',
],
]),
.concat([['[role="graphics-document"][aria-roledescription="visualization"]']]),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Fragment, useState, useEffect } from 'react';
import { PropTypes } from 'prop-types';
import React, { Fragment, useState, useEffect, useMemo } from 'react';
import {
htmlIdGenerator,
EuiCheckbox,
EuiSearchBar,
EuiFlexGroup,
Expand All @@ -25,6 +25,7 @@ import {
EuiTableRowCellCheckbox,
EuiTableHeaderMobile,
} from '@elastic/eui';
import { PropTypes } from 'prop-types';

import { Pager } from '@elastic/eui/lib/services';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -179,14 +180,16 @@ export function CustomSelectionTable({
return indexOfUnselectedItem === -1;
}

const selectAllCheckboxId = useMemo(() => htmlIdGenerator()(), []);

function renderSelectAll(mobile) {
const selectAll = i18n.translate('xpack.ml.jobSelector.customTable.selectAllCheckboxLabel', {
defaultMessage: 'Select all',
});

return (
<EuiCheckbox
id="selectAllCheckbox"
id={`${mobile ? `mobile-` : ''}${selectAllCheckboxId}`}
label={mobile ? selectAll : null}
checked={areAllItemsSelected()}
onChange={toggleAll}
Expand Down
6 changes: 4 additions & 2 deletions x-pack/test/accessibility/apps/ml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export default function ({ getService }: FtrProviderContext) {
const a11y = getService('a11y');
const ml = getService('ml');

// flaky tests, see https://github.com/elastic/kibana/issues/88592
describe.skip('ml', () => {
describe('ml', () => {
const esArchiver = getService('esArchiver');

before(async () => {
Expand Down Expand Up @@ -239,6 +238,7 @@ export default function ({ getService }: FtrProviderContext) {
});

it('data frame analytics create job select index pattern modal', async () => {
await ml.navigation.navigateToMl();
await ml.navigation.navigateToDataFrameAnalytics();
await ml.dataFrameAnalytics.startAnalyticsCreation();
await a11y.testAppSnapshot();
Expand All @@ -261,6 +261,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.assertSourceDataPreviewExists();
await ml.testExecution.logTestStep('enables the source data preview histogram charts');
await ml.dataFrameAnalyticsCreation.enableSourceDataPreviewHistogramCharts();
await ml.testExecution.logTestStep('displays the include fields selection');
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
await a11y.testAppSnapshot();
});

Expand Down

0 comments on commit c6d8e34

Please sign in to comment.