Commit a638ee1a authored by Alex Buijs's avatar Alex Buijs

Fix empty state pipelines page

When the runners_availability_section experiment was active
but rendering the control vairant, the empty state pipelines
page would render no templates.

Changelog: fixed
parent 78d0ba50
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue'; import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
import ExperimentTracking from '~/experimentation/experiment_tracking'; import ExperimentTracking from '~/experimentation/experiment_tracking';
import { getExperimentData } from '~/experimentation/utils'; import { isExperimentVariant } from '~/experimentation/utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
export default { export default {
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
return helpPagePath('ci/runners/runners_scope', { anchor: 'shared-runners' }); return helpPagePath('ci/runners/runners_scope', { anchor: 'shared-runners' });
}, },
runnersAvailabilitySectionExperimentEnabled() { runnersAvailabilitySectionExperimentEnabled() {
return Boolean(getExperimentData(RUNNERS_AVAILABILITY_SECTION_EXPERIMENT_NAME)); return isExperimentVariant(RUNNERS_AVAILABILITY_SECTION_EXPERIMENT_NAME);
}, },
}, },
created() { created() {
......
...@@ -134,11 +134,6 @@ describe('Pipelines CI Templates', () => { ...@@ -134,11 +134,6 @@ describe('Pipelines CI Templates', () => {
wrapper = createWrapper({ anyRunnersAvailable: true }, { GitlabExperiment, GlSprintf }); wrapper = createWrapper({ anyRunnersAvailable: true }, { GitlabExperiment, GlSprintf });
}); });
it('renders the templates', () => {
expect(findTestTemplateLinks().exists()).toBe(true);
expect(findTemplateLinks().exists()).toBe(true);
});
it('show the runners available section', () => { it('show the runners available section', () => {
expect(wrapper.text()).toContain(I18N.runners.title); expect(wrapper.text()).toContain(I18N.runners.title);
}); });
...@@ -171,11 +166,6 @@ describe('Pipelines CI Templates', () => { ...@@ -171,11 +166,6 @@ describe('Pipelines CI Templates', () => {
wrapper = createWrapper({ anyRunnersAvailable: false }, { GitlabExperiment, GlButton }); wrapper = createWrapper({ anyRunnersAvailable: false }, { GitlabExperiment, GlButton });
}); });
it('does not render the templates', () => {
expect(findTestTemplateLinks().exists()).toBe(false);
expect(findTemplateLinks().exists()).toBe(false);
});
it('show the no runners available section', () => { it('show the no runners available section', () => {
expect(wrapper.text()).toContain(I18N.noRunners.title); expect(wrapper.text()).toContain(I18N.noRunners.title);
}); });
...@@ -192,4 +182,25 @@ describe('Pipelines CI Templates', () => { ...@@ -192,4 +182,25 @@ describe('Pipelines CI Templates', () => {
}); });
}); });
}); });
describe.each`
experimentVariant | anyRunnersAvailable | templatesRendered
${'control'} | ${true} | ${true}
${'control'} | ${false} | ${true}
${'candidate'} | ${true} | ${true}
${'candidate'} | ${false} | ${false}
`(
'when the runners_availability_section experiment variant is $experimentVariant and runners are available: $anyRunnersAvailable',
({ experimentVariant, anyRunnersAvailable, templatesRendered }) => {
beforeEach(() => {
stubExperiments({ runners_availability_section: experimentVariant });
wrapper = createWrapper({ anyRunnersAvailable });
});
it(`renders the templates: ${templatesRendered}`, () => {
expect(findTestTemplateLinks().exists()).toBe(templatesRendered);
expect(findTemplateLinks().exists()).toBe(templatesRendered);
});
},
);
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment