summaryrefslogtreecommitdiff
path: root/spec/frontend/pipelines/empty_state_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/frontend/pipelines/empty_state_spec.js
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/frontend/pipelines/empty_state_spec.js')
-rw-r--r--spec/frontend/pipelines/empty_state_spec.js58
1 files changed, 41 insertions, 17 deletions
diff --git a/spec/frontend/pipelines/empty_state_spec.js b/spec/frontend/pipelines/empty_state_spec.js
index 3ebedc9ac87..912bc7a104a 100644
--- a/spec/frontend/pipelines/empty_state_spec.js
+++ b/spec/frontend/pipelines/empty_state_spec.js
@@ -1,24 +1,25 @@
-import { shallowMount } from '@vue/test-utils';
+import { mount } from '@vue/test-utils';
import EmptyState from '~/pipelines/components/pipelines_list/empty_state.vue';
describe('Pipelines Empty State', () => {
let wrapper;
- const findGetStartedButton = () => wrapper.find('[data-testid="get-started-pipelines"]');
- const findInfoText = () => wrapper.find('[data-testid="info-text"]').text();
- const createWrapper = () => {
- wrapper = shallowMount(EmptyState, {
+ const findIllustration = () => wrapper.find('img');
+ const findButton = () => wrapper.find('a');
+
+ const createWrapper = (props = {}) => {
+ wrapper = mount(EmptyState, {
propsData: {
- helpPagePath: 'foo',
- emptyStateSvgPath: 'foo',
+ emptyStateSvgPath: 'foo.svg',
canSetCi: true,
+ ...props,
},
});
};
- describe('renders', () => {
+ describe('when user can configure CI', () => {
beforeEach(() => {
- createWrapper();
+ createWrapper({}, mount);
});
afterEach(() => {
@@ -27,26 +28,49 @@ describe('Pipelines Empty State', () => {
});
it('should render empty state SVG', () => {
- expect(wrapper.find('img').attributes('src')).toBe('foo');
+ expect(findIllustration().attributes('src')).toBe('foo.svg');
});
it('should render empty state header', () => {
- expect(wrapper.find('[data-testid="header-text"]').text()).toBe('Build with confidence');
- });
-
- it('should render a link with provided help path', () => {
- expect(findGetStartedButton().attributes('href')).toBe('foo');
+ expect(wrapper.text()).toContain('Build with confidence');
});
it('should render empty state information', () => {
- expect(findInfoText()).toContain(
+ expect(wrapper.text()).toContain(
'GitLab CI/CD can automatically build, test, and deploy your code. Let GitLab take care of time',
'consuming tasks, so you can spend more time creating',
);
});
+ it('should render button with help path', () => {
+ expect(findButton().attributes('href')).toBe('/help/ci/quick_start/index.md');
+ });
+
it('should render button text', () => {
- expect(findGetStartedButton().text()).toBe('Get started with CI/CD');
+ expect(findButton().text()).toBe('Get started with CI/CD');
+ });
+ });
+
+ describe('when user cannot configure CI', () => {
+ beforeEach(() => {
+ createWrapper({ canSetCi: false }, mount);
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ it('should render empty state SVG', () => {
+ expect(findIllustration().attributes('src')).toBe('foo.svg');
+ });
+
+ it('should render empty state header', () => {
+ expect(wrapper.text()).toBe('This project is not currently set up to run pipelines.');
+ });
+
+ it('should not render a link', () => {
+ expect(findButton().exists()).toBe(false);
});
});
});