summaryrefslogtreecommitdiff
path: root/spec/frontend/pages/projects/learn_gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/pages/projects/learn_gitlab')
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap16
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap569
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js45
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js75
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_info_card_spec.js57
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/mock_data.js42
6 files changed, 647 insertions, 157 deletions
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap
index c9141d13a46..1c1327e7a4e 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap
+++ b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap
@@ -4,7 +4,7 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
<ul>
<li>
<span>
- Create a repository
+ Create or import a repository
</span>
</li>
<li>
@@ -14,7 +14,11 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
</li>
<li>
<span>
- Set-up CI/CD
+ <gl-link-stub
+ href="http://example.com/"
+ >
+ Set up CI/CD
+ </gl-link-stub>
</span>
</li>
<li>
@@ -22,7 +26,7 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
<gl-link-stub
href="http://example.com/"
>
- Start a free trial of GitLab Gold
+ Start a free Ultimate trial
</gl-link-stub>
</span>
</li>
@@ -40,7 +44,7 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
<gl-link-stub
href="http://example.com/"
>
- Enable require merge approvals
+ Add merge request approval
</gl-link-stub>
</span>
</li>
@@ -49,7 +53,7 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
<gl-link-stub
href="http://example.com/"
>
- Submit a merge request (MR)
+ Submit a merge request
</gl-link-stub>
</span>
</li>
@@ -58,7 +62,7 @@ exports[`Learn GitLab Design A should render the loading state 1`] = `
<gl-link-stub
href="http://example.com/"
>
- Run a Security scan using CI/CD
+ Run a security scan
</gl-link-stub>
</span>
</li>
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap
index 85e3b675e5b..dd899b93302 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap
+++ b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap
@@ -1,66 +1,519 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Learn GitLab Design B should render the loading state 1`] = `
-<ul>
- <li>
- <span>
- Create a repository
- </span>
- </li>
- <li>
- <span>
- Invite your colleagues
- </span>
- </li>
- <li>
- <span>
- Set-up CI/CD
- </span>
- </li>
- <li>
- <span>
- <gl-link-stub
- href="http://example.com/"
+exports[`Learn GitLab Design B renders correctly 1`] = `
+<div>
+ <div
+ class="row"
+ >
+ <div
+ class="gl-mb-7 col-md-8 col-lg-7"
+ >
+ <h1
+ class="gl-font-size-h1"
>
- Start a free trial of GitLab Gold
- </gl-link-stub>
- </span>
- </li>
- <li>
- <span>
- <gl-link-stub
- href="http://example.com/"
+ Learn GitLab
+ </h1>
+
+ <p
+ class="gl-text-gray-700 gl-mb-0"
>
- Add code owners
- </gl-link-stub>
- </span>
- </li>
- <li>
- <span>
- <gl-link-stub
- href="http://example.com/"
+ Ready to get started with GitLab? Follow these steps to set up your workspace, plan and commit changes, and deploy your project.
+ </p>
+ </div>
+ </div>
+
+ <div
+ class="gl-mb-3"
+ >
+ <p
+ class="gl-text-gray-500 gl-mb-2"
+ data-testid="completion-percentage"
+ >
+ 25% completed
+ </p>
+
+ <div
+ class="progress"
+ max="8"
+ value="2"
+ >
+ <div
+ aria-valuemax="8"
+ aria-valuemin="0"
+ aria-valuenow="2"
+ class="progress-bar"
+ role="progressbar"
+ style="width: 25%;"
>
- Enable require merge approvals
- </gl-link-stub>
- </span>
- </li>
- <li>
- <span>
- <gl-link-stub
- href="http://example.com/"
+ <!---->
+ </div>
+ </div>
+ </div>
+
+ <h2
+ class="gl-font-lg gl-mb-3"
+ >
+ Set up your workspace
+ </h2>
+
+ <p
+ class="gl-text-gray-700 gl-mb-6"
+ >
+ Complete these tasks first so you can enjoy GitLab's features to their fullest:
+ </p>
+
+ <div
+ class="row row-cols-2 row-cols-md-3 row-cols-lg-4"
+ >
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
>
- Submit a merge request (MR)
- </gl-link-stub>
- </span>
- </li>
- <li>
- <span>
- <gl-link-stub
- href="http://example.com/"
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <svg
+ aria-hidden="true"
+ class="gl-text-green-500 gl-icon s16"
+ data-testid="completed-icon"
+ >
+ <use
+ href="#check-circle-filled"
+ />
+ </svg>
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Invite your colleagues
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ GitLab works best as a team. Invite your colleague to enjoy all features.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Invite your colleagues
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
>
- Run a Security scan using CI/CD
- </gl-link-stub>
- </span>
- </li>
-</ul>
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <svg
+ aria-hidden="true"
+ class="gl-text-green-500 gl-icon s16"
+ data-testid="completed-icon"
+ >
+ <use
+ href="#check-circle-filled"
+ />
+ </svg>
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Create or import a repository
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Create or import your first repository into your new project.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Create or import a repository
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <!---->
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Set up CI/CD
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Save time by automating your integration and deployment tasks.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Set-up CI/CD
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <!---->
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Start a free Ultimate trial
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Try all GitLab features for 30 days, no credit card required.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Try GitLab Ultimate for free
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <span
+ class="gl-text-gray-500 gl-font-sm gl-font-style-italic"
+ data-testid="trial-only"
+ >
+ Trial only
+ </span>
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Add code owners
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Prevent unexpected changes to important assets by assigning ownership of files and paths.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Add code owners
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <span
+ class="gl-text-gray-500 gl-font-sm gl-font-style-italic"
+ data-testid="trial-only"
+ >
+ Trial only
+ </span>
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Add merge request approval
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Route code reviews to the right reviewers, every time.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Enable require merge approvals
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+ </div>
+
+ <h2
+ class="gl-font-lg gl-mb-3"
+ >
+ Plan and execute
+ </h2>
+
+ <p
+ class="gl-text-gray-700 gl-mb-6"
+ >
+ Create a workflow for your new workspace, and learn how GitLab features work together:
+ </p>
+
+ <div
+ class="row row-cols-2 row-cols-md-3 row-cols-lg-4"
+ >
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <!---->
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Submit a merge request
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Review and edit proposed changes to source code.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Submit a merge request (MR)
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+ </div>
+
+ <h2
+ class="gl-font-lg gl-mb-3"
+ >
+ Deploy
+ </h2>
+
+ <p
+ class="gl-text-gray-700 gl-mb-6"
+ >
+ Use your new GitLab workflow to deploy your application, monitor its health, and keep it secure:
+ </p>
+
+ <div
+ class="row row-cols-2 row-cols-lg-4 g-2 g-lg-3"
+ >
+ <div
+ class="col gl-mb-6"
+ >
+ <div
+ class="gl-card gl-pt-0"
+ >
+ <!---->
+
+ <div
+ class="gl-card-body"
+ >
+ <div
+ class="gl-text-right gl-h-5"
+ >
+ <!---->
+ </div>
+
+ <div
+ class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
+ >
+ <img
+ src="http://example.com/images/illustration.svg"
+ />
+
+ <h6>
+ Run a security scan
+ </h6>
+
+ <p
+ class="gl-font-sm gl-text-gray-700"
+ >
+ Scan your code to uncover vulnerabilities before deploying.
+ </p>
+
+ <a
+ class="gl-link"
+ href="http://example.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Run a Security scan
+ </a>
+ </div>
+ </div>
+
+ <!---->
+ </div>
+ </div>
+ </div>
+</div>
`;
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js
index ddc5339e7e0..2154358de51 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js
+++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js
@@ -1,41 +1,6 @@
import { shallowMount } from '@vue/test-utils';
-import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import LearnGitlabA from '~/pages/projects/learn_gitlab/components/learn_gitlab_a.vue';
-
-const TEST_ACTIONS = {
- gitWrite: {
- url: 'http://example.com/',
- completed: true,
- },
- userAdded: {
- url: 'http://example.com/',
- completed: true,
- },
- pipelineCreated: {
- url: 'http://example.com/',
- completed: true,
- },
- trialStarted: {
- url: 'http://example.com/',
- completed: false,
- },
- codeOwnersEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
- requiredMrApprovalsEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
- mergeRequestCreated: {
- url: 'http://example.com/',
- completed: false,
- },
- securityScanEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
-};
+import { testActions } from './mock_data';
describe('Learn GitLab Design A', () => {
let wrapper;
@@ -46,13 +11,7 @@ describe('Learn GitLab Design A', () => {
});
const createWrapper = () => {
- wrapper = extendedWrapper(
- shallowMount(LearnGitlabA, {
- propsData: {
- actions: TEST_ACTIONS,
- },
- }),
- );
+ wrapper = shallowMount(LearnGitlabA, { propsData: { actions: testActions } });
};
it('should render the loading state', () => {
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js
index be4f5768402..fbb989fae32 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js
+++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js
@@ -1,63 +1,38 @@
-import { shallowMount } from '@vue/test-utils';
-import { extendedWrapper } from 'helpers/vue_test_utils_helper';
-import LearnGitlabA from '~/pages/projects/learn_gitlab/components/learn_gitlab_a.vue';
-
-const TEST_ACTIONS = {
- gitWrite: {
- url: 'http://example.com/',
- completed: true,
- },
- userAdded: {
- url: 'http://example.com/',
- completed: true,
- },
- pipelineCreated: {
- url: 'http://example.com/',
- completed: true,
- },
- trialStarted: {
- url: 'http://example.com/',
- completed: false,
- },
- codeOwnersEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
- requiredMrApprovalsEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
- mergeRequestCreated: {
- url: 'http://example.com/',
- completed: false,
- },
- securityScanEnabled: {
- url: 'http://example.com/',
- completed: false,
- },
-};
+import { GlProgressBar } from '@gitlab/ui';
+import { mount } from '@vue/test-utils';
+import LearnGitlabB from '~/pages/projects/learn_gitlab/components/learn_gitlab_b.vue';
+import { testActions } from './mock_data';
describe('Learn GitLab Design B', () => {
let wrapper;
+ const createWrapper = () => {
+ wrapper = mount(LearnGitlabB, { propsData: { actions: testActions } });
+ };
+
+ beforeEach(() => {
+ createWrapper();
+ });
+
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
- const createWrapper = () => {
- wrapper = extendedWrapper(
- shallowMount(LearnGitlabA, {
- propsData: {
- actions: TEST_ACTIONS,
- },
- }),
- );
- };
+ it('renders correctly', () => {
+ expect(wrapper.element).toMatchSnapshot();
+ });
- it('should render the loading state', () => {
- createWrapper();
+ it('renders the progress percentage', () => {
+ const text = wrapper.find('[data-testid="completion-percentage"]').text();
- expect(wrapper.element).toMatchSnapshot();
+ expect(text).toEqual('25% completed');
+ });
+
+ it('renders the progress bar with correct values', () => {
+ const progressBar = wrapper.find(GlProgressBar);
+
+ expect(progressBar.attributes('value')).toBe('2');
+ expect(progressBar.attributes('max')).toBe('8');
});
});
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_info_card_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_info_card_spec.js
new file mode 100644
index 00000000000..ad4bc826a9d
--- /dev/null
+++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_info_card_spec.js
@@ -0,0 +1,57 @@
+import { shallowMount } from '@vue/test-utils';
+import LearnGitlabInfoCard from '~/pages/projects/learn_gitlab/components/learn_gitlab_info_card.vue';
+
+const defaultProps = {
+ title: 'Create Repository',
+ description: 'Some description',
+ actionLabel: 'Create Repository now',
+ url: 'https://example.com',
+ completed: false,
+ svg: 'https://example.com/illustration.svg',
+};
+
+describe('Learn GitLab Info Card', () => {
+ let wrapper;
+
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ const createWrapper = (props = {}) => {
+ wrapper = shallowMount(LearnGitlabInfoCard, {
+ propsData: { ...defaultProps, ...props },
+ });
+ };
+
+ it('renders no icon when not completed', () => {
+ createWrapper({ completed: false });
+
+ expect(wrapper.find('[data-testid="completed-icon"]').exists()).toBe(false);
+ });
+
+ it('renders the completion icon when completed', () => {
+ createWrapper({ completed: true });
+
+ expect(wrapper.find('[data-testid="completed-icon"]').exists()).toBe(true);
+ });
+
+ it('renders no trial only when it is not required', () => {
+ createWrapper();
+
+ expect(wrapper.find('[data-testid="trial-only"]').exists()).toBe(false);
+ });
+
+ it('renders trial only when trial is required', () => {
+ createWrapper({ trialRequired: true });
+
+ expect(wrapper.find('[data-testid="trial-only"]').exists()).toBe(true);
+ });
+
+ it('renders completion icon when completed a trial-only feature', () => {
+ createWrapper({ trialRequired: true, completed: true });
+
+ expect(wrapper.find('[data-testid="trial-only"]').exists()).toBe(false);
+ expect(wrapper.find('[data-testid="completed-icon"]').exists()).toBe(true);
+ });
+});
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js b/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js
new file mode 100644
index 00000000000..caac667e2b1
--- /dev/null
+++ b/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js
@@ -0,0 +1,42 @@
+export const testActions = {
+ gitWrite: {
+ url: 'http://example.com/',
+ completed: true,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ userAdded: {
+ url: 'http://example.com/',
+ completed: true,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ pipelineCreated: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ trialStarted: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ codeOwnersEnabled: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ requiredMrApprovalsEnabled: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ mergeRequestCreated: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+ securityScanEnabled: {
+ url: 'http://example.com/',
+ completed: false,
+ svg: 'http://example.com/images/illustration.svg',
+ },
+};