Skip to content

Commit

Permalink
[ML] Adds a11y tests for ML plugin (#88323)
Browse files Browse the repository at this point in the history
* [ML] Adds a11y tests for ML plugin

* [ML] Edits to a11y tests following review
  • Loading branch information
peteharverson authored Jan 15, 2021
1 parent b362736 commit c0a833d
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export const DataGrid: FC<Props> = memo(
})}
>
<EuiButtonEmpty
aria-checked={chartsVisible}
aria-pressed={chartsVisible}
className={`euiDataGrid__controlBtn${
chartsVisible ? ' euiDataGrid__controlBtn--active' : ''
}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export const MultiSelectPicker: FC<{
return (
<EuiFilterGroup data-test-subj={dataTestSubj}>
<EuiPopover
ownFocus
data-test-subj={`${dataTestSubj}-popover`}
id="popoverExampleMultiSelect"
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const AdditionalSection: FC<Props> = ({ additionalExpanded, setAdditional
<Fragment>
<EuiSpacer />
<EuiAccordion
id="advanced-section"
id="additional-section"
buttonContent={buttonContent}
onToggle={setAdditionalExpanded}
initialIsOpen={additionalExpanded}
Expand Down
81 changes: 44 additions & 37 deletions x-pack/plugins/ml/readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Documentation for ML UI developers

This plugin provides access to the machine learning features provided by
This plugin provides access to the machine learning features provided by
Elastic.

## Requirements

To use machine learning features, you must have a Platinum or Enterprise license
or a free 14-day Trial. File Data Visualizer requires a Basic license. For more
info, refer to
To use machine learning features, you must have a Platinum or Enterprise license
or a free 14-day Trial. File Data Visualizer requires a Basic license. For more
info, refer to
[Set up machine learning features](https://www.elastic.co/guide/en/machine-learning/master/setup.html).

## Setup local environment
Expand All @@ -16,7 +16,7 @@ info, refer to

1. Fork and clone the [Kibana repo](https://github.com/elastic/kibana).

1. Install `nvm`, `node`, `yarn` (for example, by using Homebrew). See
1. Install `nvm`, `node`, `yarn` (for example, by using Homebrew). See
[Install dependencies](https://www.elastic.co/guide/en/kibana/master/development-getting-started.html#_install_dependencies).

1. Make sure that Elasticsearch is deployed and running on localhost:9200.
Expand All @@ -25,45 +25,44 @@ info, refer to

1. Fetch the latest changes from the repository.

1. Checkout the branch of the version you want to use. For example, if you want
1. Checkout the branch of the version you want to use. For example, if you want
to use a 7.9 version, run `git checkout 7.9`.

1. Run `nvm use`. The response shows the Node version that the environment uses.
If you need to update your Node version, the response message contains the
1. Run `nvm use`. The response shows the Node version that the environment uses.
If you need to update your Node version, the response message contains the
command you need to run to do it.

1. Run `yarn kbn bootstrap`. It takes all the dependencies in the code and
installs/checks them. It is recommended to use it every time when you switch
1. Run `yarn kbn bootstrap`. It takes all the dependencies in the code and
installs/checks them. It is recommended to use it every time when you switch
between branches.

1. Make a copy of `kibana.yml` and save as `kibana.dev.yml`. (Git will not track
the changes in `kibana.dev.yml` but yarn will use it.)

1. Provide the appropriate password and user name in `kibana.dev.yml`.

1. Run `yarn start` to start Kibana.

1. Go to http://localhost:560x/xxx (check the terminal message for the exact
1. Go to http://localhost:560x/xxx (check the terminal message for the exact
path).

For more details, refer to this [getting started](https://www.elastic.co/guide/en/kibana/master/development-getting-started.html) page.

### Adding sample data to Kibana

Kibana has sample data sets that you can add to your setup so that you can test
Kibana has sample data sets that you can add to your setup so that you can test
different configurations on sample data.

1. Click the Elastic logo in the upper left hand corner of your browser to
1. Click the Elastic logo in the upper left hand corner of your browser to
navigate to the Kibana home page.

1. Click *Load a data set and a Kibana dashboard*.
1. Click _Load a data set and a Kibana dashboard_.

1. Pick a data set or feel free to click *Add* on all of the available sample
1. Pick a data set or feel free to click _Add_ on all of the available sample
data sets.

These data sets are now ready be analyzed in ML jobs in Kibana.


## Running tests

### Jest tests
Expand All @@ -72,69 +71,77 @@ Documentation: https://www.elastic.co/guide/en/kibana/current/development-tests.

Run the test following jest tests from `kibana/x-pack/plugins/ml`.

New snapshots, all plugins:
New snapshots, all plugins:

```
yarn test:jest
```
Update snapshots for the ML plugin:

Update snapshots for the ML plugin:

```
yarn test:jest -u
```

Update snapshots for a specific directory only:
Update snapshots for a specific directory only:

```
yarn test:jest public/application/settings/filter_lists
```

Run tests with verbose output:
Run tests with verbose output:

```
yarn test:jest --verbose
```

### Functional tests

Before running the test server, make sure to quit all other instances of
Before running the test server, make sure to quit all other instances of
Elasticsearch.

Run the following commands from the `x-pack` directory and use separate terminals
for test server and test runner. The test server command starts an Elasticsearch
and Kibana instance that the tests will be run against.

1. Functional UI tests with `Trial` license (default config):
1. Functional UI tests with `Trial` license (default config):

node scripts/functional_tests_server.js
node scripts/functional_test_runner.js --include-tag mlqa

ML functional `Trial` license tests are located in `x-pack/test/functional/apps/ml`.

1. Functional UI tests with `Basic` license:
1. Functional UI tests with `Basic` license:

node scripts/functional_tests_server.js --config test/functional_basic/config.ts
node scripts/functional_test_runner.js --config test/functional_basic/config.ts --include-tag mlqa

ML functional `Basic` license tests are located in `x-pack/test/functional_basic/apps/ml`.

1. API integration tests with `Trial` license:
1. API integration tests with `Trial` license:

node scripts/functional_tests_server.js
node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag mlqa
ML API integration `Trial` license tests are located in `x-pack/test/api_integration/apis/ml`.
node scripts/functional_tests_server.js
node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag mlqa

1. API integration tests with `Basic` license:
ML API integration `Trial` license tests are located in `x-pack/test/api_integration/apis/ml`.

node scripts/functional_tests_server.js --config test/api_integration_basic/config.ts
node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag mlqa
ML API integration `Basic` license tests are located in `x-pack/test/api_integration_basic/apis/ml`.
1. API integration tests with `Basic` license:

## Shared functions
node scripts/functional_tests_server.js --config test/api_integration_basic/config.ts
node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag mlqa

ML API integration `Basic` license tests are located in `x-pack/test/api_integration_basic/apis/ml`.

1. Accessibility tests:

We maintain a suite of accessibility tests (you may see them referred to elsewhere as `a11y` tests). These tests render each of our pages and ensure that the inputs and other elements contain the attributes necessary to ensure all users are able to make use of ML (for example, users relying on screen readers).

node scripts/functional_tests_server --config test/accessibility/config.ts
node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=ml

ML accessibility tests are located in `x-pack/test/accessibility/app`.

## Shared functions

You can find the ML shared functions in the following files in GitHub:

Expand All @@ -152,7 +159,7 @@ These functions are shared from the root of the ML plugin, you can import them w
import { MlPluginSetup } from '../../../../ml/server';
```

or
or

```
import { ANOMALY_SEVERITY } from '../../ml/common';
Expand Down
Loading

0 comments on commit c0a833d

Please sign in to comment.