[8.16] [ML] Trained models: Accessibility tests (#197446) (#197687)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ML] Trained models: Accessibility tests
(#197446)](https://github.com/elastic/kibana/pull/197446)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Jaszczurek","email":"92210485+rbrtj@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-24T16:22:53Z","message":"[ML]
Trained models: Accessibility tests (#197446)\n\n##
Summary\r\n\r\nAccessibility tests for Trained models
page.","sha":"f279b39bde0136df1efb0b9cc4e97af68be69896","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["non-issue",":ml","release_note:skip","v9.0.0","Team:ML","v8.16.0","backport:version","v8.17.0"],"title":"[ML]
Trained models: Accessibility
tests","number":197446,"url":"https://github.com/elastic/kibana/pull/197446","mergeCommit":{"message":"[ML]
Trained models: Accessibility tests (#197446)\n\n##
Summary\r\n\r\nAccessibility tests for Trained models
page.","sha":"f279b39bde0136df1efb0b9cc4e97af68be69896"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197446","number":197446,"mergeCommit":{"message":"[ML]
Trained models: Accessibility tests (#197446)\n\n##
Summary\r\n\r\nAccessibility tests for Trained models
page.","sha":"f279b39bde0136df1efb0b9cc4e97af68be69896"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-25 05:08:42 +11:00 committed by GitHub
parent a3c1646aec
commit b0af74f1c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 77 additions and 7 deletions

View file

@ -12,13 +12,7 @@ import { EuiIcon, EuiToolTip } from '@elastic/eui';
export const HelpIcon: FC<{ content: ReactNode | string }> = ({ content }) => {
return (
<EuiToolTip position="top" content={content}>
<EuiIcon
tabIndex={0}
type="questionInCircle"
color={'subdued'}
className="eui-alignTop"
size="s"
/>
<EuiIcon type="questionInCircle" color={'subdued'} className="eui-alignTop" size="s" />
</EuiToolTip>
);
};

View file

@ -13,5 +13,6 @@ export default ({ loadTestFile }: FtrProviderContext): void => {
loadTestFile(require.resolve('./ml_anomaly_detection'));
loadTestFile(require.resolve('./transform'));
loadTestFile(require.resolve('./lens'));
loadTestFile(require.resolve('./ml_trained_models'));
});
};

View file

@ -0,0 +1,71 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const a11y = getService('a11y');
const ml = getService('ml');
const testModelId = 'lang_ident_model_1';
describe('machine learning trained models page Accessibility', function () {
before(async () => {
await ml.securityCommon.createMlRoles();
await ml.securityCommon.createMlUsers();
await ml.api.createIngestPipeline(testModelId);
await ml.securityUI.loginAsMlPowerUser();
await ml.navigation.navigateToMl();
await ml.navigation.navigateToTrainedModels();
});
after(async () => {
await ml.api.deleteIngestPipeline(testModelId);
await ml.securityCommon.cleanMlUsers();
await ml.securityCommon.cleanMlRoles();
await ml.securityUI.logout();
});
it('trained models list', async () => {
await a11y.testAppSnapshot();
});
it('trained model details', async () => {
await ml.trainedModelsTable.ensureRowIsExpanded(testModelId);
await a11y.testAppSnapshot();
await ml.testExecution.logTestStep('Assert the Details tab content');
await ml.trainedModelsTable.assertDetailsTabContent();
await a11y.testAppSnapshot();
await ml.testExecution.logTestStep('Assert the Models Map tab content');
await ml.trainedModelsTable.assertModelsMapTabContent();
await a11y.testAppSnapshot();
await ml.testExecution.logTestStep('Assert the Inference Config tab content');
await ml.trainedModelsTable.assertInferenceConfigTabContent();
await a11y.testAppSnapshot();
await ml.testExecution.logTestStep('Assert the Stats tab content');
await ml.trainedModelsTable.assertStatsTabContent();
await a11y.testAppSnapshot();
await ml.testExecution.logTestStep('Assert the Pipelines tab content');
await ml.trainedModelsTable.assertPipelinesTabContent();
await a11y.testAppSnapshot();
});
it('add trained model flyout', async () => {
await ml.trainedModelsFlyout.open();
await a11y.testAppSnapshot();
await ml.trainedModelsFlyout.changeTab('manualDownload');
await a11y.testAppSnapshot();
});
});
}

View file

@ -93,6 +93,10 @@ export function TrainedModelsFlyoutProvider({ getService }: FtrProviderContext)
});
},
async changeTab(tab: AddModelFlyoutTabId) {
await testSubjects.click(`mlAddTrainedModelFlyoutTab ${tab}`);
},
async assertElandPythonClientCodeBlocks() {
expect(await testSubjects.getVisibleText('mlElandPipInstallCodeBlock')).to.match(
/python -m pip install eland/