Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
befd332f
Commit
befd332f
authored
Feb 11, 2022
by
Serhii Yarynovskyi
Committed by
Jacques Erasmus
Feb 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tracking test for change_continuous_onboarding_link_urls experiment
parent
3edf062f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
5 deletions
+103
-5
ee/spec/features/uncompleted_learn_gitlab_link_spec.rb
ee/spec/features/uncompleted_learn_gitlab_link_spec.rb
+78
-0
spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js
...learn_gitlab/components/learn_gitlab_section_link_spec.js
+25
-5
No files found.
ee/spec/features/uncompleted_learn_gitlab_link_spec.rb
0 → 100644
View file @
befd332f
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Uncompleted learn gitlab link'
,
:feature
,
:js
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
name:
LearnGitlab
::
Project
::
PROJECT_NAME
,
namespace:
user
.
namespace
)
}
let_it_be
(
:namespace
)
{
project
.
namespace
}
context
'change_continuous_onboarding_link_urls experiment'
do
before
do
allow_next_instance_of
(
LearnGitlab
::
Project
)
do
|
learn_gitlab
|
allow
(
learn_gitlab
).
to
receive
(
:available?
).
and_return
(
true
)
end
end
context
'when control'
do
before
do
create
(
:onboarding_progress
,
namespace:
namespace
,
issue_created_at:
Date
.
yesterday
,
git_write_at:
Date
.
yesterday
,
pipeline_created_at:
Date
.
yesterday
,
merge_request_created_at:
Date
.
yesterday
,
user_added_at:
Date
.
yesterday
,
security_scan_enabled_at:
Date
.
yesterday
)
stub_experiments
(
change_continuous_onboarding_link_urls: :control
)
end
it
'renders correct completed sections'
do
sign_in
(
user
)
visit
namespace_project_learn_gitlab_path
(
namespace
,
project
)
expect_completed_section
(
'Create an issue'
)
expect_completed_section
(
'Create or import a repository'
)
expect_completed_section
(
'Set up CI/CD'
)
expect_completed_section
(
'Submit a merge request'
)
expect_completed_section
(
'Invite your colleagues'
)
expect_completed_section
(
'Run a Security scan using CI/CD'
)
end
end
context
'when candidate'
do
before
do
create
(
:onboarding_progress
,
namespace:
namespace
)
stub_experiments
(
change_continuous_onboarding_link_urls: :candidate
)
end
it
'renders correct links'
do
sign_in
(
user
)
visit
namespace_project_learn_gitlab_path
(
namespace
,
project
)
issue_link
=
find_link
(
'Create an issue'
)
expect_correct_candidate_link
(
issue_link
,
project_issues_path
(
project
))
expect_correct_candidate_link
(
find_link
(
'Create or import a repository'
),
project_path
(
project
))
expect_correct_candidate_link
(
find_link
(
'Set up CI/CD'
),
project_pipelines_path
(
project
))
expect_correct_candidate_link
(
find_link
(
'Submit a merge request'
),
project_merge_requests_path
(
project
))
expect_correct_candidate_link
(
find_link
(
'Invite your colleagues'
),
URI
(
project_members_url
(
project
)).
path
)
expect_correct_candidate_link
(
find_link
(
'Run a Security scan using CI/CD'
),
project_security_configuration_path
(
project
))
issue_link
.
click
expect
(
page
).
to
have_current_path
(
project_issues_path
(
project
))
end
end
end
def
expect_completed_section
(
text
)
expect
(
page
).
to
have_no_link
(
text
)
expect
(
page
).
to
have_css
(
'.gl-text-green-500'
,
text:
text
)
end
def
expect_correct_candidate_link
(
link
,
path
)
expect
(
link
[
'href'
]).
to
match
(
path
)
expect
(
link
[
'data-testid'
]).
to
eq
(
'uncompleted-learn-gitlab-link'
)
end
end
spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js
View file @
befd332f
...
@@ -33,6 +33,8 @@ describe('Learn GitLab Section Link', () => {
...
@@ -33,6 +33,8 @@ describe('Learn GitLab Section Link', () => {
const
openInviteMembesrModalLink
=
()
=>
const
openInviteMembesrModalLink
=
()
=>
wrapper
.
find
(
'
[data-testid="invite-for-help-continuous-onboarding-experiment-link"]
'
);
wrapper
.
find
(
'
[data-testid="invite-for-help-continuous-onboarding-experiment-link"]
'
);
const
findUncompletedLink
=
()
=>
wrapper
.
find
(
'
[data-testid="uncompleted-learn-gitlab-link"]
'
);
it
(
'
renders no icon when not completed
'
,
()
=>
{
it
(
'
renders no icon when not completed
'
,
()
=>
{
createWrapper
(
undefined
,
{
completed
:
false
});
createWrapper
(
undefined
,
{
completed
:
false
});
...
@@ -57,12 +59,30 @@ describe('Learn GitLab Section Link', () => {
...
@@ -57,12 +59,30 @@ describe('Learn GitLab Section Link', () => {
expect
(
wrapper
.
find
(
'
[data-testid="trial-only"]
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
[data-testid="trial-only"]
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders doc links with blank target
'
,
()
=>
{
describe
(
'
doc links
'
,
()
=>
{
createWrapper
(
'
securityScanEnabled
'
,
docLinkProps
);
beforeEach
(()
=>
{
const
linkElement
=
wrapper
.
find
(
'
[data-testid="uncompleted-learn-gitlab-link"]
'
);
createWrapper
(
'
securityScanEnabled
'
,
docLinkProps
);
});
it
(
'
renders links with blank target
'
,
()
=>
{
const
linkElement
=
findUncompletedLink
();
expect
(
linkElement
.
exists
()).
toBe
(
true
);
expect
(
linkElement
.
attributes
(
'
target
'
)).
toEqual
(
'
_blank
'
);
});
it
(
'
tracks the click
'
,
()
=>
{
const
trackingSpy
=
mockTracking
(
'
_category_
'
,
wrapper
.
element
,
jest
.
spyOn
);
findUncompletedLink
().
trigger
(
'
click
'
);
expect
(
linkElement
.
exists
()).
toBe
(
true
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
click_link
'
,
{
expect
(
linkElement
.
attributes
(
'
target
'
)).
toEqual
(
'
_blank
'
);
label
:
'
Run a Security scan using CI/CD
'
,
property
:
'
Growth::Conversion::Experiment::LearnGitLab
'
,
});
unmockTracking
();
});
});
});
describe
(
'
rendering a link to open the invite_members modal instead of a regular link
'
,
()
=>
{
describe
(
'
rendering a link to open the invite_members modal instead of a regular link
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment