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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ed9bb8af
Commit
ed9bb8af
authored
Aug 07, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve QA scenarios contexts & descriptions consistency
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
7cd3fbb6
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
673 additions
and
631 deletions
+673
-631
qa/qa/scenario/test/instance.rb
qa/qa/scenario/test/instance.rb
+1
-1
qa/qa/specs/features/api/1_manage/users_spec.rb
qa/qa/specs/features/api/1_manage/users_spec.rb
+10
-16
qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb
...rowser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb
+16
-12
qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb
..._ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb
+12
-8
qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb
...atures/browser_ui/1_manage/project/create_project_spec.rb
+18
-14
qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
...es/browser_ui/1_manage/project/import_github_repo_spec.rb
+79
-75
qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb
...browser_ui/1_manage/project/view_project_activity_spec.rb
+16
-12
qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
...ecs/features/browser_ui/2_plan/issue/create_issue_spec.rb
+14
-10
qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
...er_ui/3_create/merge_request/create_merge_request_spec.rb
+31
-27
qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb
...reate/merge_request/merge_merge_request_from_fork_spec.rb
+16
-12
qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb
...er_ui/3_create/merge_request/rebase_merge_request_spec.rb
+40
-34
qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb
...er_ui/3_create/merge_request/squash_merge_request_spec.rb
+38
-34
qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb
...ecs/features/browser_ui/3_create/repository/clone_spec.rb
+4
-2
qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb
...create/repository/create_edit_delete_file_via_web_spec.rb
+53
-49
qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb
...res/browser_ui/3_create/repository/push_over_http_spec.rb
+4
-2
qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb
...wser_ui/3_create/repository/push_protected_branch_spec.rb
+49
-45
qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb
...wser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb
+37
-33
qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb
..._ui/4_verify/pipeline/create_and_process_pipeline_spec.rb
+67
-82
qa/qa/specs/features/browser_ui/4_verify/secret_variable/add_secret_variable_spec.rb
...r_ui/4_verify/secret_variable/add_secret_variable_spec.rb
+18
-14
qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb
...es/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb
+16
-12
qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
...er_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
+68
-64
qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb
...igure/auto_devops/create_project_with_auto_devops_spec.rb
+52
-48
qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb
...gure/mattermost/create_group_with_mattermost_team_spec.rb
+14
-10
qa/qa/specs/features/login/basic_spec.rb
qa/qa/specs/features/login/basic_spec.rb
+0
-15
No files found.
qa/qa/scenario/test/instance.rb
View file @
ed9bb8af
...
@@ -31,7 +31,7 @@ module QA
...
@@ -31,7 +31,7 @@ module QA
if
rspec_options
.
any?
if
rspec_options
.
any?
rspec_options
rspec_options
else
else
[
'--
tag'
,
self
.
class
.
focus
.
join
(
','
),
'--
'
,
::
File
.
expand_path
(
'../../specs/features'
,
__dir__
)]
[
'--'
,
::
File
.
expand_path
(
'../../specs/features'
,
__dir__
)]
end
end
end
end
end
end
...
...
qa/qa/specs/features/api/1_manage/users_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'API users'
do
context
:manage
do
before
(
:context
)
do
describe
'Users API'
do
@api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
before
(
:context
)
do
end
@api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
end
context
'when authenticated'
do
let
(
:request
)
{
Runtime
::
API
::
Request
.
new
(
@api_client
,
'/users'
)
}
let
(
:request
)
{
Runtime
::
API
::
Request
.
new
(
@api_client
,
'/users'
)
}
it
'
get list of
users'
do
it
'
GET /
users'
do
get
request
.
url
get
request
.
url
expect_status
(
200
)
expect_status
(
200
)
end
end
it
'
submit request with a valid user
name'
do
it
'
GET /users/:username with a valid user
name'
do
get
request
.
url
,
{
params:
{
username:
Runtime
::
User
.
username
}
}
get
request
.
url
,
{
params:
{
username:
Runtime
::
User
.
username
}
}
expect_status
(
200
)
expect_status
(
200
)
...
@@ -22,20 +24,12 @@ module QA
...
@@ -22,20 +24,12 @@ module QA
)
)
end
end
it
'
submit request with an invalid user
name'
do
it
'
GET /users/:username with an invalid user
name'
do
get
request
.
url
,
{
params:
{
username:
SecureRandom
.
hex
(
10
)
}
}
get
request
.
url
,
{
params:
{
username:
SecureRandom
.
hex
(
10
)
}
}
expect_status
(
200
)
expect_status
(
200
)
expect
(
json_body
).
to
eq
([])
expect
(
json_body
).
to
eq
([])
end
end
end
end
it
'submit request with an invalid token'
do
request
=
Runtime
::
API
::
Request
.
new
(
@api_client
,
'/users'
,
private_token:
'invalid'
)
get
request
.
url
expect_status
(
401
)
end
end
end
end
end
qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'LDAP user login'
,
:orchestrated
,
:ldap
do
context
:manage
,
:orchestrated
,
:ldap
do
before
do
describe
'LDAP login'
do
Runtime
::
Env
.
user_type
=
'ldap'
before
do
end
Runtime
::
Env
.
user_type
=
'ldap'
end
it
'user logs in
using LDAP credentials'
do
it
'user logs into GitLab
using LDAP credentials'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
# TODO, since `Signed in successfully` message was removed
# TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly.
# this is the only way to tell if user is signed in correctly.
#
#
Page
::
Menu
::
Main
.
perform
do
|
menu
|
Page
::
Menu
::
Main
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
expect
(
menu
).
to
have_personal_area
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'logging in to Mattermost'
,
:orchestrated
,
:mattermost
do
context
:manage
,
:orchestrated
,
:mattermost
do
it
'can use gitlab oauth'
do
describe
'Mattermost login'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
do
it
'user logs into Mattermost using GitLab OAuth'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:mattermost
,
Page
::
Mattermost
::
Login
)
do
Runtime
::
Browser
.
visit
(
:mattermost
,
Page
::
Mattermost
::
Login
)
do
Page
::
Mattermost
::
Login
.
act
{
sign_in_using_oauth
}
Page
::
Mattermost
::
Login
.
act
{
sign_in_using_oauth
}
Page
::
Mattermost
::
Main
.
perform
do
|
page
|
Page
::
Mattermost
::
Main
.
perform
do
|
page
|
expect
(
page
).
to
have_content
(
/(Welcome to: Mattermost|Logout GitLab Mattermost)/
)
expect
(
page
).
to
have_content
(
/(Welcome to: Mattermost|Logout GitLab Mattermost)/
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'create a new project'
,
:smoke
do
context
:manage
,
:smoke
do
it
'user creates a new project'
do
describe
'Project creation'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user creates a new project'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
created_project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
created_project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'awesome-project'
project
.
name
=
'awesome-project'
project
.
description
=
'create awesome project test'
project
.
description
=
'create awesome project test'
end
end
expect
(
created_project
.
name
).
to
match
/^awesome-project-\h{16}$/
expect
(
created_project
.
name
).
to
match
/^awesome-project-\h{16}$/
expect
(
page
).
to
have_content
(
expect
(
page
).
to
have_content
(
/Project \S?awesome-project\S+ was successfully created/
/Project \S?awesome-project\S+ was successfully created/
)
)
expect
(
page
).
to
have_content
(
'create awesome project test'
)
expect
(
page
).
to
have_content
(
'create awesome project test'
)
expect
(
page
).
to
have_content
(
'The repository for this project is empty'
)
expect
(
page
).
to
have_content
(
'The repository for this project is empty'
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'user imports a GitHub repo'
,
:orchestrated
,
:github
do
context
:manage
,
:orchestrated
,
:github
do
let
(
:imported_project
)
do
describe
'Project import from GitHub'
do
Factory
::
Resource
::
ProjectImportedFromGithub
.
fabricate!
do
|
project
|
let
(
:imported_project
)
do
project
.
name
=
'imported-project'
Factory
::
Resource
::
ProjectImportedFromGithub
.
fabricate!
do
|
project
|
project
.
personal_access_token
=
Runtime
::
Env
.
github_access_token
project
.
name
=
'imported-project'
project
.
github_repository_path
=
'gitlab-qa/test-project'
project
.
personal_access_token
=
Runtime
::
Env
.
github_access_token
project
.
github_repository_path
=
'gitlab-qa/test-project'
end
end
end
end
after
do
after
do
# We need to delete the imported project because it's impossible to import
# We need to delete the imported project because it's impossible to import
# the same GitHub project twice for a given user.
# the same GitHub project twice for a given user.
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
delete_project_request
=
Runtime
::
API
::
Request
.
new
(
api_client
,
"/projects/
#{
CGI
.
escape
(
"
#{
Runtime
::
Namespace
.
path
}
/
#{
imported_project
.
name
}
"
)
}
"
)
delete_project_request
=
Runtime
::
API
::
Request
.
new
(
api_client
,
"/projects/
#{
CGI
.
escape
(
"
#{
Runtime
::
Namespace
.
path
}
/
#{
imported_project
.
name
}
"
)
}
"
)
delete
delete_project_request
.
url
delete
delete_project_request
.
url
expect_status
(
202
)
expect_status
(
202
)
end
end
it
'user imports a GitHub repo'
do
it
'user imports a GitHub repo'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
imported_project
# import the project
imported_project
# import the project
Page
::
Menu
::
Main
.
act
{
go_to_projects
}
Page
::
Menu
::
Main
.
act
{
go_to_projects
}
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
dashboard
.
go_to_project
(
imported_project
.
name
)
dashboard
.
go_to_project
(
imported_project
.
name
)
end
end
Page
::
Project
::
Show
.
act
{
wait_for_import
}
Page
::
Project
::
Show
.
act
{
wait_for_import
}
verify_repository_import
verify_repository_import
verify_issues_import
verify_issues_import
verify_merge_requests_import
verify_merge_requests_import
verify_labels_import
verify_labels_import
verify_milestones_import
verify_milestones_import
verify_wiki_import
verify_wiki_import
end
end
def
verify_repository_import
def
verify_repository_import
expect
(
page
).
to
have_content
(
'This test project is used for automated GitHub import by GitLab QA.'
)
expect
(
page
).
to
have_content
(
'This test project is used for automated GitHub import by GitLab QA.'
)
expect
(
page
).
to
have_content
(
imported_project
.
name
)
expect
(
page
).
to
have_content
(
imported_project
.
name
)
end
end
def
verify_issues_import
def
verify_issues_import
Page
::
Menu
::
Side
.
act
{
click_issues
}
Page
::
Menu
::
Side
.
act
{
click_issues
}
expect
(
page
).
to
have_content
(
'This is a sample issue'
)
expect
(
page
).
to
have_content
(
'This is a sample issue'
)
click_link
'This is a sample issue'
click_link
'This is a sample issue'
expect
(
page
).
to
have_content
(
'We should populate this project with issues, pull requests and wiki pages.'
)
expect
(
page
).
to
have_content
(
'We should populate this project with issues, pull requests and wiki pages.'
)
# Comments
# Comments
expect
(
page
).
to
have_content
(
'This is a comment from @rymai.'
)
expect
(
page
).
to
have_content
(
'This is a comment from @rymai.'
)
Page
::
Issuable
::
Sidebar
.
perform
do
|
issuable
|
Page
::
Issuable
::
Sidebar
.
perform
do
|
issuable
|
expect
(
issuable
).
to
have_label
(
'enhancement'
)
expect
(
issuable
).
to
have_label
(
'enhancement'
)
expect
(
issuable
).
to
have_label
(
'help wanted'
)
expect
(
issuable
).
to
have_label
(
'help wanted'
)
expect
(
issuable
).
to
have_label
(
'good first issue'
)
expect
(
issuable
).
to
have_label
(
'good first issue'
)
end
end
end
end
def
verify_merge_requests_import
def
verify_merge_requests_import
Page
::
Menu
::
Side
.
act
{
click_merge_requests
}
Page
::
Menu
::
Side
.
act
{
click_merge_requests
}
expect
(
page
).
to
have_content
(
'Improve README.md'
)
expect
(
page
).
to
have_content
(
'Improve README.md'
)
click_link
'Improve README.md'
click_link
'Improve README.md'
expect
(
page
).
to
have_content
(
'This improves the README file a bit.'
)
expect
(
page
).
to
have_content
(
'This improves the README file a bit.'
)
# Review comment are not supported yet
# Review comment are not supported yet
expect
(
page
).
not_to
have_content
(
'Really nice change.'
)
expect
(
page
).
not_to
have_content
(
'Really nice change.'
)
# Comments
# Comments
expect
(
page
).
to
have_content
(
'Nice work! This is a comment from @rymai.'
)
expect
(
page
).
to
have_content
(
'Nice work! This is a comment from @rymai.'
)
# Diff comments
# Diff comments
expect
(
page
).
to
have_content
(
'[Review comment] I like that!'
)
expect
(
page
).
to
have_content
(
'[Review comment] I like that!'
)
expect
(
page
).
to
have_content
(
'[Review comment] Nice blank line.'
)
expect
(
page
).
to
have_content
(
'[Review comment] Nice blank line.'
)
expect
(
page
).
to
have_content
(
'[Single diff comment] Much better without this line!'
)
expect
(
page
).
to
have_content
(
'[Single diff comment] Much better without this line!'
)
Page
::
Issuable
::
Sidebar
.
perform
do
|
issuable
|
Page
::
Issuable
::
Sidebar
.
perform
do
|
issuable
|
expect
(
issuable
).
to
have_label
(
'bug'
)
expect
(
issuable
).
to
have_label
(
'bug'
)
expect
(
issuable
).
to
have_label
(
'enhancement'
)
expect
(
issuable
).
to
have_label
(
'enhancement'
)
end
end
end
end
def
verify_labels_import
def
verify_labels_import
# TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19228
# TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19228
# to build upon it.
# to build upon it.
end
end
def
verify_milestones_import
def
verify_milestones_import
# TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18727
# TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18727
# to build upon it.
# to build upon it.
end
end
def
verify_wiki_import
def
verify_wiki_import
Page
::
Menu
::
Side
.
act
{
click_wiki
}
Page
::
Menu
::
Side
.
act
{
click_wiki
}
expect
(
page
).
to
have_content
(
'Welcome to the test-project wiki!'
)
expect
(
page
).
to
have_content
(
'Welcome to the test-project wiki!'
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'activity page'
do
context
:manage
do
it
'push creates an event in the activity page'
do
describe
'Project activity'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user creates an event in the activity page upon Git push'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
file_name
=
'README.md'
push
.
file_name
=
'README.md'
push
.
file_content
=
'# This is a test project'
push
.
file_content
=
'# This is a test project'
push
.
commit_message
=
'Add README.md'
push
.
commit_message
=
'Add README.md'
end
end
Page
::
Menu
::
Side
.
act
{
go_to_activity
}
Page
::
Menu
::
Side
.
act
{
go_to_activity
}
Page
::
Project
::
Activity
.
act
{
go_to_push_events
}
Page
::
Project
::
Activity
.
act
{
go_to_push_events
}
expect
(
page
).
to
have_content
(
'pushed new branch master'
)
expect
(
page
).
to
have_content
(
'pushed new branch master'
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'creates issue'
,
:smoke
do
context
:plan
,
:smoke
do
let
(
:issue_title
)
{
'issue title'
}
describe
'Issue creation'
do
let
(
:issue_title
)
{
'issue title'
}
it
'user creates
issue'
do
it
'user creates an
issue'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Resource
::
Issue
.
fabricate!
do
|
issue
|
Factory
::
Resource
::
Issue
.
fabricate!
do
|
issue
|
issue
.
title
=
issue_title
issue
.
title
=
issue_title
end
end
Page
::
Menu
::
Side
.
act
{
click_issues
}
Page
::
Menu
::
Side
.
act
{
click_issues
}
expect
(
page
).
to
have_content
(
issue_title
)
expect
(
page
).
to
have_content
(
issue_title
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'creates a merge request with milestone'
do
it
'user creates a new merge request'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
current_project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'project-with-merge-request-and-milestone'
end
current_milestone
=
Factory
::
Resource
::
ProjectMilestone
.
fabricate!
do
|
milestone
|
milestone
.
title
=
'unique-milestone'
milestone
.
project
=
current_project
end
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
title
=
'This is a merge request with a milestone'
merge_request
.
description
=
'Great feature with milestone'
merge_request
.
project
=
current_project
merge_request
.
milestone
=
current_milestone
end
expect
(
page
).
to
have_content
(
'This is a merge request with a milestone'
)
expect
(
page
).
to
have_content
(
'Great feature with milestone'
)
expect
(
page
).
to
have_content
(
/Opened [\w\s]+ ago/
)
Page
::
Issuable
::
Sidebar
.
perform
do
|
sidebar
|
module
QA
expect
(
sidebar
).
to
have_milestone
(
current_milestone
.
title
)
context
:create
do
describe
'Merge request creation'
do
it
'user creates a new merge request'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
current_project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'project-with-merge-request-and-milestone'
end
current_milestone
=
Factory
::
Resource
::
ProjectMilestone
.
fabricate!
do
|
milestone
|
milestone
.
title
=
'unique-milestone'
milestone
.
project
=
current_project
end
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
title
=
'This is a merge request with a milestone'
merge_request
.
description
=
'Great feature with milestone'
merge_request
.
project
=
current_project
merge_request
.
milestone
=
current_milestone
end
expect
(
page
).
to
have_content
(
'This is a merge request with a milestone'
)
expect
(
page
).
to
have_content
(
'Great feature with milestone'
)
expect
(
page
).
to
have_content
(
/Opened [\w\s]+ ago/
)
Page
::
Issuable
::
Sidebar
.
perform
do
|
sidebar
|
expect
(
sidebar
).
to
have_milestone
(
current_milestone
.
title
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'Project fork'
do
context
:create
do
it
'can submit merge requests to upstream master'
do
describe
'Merge request creation from fork'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user forks a project, submits a merge request and maintainer merges it'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
merge_request
=
Factory
::
Resource
::
MergeRequestFromFork
.
fabricate!
do
|
merge_request
|
merge_request
=
Factory
::
Resource
::
MergeRequestFromFork
.
fabricate!
do
|
merge_request
|
merge_request
.
fork_branch
=
'feature-branch'
merge_request
.
fork_branch
=
'feature-branch'
end
end
Page
::
Menu
::
Main
.
perform
{
|
main
|
main
.
sign_out
}
Page
::
Menu
::
Main
.
perform
{
|
main
|
main
.
sign_out
}
Page
::
Main
::
Login
.
perform
{
|
login
|
login
.
sign_in_using_credentials
}
Page
::
Main
::
Login
.
perform
{
|
login
|
login
.
sign_in_using_credentials
}
merge_request
.
visit!
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
{
|
show
|
show
.
merge!
}
Page
::
MergeRequest
::
Show
.
perform
{
|
show
|
show
.
merge!
}
expect
(
page
).
to
have_content
(
'The changes were merged'
)
expect
(
page
).
to
have_content
(
'The changes were merged'
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'merge request rebase'
do
it
'rebases source branch of merge request'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
"only-fast-forward"
end
Page
::
Menu
::
Side
.
act
{
go_to_settings
}
Page
::
Project
::
Settings
::
MergeRequest
.
act
{
enable_ff_only
}
merge_request
=
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
title
=
'Needs rebasing'
end
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
module
QA
push
.
project
=
project
context
:create
do
push
.
file_name
=
"other.txt"
describe
'Merge request rebasing'
do
push
.
file_content
=
"New file added!"
it
'user rebases source branch of merge request'
do
end
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
merge_request
.
visit!
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
project
.
name
=
"only-fast-forward"
expect
(
merge_request
).
to
have_content
(
'Needs rebasing'
)
end
expect
(
merge_request
).
not_to
be_fast_forward_possible
expect
(
merge_request
).
not_to
have_merge_button
Page
::
Menu
::
Side
.
act
{
go_to_settings
}
Page
::
Project
::
Settings
::
MergeRequest
.
act
{
enable_ff_only
}
merge_request
.
rebase!
merge_request
=
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
expect
(
merge_request
).
to
have_merge_button
merge_request
.
project
=
project
expect
(
merge_request
.
fast_forward_possible?
).
to
be_truthy
merge_request
.
title
=
'Needs rebasing'
end
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
file_name
=
"other.txt"
push
.
file_content
=
"New file added!"
push
.
branch_name
=
"master"
push
.
new_branch
=
false
end
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
expect
(
merge_request
).
to
have_content
(
'Needs rebasing'
)
expect
(
merge_request
).
not_to
be_fast_forward_possible
expect
(
merge_request
).
not_to
have_merge_button
merge_request
.
rebase!
expect
(
merge_request
).
to
have_merge_button
expect
(
merge_request
.
fast_forward_possible?
).
to
be_truthy
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'merge request squash commits'
do
it
'when squash commits is marked before merge'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
module
QA
project
.
name
=
"squash-before-merge"
context
:create
do
end
describe
'Merge request squashing'
do
it
'user squashes commits while merging'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
"squash-before-merge"
end
merge_request
=
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
=
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
project
=
project
merge_request
.
title
=
'Squashing commits'
merge_request
.
title
=
'Squashing commits'
end
end
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
project
=
project
push
.
commit_message
=
'to be squashed'
push
.
commit_message
=
'to be squashed'
push
.
branch_name
=
merge_request
.
source_branch
push
.
branch_name
=
merge_request
.
source_branch
push
.
new_branch
=
false
push
.
new_branch
=
false
push
.
file_name
=
'other.txt'
push
.
file_name
=
'other.txt'
push
.
file_content
=
"Test with unicode characters ❤✓€❄"
push
.
file_content
=
"Test with unicode characters ❤✓€❄"
end
end
merge_request
.
visit!
merge_request
.
visit!
expect
(
page
).
to
have_text
(
'to be squashed'
)
expect
(
page
).
to
have_text
(
'to be squashed'
)
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request_page
|
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request_page
|
merge_request_page
.
mark_to_squash
merge_request_page
.
mark_to_squash
merge_request_page
.
merge!
merge_request_page
.
merge!
merge_request
.
project
.
visit!
merge_request
.
project
.
visit!
Git
::
Repository
.
perform
do
|
repository
|
Git
::
Repository
.
perform
do
|
repository
|
repository
.
uri
=
Page
::
Project
::
Show
.
act
do
repository
.
uri
=
Page
::
Project
::
Show
.
act
do
choose_repository_clone_http
choose_repository_clone_http
repository_location
.
uri
repository_location
.
uri
end
end
repository
.
use_default_credentials
repository
.
use_default_credentials
repository
.
act
{
clone
}
repository
.
act
{
clone
}
expect
(
repository
.
commits
.
size
).
to
eq
3
expect
(
repository
.
commits
.
size
).
to
eq
3
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'clone code from the repository'
do
context
:create
do
context
'with regular account over http
'
do
describe
'Git clone over HTTP
'
do
let
(
:location
)
do
let
(
:location
)
do
Page
::
Project
::
Show
.
act
do
Page
::
Project
::
Show
.
act
do
choose_repository_clone_http
choose_repository_clone_http
...
...
qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'File Functionality'
,
:core
do
it
'lets a user create, edit and delete a file via WebUI'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
# Create
file_name
=
'QA Test - File name'
file_content
=
'QA Test - File content'
commit_message_for_create
=
'QA Test - Create new file'
Factory
::
Resource
::
File
.
fabricate!
do
|
file
|
file
.
name
=
file_name
file
.
content
=
file_content
file
.
commit_message
=
commit_message_for_create
end
expect
(
page
).
to
have_content
(
'The file has been successfully created.'
)
expect
(
page
).
to
have_content
(
file_name
)
expect
(
page
).
to
have_content
(
file_content
)
expect
(
page
).
to
have_content
(
commit_message_for_create
)
# Edit
module
QA
updated_file_content
=
'QA Test - Updated file content'
context
:create
,
:core
do
commit_message_for_update
=
'QA Test - Update file'
describe
'Files management'
do
it
'user creates, edits and deletes a file via the Web'
do
Page
::
File
::
Show
.
act
{
click_edit
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
File
::
Form
.
act
do
remove_content
# Create
add_content
(
updated_file_content
)
file_name
=
'QA Test - File name'
add_commit_message
(
commit_message_for_update
)
file_content
=
'QA Test - File content'
commit_changes
commit_message_for_create
=
'QA Test - Create new file'
end
Factory
::
Resource
::
File
.
fabricate!
do
|
file
|
expect
(
page
).
to
have_content
(
'Your changes have been successfully committed.'
)
file
.
name
=
file_name
expect
(
page
).
to
have_content
(
updated_file_content
)
file
.
content
=
file_content
expect
(
page
).
to
have_content
(
commit_message_for_update
)
file
.
commit_message
=
commit_message_for_create
end
# Delete
commit_message_for_delete
=
'QA Test - Delete file'
expect
(
page
).
to
have_content
(
'The file has been successfully created.'
)
expect
(
page
).
to
have_content
(
file_name
)
Page
::
File
::
Show
.
act
do
expect
(
page
).
to
have_content
(
file_content
)
click_delete
expect
(
page
).
to
have_content
(
commit_message_for_create
)
add_commit_message
(
commit_message_for_delete
)
click_delete_file
# Edit
updated_file_content
=
'QA Test - Updated file content'
commit_message_for_update
=
'QA Test - Update file'
Page
::
File
::
Show
.
act
{
click_edit
}
Page
::
File
::
Form
.
act
do
remove_content
add_content
(
updated_file_content
)
add_commit_message
(
commit_message_for_update
)
commit_changes
end
expect
(
page
).
to
have_content
(
'Your changes have been successfully committed.'
)
expect
(
page
).
to
have_content
(
updated_file_content
)
expect
(
page
).
to
have_content
(
commit_message_for_update
)
# Delete
commit_message_for_delete
=
'QA Test - Delete file'
Page
::
File
::
Show
.
act
do
click_delete
add_commit_message
(
commit_message_for_delete
)
click_delete_file
end
expect
(
page
).
to
have_content
(
'The file has been successfully deleted.'
)
expect
(
page
).
to
have_content
(
commit_message_for_delete
)
expect
(
page
).
to
have_no_content
(
file_name
)
end
end
expect
(
page
).
to
have_content
(
'The file has been successfully deleted.'
)
expect
(
page
).
to
have_content
(
commit_message_for_delete
)
expect
(
page
).
to
have_no_content
(
file_name
)
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'push code to repository'
do
context
:create
do
context
'with regular account over http
'
do
describe
'Git push over HTTP
'
do
it
'user pushes code to the repository'
do
it
'user pushes code to the repository'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
...
...
qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'branch protection support'
do
context
:create
do
let
(
:branch_name
)
{
'protected-branch'
}
describe
'Protected branch support'
do
let
(
:commit_message
)
{
'Protected push commit message'
}
let
(
:branch_name
)
{
'protected-branch'
}
let
(
:project
)
do
let
(
:commit_message
)
{
'Protected push commit message'
}
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
let
(
:project
)
do
resource
.
name
=
'protected-branch-project'
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'protected-branch-project'
end
end
end
end
before
do
before
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
end
end
after
do
after
do
# We need to clear localStorage because we're using it for the dropdown,
# We need to clear localStorage because we're using it for the dropdown,
# and capybara doesn't do this for us.
# and capybara doesn't do this for us.
# https://github.com/teamcapybara/capybara/issues/1702
# https://github.com/teamcapybara/capybara/issues/1702
Capybara
.
execute_script
'localStorage.clear()'
Capybara
.
execute_script
'localStorage.clear()'
end
end
context
'when developers and maintainers are allowed to push to a protected branch'
do
context
'when developers and maintainers are allowed to push to a protected branch'
do
it
'user with push rights successfully pushes to the protected branch'
do
it
'user with push rights successfully pushes to the protected branch'
do
create_protected_branch
(
allow_to_push:
true
)
create_protected_branch
(
allow_to_push:
true
)
push
=
push_new_file
(
branch_name
)
push
=
push_new_file
(
branch_name
)
expect
(
push
.
output
).
to
match
(
/remote: To create a merge request for protected-branch, visit/
)
expect
(
push
.
output
).
to
match
(
/remote: To create a merge request for protected-branch, visit/
)
end
end
end
end
context
'when developers and maintainers are not allowed to push to a protected branch'
do
context
'when developers and maintainers are not allowed to push to a protected branch'
do
it
'user without push rights fails to push to the protected branch'
do
it
'user without push rights fails to push to the protected branch'
do
create_protected_branch
(
allow_to_push:
false
)
create_protected_branch
(
allow_to_push:
false
)
push
=
push_new_file
(
branch_name
)
push
=
push_new_file
(
branch_name
)
expect
(
push
.
output
)
expect
(
push
.
output
)
.
to
match
(
/remote\: GitLab\: You are not allowed to push code to protected branches on this project/
)
.
to
match
(
/remote\: GitLab\: You are not allowed to push code to protected branches on this project/
)
expect
(
push
.
output
)
expect
(
push
.
output
)
.
to
match
(
/\[remote rejected\]
#{
branch_name
}
->
#{
branch_name
}
\(pre-receive hook declined\)/
)
.
to
match
(
/\[remote rejected\]
#{
branch_name
}
->
#{
branch_name
}
\(pre-receive hook declined\)/
)
end
end
end
end
def
create_protected_branch
(
allow_to_push
:)
def
create_protected_branch
(
allow_to_push
:)
Factory
::
Resource
::
Branch
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Branch
.
fabricate!
do
|
resource
|
resource
.
branch_name
=
branch_name
resource
.
branch_name
=
branch_name
resource
.
project
=
project
resource
.
project
=
project
resource
.
allow_to_push
=
allow_to_push
resource
.
allow_to_push
=
allow_to_push
resource
.
protected
=
true
resource
.
protected
=
true
end
end
end
end
def
push_new_file
(
branch
)
def
push_new_file
(
branch
)
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
resource
|
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
resource
|
resource
.
project
=
project
resource
.
project
=
project
resource
.
file_name
=
'new_file.md'
resource
.
file_name
=
'new_file.md'
resource
.
file_content
=
'# This is a new file'
resource
.
file_content
=
'# This is a new file'
resource
.
commit_message
=
'Add new_file.md'
resource
.
commit_message
=
'Add new_file.md'
resource
.
branch_name
=
branch_name
resource
.
branch_name
=
branch_name
resource
.
new_branch
=
false
resource
.
new_branch
=
false
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'Wiki Functionality'
do
def
login
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
end
def
validate_content
(
content
)
module
QA
expect
(
page
).
to
have_content
(
'Wiki was successfully updated'
)
context
:create
do
expect
(
page
).
to
have_content
(
/
#{
content
}
/
)
describe
'Wiki management'
do
end
def
login
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
end
before
do
def
validate_content
(
content
)
login
expect
(
page
).
to
have_content
(
'Wiki was successfully updated'
)
end
expect
(
page
).
to
have_content
(
/
#{
content
}
/
)
end
it
'User creates, edits, clones, and pushes to the wiki'
do
before
do
wiki
=
Factory
::
Resource
::
Wiki
.
fabricate!
do
|
resource
|
login
resource
.
title
=
'Home'
resource
.
content
=
'# My First Wiki Content'
resource
.
message
=
'Update home'
end
end
validate_content
(
'My First Wiki Content'
)
it
'user creates, edits, clones, and pushes to the wiki'
do
wiki
=
Factory
::
Resource
::
Wiki
.
fabricate!
do
|
resource
|
resource
.
title
=
'Home'
resource
.
content
=
'# My First Wiki Content'
resource
.
message
=
'Update home'
end
Page
::
Project
::
Wiki
::
Edit
.
act
{
go_to_edit_page
}
validate_content
(
'My First Wiki Content'
)
Page
::
Project
::
Wiki
::
New
.
perform
do
|
page
|
page
.
set_content
(
"My Second Wiki Content"
)
page
.
save_changes
end
validate_content
(
'My Second Wiki Content'
)
Page
::
Project
::
Wiki
::
Edit
.
act
{
go_to_edit_page
}
Page
::
Project
::
Wiki
::
New
.
perform
do
|
page
|
page
.
set_content
(
"My Second Wiki Content"
)
page
.
save_changes
end
Factory
::
Repository
::
WikiPush
.
fabricate!
do
|
push
|
validate_content
(
'My Second Wiki Content'
)
push
.
wiki
=
wiki
push
.
file_name
=
'Home.md'
push
.
file_content
=
'# My Third Wiki Content'
push
.
commit_message
=
'Update Home.md'
end
Page
::
Menu
::
Side
.
act
{
click_wiki
}
expect
(
page
).
to
have_content
(
'My Third Wiki Content'
)
Factory
::
Repository
::
WikiPush
.
fabricate!
do
|
push
|
push
.
wiki
=
wiki
push
.
file_name
=
'Home.md'
push
.
file_content
=
'# My Third Wiki Content'
push
.
commit_message
=
'Update Home.md'
end
Page
::
Menu
::
Side
.
act
{
click_wiki
}
expect
(
page
).
to
have_content
(
'My Third Wiki Content'
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb
View file @
ed9bb8af
module
QA
# frozen_string_literal: true
describe
'CI/CD Pipelines'
,
:orchestrated
,
:docker
do
let
(
:executor
)
{
"qa-runner-
#{
Time
.
now
.
to_i
}
"
}
after
do
Service
::
Runner
.
new
(
executor
).
remove!
end
it
'user registers a new specific runner'
do
module
QA
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
context
:verify
,
:orchestrated
,
:docker
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
describe
'Pipeline creation and processing'
do
let
(
:executor
)
{
"qa-runner-
#{
Time
.
now
.
to_i
}
"
}
Factory
::
Resource
::
Runner
.
fabricate!
do
|
runner
|
after
do
runner
.
name
=
executor
Service
::
Runner
.
new
(
executor
).
remove!
end
end
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
it
'users creates a pipeline which gets processed'
do
sleep
5
# Runner should register within 5 seconds
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
settings
.
refresh
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
settings
.
expand_runners_settings
do
|
page
|
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
expect
(
page
).
to
have_content
(
executor
)
project
.
name
=
'project-with-pipelines'
expect
(
page
).
to
have_online_runner
project
.
description
=
'Project with CI/CD Pipelines.'
end
end
end
end
it
'users creates a new pipeline'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
Factory
::
Resource
::
Runner
.
fabricate!
do
|
runner
|
project
.
name
=
'project-with-pipelines'
runner
.
project
=
project
project
.
description
=
'Project with CI/CD Pipelines.'
runner
.
name
=
executor
end
runner
.
tags
=
%w[qa test]
end
Factory
::
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
executor
runner
.
tags
=
%w[qa test]
end
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
project
=
project
push
.
file_name
=
'.gitlab-ci.yml'
push
.
file_name
=
'.gitlab-ci.yml'
push
.
commit_message
=
'Add .gitlab-ci.yml'
push
.
commit_message
=
'Add .gitlab-ci.yml'
push
.
file_content
=
<<~
EOF
push
.
file_content
=
<<~
EOF
test-success:
test-success:
tags:
tags:
- qa
- qa
- test
- test
script: echo 'OK'
script: echo 'OK'
test-failure:
test-failure:
tags:
tags:
- qa
- qa
- test
- test
script:
script:
- echo 'FAILURE'
- echo 'FAILURE'
- exit 1
- exit 1
test-tags:
test-tags:
tags:
tags:
- qa
- qa
- docker
- docker
script: echo 'NOOP'
script: echo 'NOOP'
test-artifacts:
test-artifacts:
tags:
tags:
- qa
- qa
- test
- test
script: mkdir my-artifacts; echo "CONTENTS" > my-artifacts/artifact.txt
script: mkdir my-artifacts; echo "CONTENTS" > my-artifacts/artifact.txt
artifacts:
artifacts:
paths:
paths:
- my-artifacts/
- my-artifacts/
EOF
EOF
end
end
Page
::
Project
::
Show
.
act
{
wait_for_push
}
Page
::
Project
::
Show
.
act
{
wait_for_push
}
expect
(
page
).
to
have_content
(
'Add .gitlab-ci.yml'
)
expect
(
page
).
to
have_content
(
'Add .gitlab-ci.yml'
)
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
expect
(
page
).
to
have_content
(
'All 1'
)
expect
(
page
).
to
have_content
(
'All 1'
)
expect
(
page
).
to
have_content
(
'Add .gitlab-ci.yml'
)
expect
(
page
).
to
have_content
(
'Add .gitlab-ci.yml'
)
puts
'Waiting for the runner to process the pipeline'
puts
'Waiting for the runner to process the pipeline'
sleep
15
# Runner should process all jobs within 15 seconds.
sleep
15
# Runner should process all jobs within 15 seconds.
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
expect
(
pipeline
).
to
be_running
expect
(
pipeline
).
to
be_running
expect
(
pipeline
).
to
have_build
(
'test-success'
,
status: :success
)
expect
(
pipeline
).
to
have_build
(
'test-success'
,
status: :success
)
expect
(
pipeline
).
to
have_build
(
'test-failure'
,
status: :failed
)
expect
(
pipeline
).
to
have_build
(
'test-failure'
,
status: :failed
)
expect
(
pipeline
).
to
have_build
(
'test-tags'
,
status: :pending
)
expect
(
pipeline
).
to
have_build
(
'test-tags'
,
status: :pending
)
expect
(
pipeline
).
to
have_build
(
'test-artifacts'
,
status: :success
)
expect
(
pipeline
).
to
have_build
(
'test-artifacts'
,
status: :success
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/4_verify/secret_variable/add_secret_variable_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'secret variables support'
do
context
:verify
do
it
'user adds a secret variable'
do
describe
'Secret variable support'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user adds a secret variable'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
resource
.
key
=
'VARIABLE_KEY'
resource
.
key
=
'VARIABLE_KEY'
resource
.
value
=
'some secret variable'
resource
.
value
=
'some secret variable'
end
end
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
settings
|
settings
.
expand_secret_variables
do
|
page
|
settings
.
expand_secret_variables
do
|
page
|
expect
(
page
).
to
have_field
(
with:
'VARIABLE_KEY'
)
expect
(
page
).
to
have_field
(
with:
'VARIABLE_KEY'
)
expect
(
page
).
not_to
have_field
(
with:
'some secret variable'
)
expect
(
page
).
not_to
have_field
(
with:
'some secret variable'
)
page
.
reveal_variables
page
.
reveal_variables
expect
(
page
).
to
have_field
(
with:
'some secret variable'
)
expect
(
page
).
to
have_field
(
with:
'some secret variable'
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'deploy keys support'
do
context
:release
do
it
'user adds a deploy key'
do
describe
'Deploy key creation'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user adds a deploy key'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
key
=
Runtime
::
Key
::
RSA
.
new
key
=
Runtime
::
Key
::
RSA
.
new
deploy_key_title
=
'deploy key title'
deploy_key_title
=
'deploy key title'
deploy_key_value
=
key
.
public_key
deploy_key_value
=
key
.
public_key
deploy_key
=
Factory
::
Resource
::
DeployKey
.
fabricate!
do
|
resource
|
deploy_key
=
Factory
::
Resource
::
DeployKey
.
fabricate!
do
|
resource
|
resource
.
title
=
deploy_key_title
resource
.
title
=
deploy_key_title
resource
.
key
=
deploy_key_value
resource
.
key
=
deploy_key_value
end
end
expect
(
deploy_key
.
fingerprint
).
to
eq
(
key
.
fingerprint
)
expect
(
deploy_key
.
fingerprint
).
to
eq
(
key
.
fingerprint
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
require
'digest/sha1'
require
'digest/sha1'
module
QA
module
QA
describe
'cloning code using a deploy key'
,
:docker
do
context
:release
,
:docker
do
def
login
describe
'Git clone using a deploy key'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
def
login
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
end
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
end
before
(
:all
)
do
before
(
:all
)
do
login
login
@runner_name
=
"qa-runner-
#{
Time
.
now
.
to_i
}
"
@runner_name
=
"qa-runner-
#{
Time
.
now
.
to_i
}
"
@project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
@project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'deploy-key-clone-project'
resource
.
name
=
'deploy-key-clone-project'
end
end
@repository_location
=
@project
.
repository_ssh_location
@repository_location
=
@project
.
repository_ssh_location
Factory
::
Resource
::
Runner
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
Runner
.
fabricate!
do
|
resource
|
resource
.
project
=
@project
resource
.
project
=
@project
resource
.
name
=
@runner_name
resource
.
name
=
@runner_name
resource
.
tags
=
%w[qa docker]
resource
.
tags
=
%w[qa docker]
resource
.
image
=
'gitlab/gitlab-runner:ubuntu'
resource
.
image
=
'gitlab/gitlab-runner:ubuntu'
end
end
Page
::
Menu
::
Main
.
act
{
sign_out
}
Page
::
Menu
::
Main
.
act
{
sign_out
}
end
end
after
(
:all
)
do
after
(
:all
)
do
Service
::
Runner
.
new
(
@runner_name
).
remove!
Service
::
Runner
.
new
(
@runner_name
).
remove!
end
end
keys
=
[
keys
=
[
[
Runtime
::
Key
::
RSA
,
8192
],
[
Runtime
::
Key
::
RSA
,
8192
],
[
Runtime
::
Key
::
ECDSA
,
521
],
[
Runtime
::
Key
::
ECDSA
,
521
],
[
Runtime
::
Key
::
ED25519
]
[
Runtime
::
Key
::
ED25519
]
]
]
keys
.
each
do
|
(
key_class
,
bits
)
|
keys
.
each
do
|
(
key_class
,
bits
)
|
it
"user sets up a deploy key with
#{
key_class
}
(
#{
bits
}
) to clone code using pipelines"
do
it
"user sets up a deploy key with
#{
key_class
}
(
#{
bits
}
) to clone code using pipelines"
do
key
=
key_class
.
new
(
*
bits
)
key
=
key_class
.
new
(
*
bits
)
login
login
Factory
::
Resource
::
DeployKey
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
DeployKey
.
fabricate!
do
|
resource
|
resource
.
project
=
@project
resource
.
project
=
@project
resource
.
title
=
"deploy key
#{
key
.
name
}
(
#{
key
.
bits
}
)"
resource
.
title
=
"deploy key
#{
key
.
name
}
(
#{
key
.
bits
}
)"
resource
.
key
=
key
.
public_key
resource
.
key
=
key
.
public_key
end
end
deploy_key_name
=
"DEPLOY_KEY_
#{
key
.
name
}
_
#{
key
.
bits
}
"
deploy_key_name
=
"DEPLOY_KEY_
#{
key
.
name
}
_
#{
key
.
bits
}
"
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
resource
.
project
=
@project
resource
.
project
=
@project
resource
.
key
=
deploy_key_name
resource
.
key
=
deploy_key_name
resource
.
value
=
key
.
private_key
resource
.
value
=
key
.
private_key
end
end
gitlab_ci
=
<<~
YAML
gitlab_ci
=
<<~
YAML
cat-config:
cat-config:
script:
script:
- mkdir -p ~/.ssh
- mkdir -p ~/.ssh
...
@@ -73,31 +76,32 @@ module QA
...
@@ -73,31 +76,32 @@ module QA
tags:
tags:
- qa
- qa
- docker
- docker
YAML
YAML
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
resource
|
resource
.
project
=
@project
resource
.
file_name
=
'.gitlab-ci.yml'
resource
.
commit_message
=
'Add .gitlab-ci.yml'
resource
.
file_content
=
gitlab_ci
resource
.
branch_name
=
deploy_key_name
resource
.
new_branch
=
true
end
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
resource
|
sha1sum
=
Digest
::
SHA1
.
hexdigest
(
gitlab_ci
)
resource
.
project
=
@project
resource
.
file_name
=
'.gitlab-ci.yml'
resource
.
commit_message
=
'Add .gitlab-ci.yml'
resource
.
file_content
=
gitlab_ci
resource
.
branch_name
=
deploy_key_name
resource
.
new_branch
=
true
end
sha1sum
=
Digest
::
SHA1
.
hexdigest
(
gitlab_ci
)
Page
::
Project
::
Show
.
act
{
wait_for_push
}
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
Page
::
Project
::
Pipeline
::
Show
.
act
{
go_to_first_job
}
Page
::
Project
::
Show
.
act
{
wait_for_push
}
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
job
.
wait
(
reload:
false
)
do
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
job
.
completed?
&&
!
job
.
trace_loading?
Page
::
Project
::
Pipeline
::
Show
.
act
{
go_to_first_job
}
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
.
passed?
).
to
be_truthy
,
"Job status did not become
\"
passed
\"
."
job
.
wait
(
reload:
false
)
do
expect
(
job
.
output
).
to
include
(
sha1sum
)
job
.
completed?
&&
!
job
.
trace_loading?
end
end
expect
(
job
.
passed?
).
to
be_truthy
,
"Job status did not become
\"
passed
\"
."
expect
(
job
.
output
).
to
include
(
sha1sum
)
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
require
'pathname'
require
'pathname'
module
QA
module
QA
describe
'Auto Devops'
,
:orchestrated
,
:kubernetes
do
context
:configure
,
:orchestrated
,
:kubernetes
do
after
do
describe
'Auto DevOps support'
do
@cluster
&
.
remove!
after
do
end
@cluster
&
.
remove!
end
it
'user creates a new project and runs auto devops'
do
it
'user creates a new project and runs auto devops'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
p
|
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
p
|
p
.
name
=
'project-with-autodevops'
p
.
name
=
'project-with-autodevops'
p
.
description
=
'Project with Auto Devops'
p
.
description
=
'Project with Auto Devops'
end
end
# Disable code_quality check in Auto DevOps pipeline as it takes
# Disable code_quality check in Auto DevOps pipeline as it takes
# too long and times out the test
# too long and times out the test
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
Factory
::
Resource
::
SecretVariable
.
fabricate!
do
|
resource
|
resource
.
key
=
'CODE_QUALITY_DISABLED'
resource
.
key
=
'CODE_QUALITY_DISABLED'
resource
.
value
=
'1'
resource
.
value
=
'1'
end
end
# Create Auto Devops compatible repo
# Create Auto Devops compatible repo
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
project
=
project
push
.
directory
=
Pathname
push
.
directory
=
Pathname
.
new
(
__dir__
)
.
new
(
__dir__
)
.
join
(
'../../../fixtures/auto_devops_rack'
)
.
join
(
'../../../fixtures/auto_devops_rack'
)
push
.
commit_message
=
'Create Auto DevOps compatible rack application'
push
.
commit_message
=
'Create Auto DevOps compatible rack application'
end
end
Page
::
Project
::
Show
.
act
{
wait_for_push
}
Page
::
Project
::
Show
.
act
{
wait_for_push
}
# Create and connect K8s cluster
# Create and connect K8s cluster
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
@cluster
=
Service
::
KubernetesCluster
.
new
.
create!
kubernetes_cluster
=
Factory
::
Resource
::
KubernetesCluster
.
fabricate!
do
|
cluster
|
kubernetes_cluster
=
Factory
::
Resource
::
KubernetesCluster
.
fabricate!
do
|
cluster
|
cluster
.
project
=
project
cluster
.
project
=
project
cluster
.
cluster
=
@cluster
cluster
.
cluster
=
@cluster
cluster
.
install_helm_tiller
=
true
cluster
.
install_helm_tiller
=
true
cluster
.
install_ingress
=
true
cluster
.
install_ingress
=
true
cluster
.
install_prometheus
=
true
cluster
.
install_prometheus
=
true
cluster
.
install_runner
=
true
cluster
.
install_runner
=
true
end
end
project
.
visit!
project
.
visit!
Page
::
Menu
::
Side
.
act
{
click_ci_cd_settings
}
Page
::
Menu
::
Side
.
act
{
click_ci_cd_settings
}
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
p
|
Page
::
Project
::
Settings
::
CICD
.
perform
do
|
p
|
p
.
enable_auto_devops_with_domain
(
"
#{
kubernetes_cluster
.
ingress_ip
}
.nip.io"
)
p
.
enable_auto_devops_with_domain
(
"
#{
kubernetes_cluster
.
ingress_ip
}
.nip.io"
)
end
end
project
.
visit!
project
.
visit!
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
Page
::
Menu
::
Side
.
act
{
click_ci_cd_pipelines
}
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
Page
::
Project
::
Pipeline
::
Index
.
act
{
go_to_latest_pipeline
}
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
expect
(
pipeline
).
to
have_build
(
'build'
,
status: :success
,
wait:
600
)
expect
(
pipeline
).
to
have_build
(
'build'
,
status: :success
,
wait:
600
)
expect
(
pipeline
).
to
have_build
(
'test'
,
status: :success
,
wait:
600
)
expect
(
pipeline
).
to
have_build
(
'test'
,
status: :success
,
wait:
600
)
expect
(
pipeline
).
to
have_build
(
'production'
,
status: :success
,
wait:
1200
)
expect
(
pipeline
).
to
have_build
(
'production'
,
status: :success
,
wait:
1200
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb
View file @
ed9bb8af
# frozen_string_literal: true
module
QA
module
QA
describe
'create a new group'
,
:orchestrated
,
:mattermost
do
context
:configure
,
:orchestrated
,
:mattermost
do
it
'creating a group with a mattermost team'
do
describe
'Mattermost support'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
it
'user creates a group with a mattermost team'
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Menu
::
Main
.
act
{
go_to_groups
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Menu
::
Main
.
act
{
go_to_groups
}
Page
::
Dashboard
::
Groups
.
perform
do
|
page
|
Page
::
Dashboard
::
Groups
.
perform
do
|
page
|
page
.
go_to_new_group
page
.
go_to_new_group
expect
(
page
).
to
have_content
(
expect
(
page
).
to
have_content
(
/Create a Mattermost team for this group/
/Create a Mattermost team for this group/
)
)
end
end
end
end
end
end
end
...
...
qa/qa/specs/features/login/basic_spec.rb
deleted
100644 → 0
View file @
7cd3fbb6
module
QA
describe
'basic user login'
,
:smoke
do
it
'user logs in using basic credentials'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
# TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly.
#
Page
::
Menu
::
Main
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
end
end
end
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