Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Trained models: Accessibility tests #197446

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
};
1 change: 1 addition & 0 deletions x-pack/test/accessibility/apps/group2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
};
71 changes: 71 additions & 0 deletions x-pack/test/accessibility/apps/group2/ml_trained_models.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down