diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 21:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 21:09:25 +0300 |
commit | 30b8ea126ffffc9bef610d38f8ebcd91bb687aba (patch) | |
tree | 3705b43015a6d3a1fd85864f1fc555383b8e248b /spec/frontend/ml | |
parent | a5519693560d1ac4e120e1afd7d806d13a2d09fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ml')
3 files changed, 294 insertions, 0 deletions
diff --git a/spec/frontend/ml/experiment_tracking/components/__snapshots__/experiment_spec.js.snap b/spec/frontend/ml/experiment_tracking/components/__snapshots__/experiment_spec.js.snap new file mode 100644 index 00000000000..2eba8869535 --- /dev/null +++ b/spec/frontend/ml/experiment_tracking/components/__snapshots__/experiment_spec.js.snap @@ -0,0 +1,223 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ShowExperiment with candidates renders correctly 1`] = ` +<div> + <div + class="gl-alert gl-alert-warning" + > + <svg + aria-hidden="true" + class="gl-icon s16 gl-alert-icon" + data-testid="warning-icon" + role="img" + > + <use + href="#warning" + /> + </svg> + + <div + aria-live="assertive" + class="gl-alert-content" + role="alert" + > + <h2 + class="gl-alert-title" + > + Machine Learning Experiment Tracking is in Incubating Phase + </h2> + + <div + class="gl-alert-body" + > + + GitLab incubates features to explore new use cases. These features are updated regularly, and support is limited + + <a + class="gl-link" + href="https://about.gitlab.com/handbook/engineering/incubation/" + rel="noopener noreferrer" + target="_blank" + > + Learn More + </a> + </div> + + <div + class="gl-alert-actions" + > + <a + class="btn gl-alert-action btn-confirm btn-md gl-button" + href="https://gitlab.com/groups/gitlab-org/-/epics/8560" + > + <!----> + + <!----> + + <span + class="gl-button-text" + > + + Feedback and Updates + + </span> + </a> + </div> + </div> + + <button + aria-label="Dismiss" + class="btn gl-dismiss-btn btn-default btn-sm gl-button btn-default-tertiary btn-icon" + type="button" + > + <!----> + + <svg + aria-hidden="true" + class="gl-button-icon gl-icon s16" + data-testid="close-icon" + role="img" + > + <use + href="#close" + /> + </svg> + + <!----> + </button> + </div> + + <h3> + + Experiment Candidates + + </h3> + + <table + aria-busy="false" + aria-colcount="4" + class="table b-table gl-table gl-mt-0!" + role="table" + > + <!----> + <!----> + <thead + class="" + role="rowgroup" + > + <!----> + <tr + class="" + role="row" + > + <th + aria-colindex="1" + class="" + role="columnheader" + scope="col" + > + <div> + L1 Ratio + </div> + </th> + <th + aria-colindex="2" + class="" + role="columnheader" + scope="col" + > + <div> + Rmse + </div> + </th> + <th + aria-colindex="3" + class="" + role="columnheader" + scope="col" + > + <div> + Auc + </div> + </th> + <th + aria-colindex="4" + class="" + role="columnheader" + scope="col" + > + <div> + Mae + </div> + </th> + </tr> + </thead> + <tbody + role="rowgroup" + > + <!----> + <tr + class="" + role="row" + > + <td + aria-colindex="1" + class="" + role="cell" + > + 0.4 + </td> + <td + aria-colindex="2" + class="" + role="cell" + > + 1 + </td> + <td + aria-colindex="3" + class="" + role="cell" + /> + <td + aria-colindex="4" + class="" + role="cell" + /> + </tr> + <tr + class="" + role="row" + > + <td + aria-colindex="1" + class="" + role="cell" + > + 0.5 + </td> + <td + aria-colindex="2" + class="" + role="cell" + /> + <td + aria-colindex="3" + class="" + role="cell" + > + 0.3 + </td> + <td + aria-colindex="4" + class="" + role="cell" + /> + </tr> + <!----> + <!----> + </tbody> + <!----> + </table> +</div> +`; diff --git a/spec/frontend/ml/experiment_tracking/components/experiment_spec.js b/spec/frontend/ml/experiment_tracking/components/experiment_spec.js new file mode 100644 index 00000000000..af722d77532 --- /dev/null +++ b/spec/frontend/ml/experiment_tracking/components/experiment_spec.js @@ -0,0 +1,44 @@ +import { GlAlert } from '@gitlab/ui'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; +import ShowExperiment from '~/ml/experiment_tracking/components/experiment.vue'; + +describe('ShowExperiment', () => { + let wrapper; + + const createWrapper = (candidates = [], metricNames = [], paramNames = []) => { + return mountExtended(ShowExperiment, { provide: { candidates, metricNames, paramNames } }); + }; + + const findAlert = () => wrapper.findComponent(GlAlert); + + const findEmptyState = () => wrapper.findByText('This Experiment has no logged Candidates'); + + it('shows incubation warning', () => { + wrapper = createWrapper(); + + expect(findAlert().exists()).toBe(true); + }); + + describe('no candidates', () => { + it('shows empty state', () => { + wrapper = createWrapper(); + + expect(findEmptyState().exists()).toBe(true); + }); + }); + + describe('with candidates', () => { + it('renders correctly', () => { + wrapper = createWrapper( + [ + { rmse: 1, l1_ratio: 0.4 }, + { auc: 0.3, l1_ratio: 0.5 }, + ], + ['rmse', 'auc', 'mae'], + ['l1_ratio'], + ); + + expect(wrapper.element).toMatchSnapshot(); + }); + }); +}); diff --git a/spec/frontend/ml/experiment_tracking/components/incubation_alert_spec.js b/spec/frontend/ml/experiment_tracking/components/incubation_alert_spec.js new file mode 100644 index 00000000000..e07a4ed816b --- /dev/null +++ b/spec/frontend/ml/experiment_tracking/components/incubation_alert_spec.js @@ -0,0 +1,27 @@ +import { mount } from '@vue/test-utils'; +import { GlAlert, GlButton } from '@gitlab/ui'; +import IncubationAlert from '~/ml/experiment_tracking/components/incubation_alert.vue'; + +describe('IncubationAlert', () => { + let wrapper; + + const findAlert = () => wrapper.findComponent(GlAlert); + + const findButton = () => wrapper.findComponent(GlButton); + + beforeEach(() => { + wrapper = mount(IncubationAlert); + }); + + it('displays link to issue', () => { + expect(findButton().attributes().href).toBe( + 'https://gitlab.com/groups/gitlab-org/-/epics/8560', + ); + }); + + it('is removed if dismissed', async () => { + await wrapper.find('[aria-label="Dismiss"]').trigger('click'); + + expect(findAlert().exists()).toBe(false); + }); +}); |