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
Léo-Paul Géneau
gitlab-ce
Commits
5c393b39
Commit
5c393b39
authored
Dec 13, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename QA scenarios to make factory concept explicit
parent
8b436fb8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
195 additions
and
191 deletions
+195
-191
qa/qa.rb
qa/qa.rb
+21
-23
qa/qa/factory/base.rb
qa/qa/factory/base.rb
+16
-0
qa/qa/factory/repository/push.rb
qa/qa/factory/repository/push.rb
+45
-0
qa/qa/factory/resource/group.rb
qa/qa/factory/resource/group.rb
+23
-0
qa/qa/factory/resource/project.rb
qa/qa/factory/resource/project.rb
+40
-0
qa/qa/factory/resource/sandbox.rb
qa/qa/factory/resource/sandbox.rb
+28
-0
qa/qa/factory/settings/hashed_storage.rb
qa/qa/factory/settings/hashed_storage.rb
+22
-0
qa/qa/scenario/gitlab/admin/hashed_storage.rb
qa/qa/scenario/gitlab/admin/hashed_storage.rb
+0
-24
qa/qa/scenario/gitlab/group/create.rb
qa/qa/scenario/gitlab/group/create.rb
+0
-27
qa/qa/scenario/gitlab/project/create.rb
qa/qa/scenario/gitlab/project/create.rb
+0
-42
qa/qa/scenario/gitlab/repository/push.rb
qa/qa/scenario/gitlab/repository/push.rb
+0
-47
qa/qa/scenario/gitlab/sandbox/prepare.rb
qa/qa/scenario/gitlab/sandbox/prepare.rb
+0
-28
No files found.
qa/qa.rb
View file @
5c393b39
...
@@ -12,6 +12,27 @@ module QA
...
@@ -12,6 +12,27 @@ module QA
autoload
:Browser
,
'qa/runtime/browser'
autoload
:Browser
,
'qa/runtime/browser'
end
end
##
# GitLab QA fabrication mechanisms
#
module
Factory
autoload
:Base
,
'qa/factory/base'
module
Resource
autoload
:Sandbox
,
'qa/factory/resource/sandbox'
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Project
,
'qa/factory/resource/project'
end
module
Repository
autoload
:Push
,
'qa/factory/repository/push'
end
module
Settings
autoload
:HashedStorage
,
'qa/factory/settings/hashed_storage'
end
end
##
##
# GitLab QA Scenarios
# GitLab QA Scenarios
#
#
...
@@ -35,29 +56,6 @@ module QA
...
@@ -35,29 +56,6 @@ module QA
end
end
end
end
##
# GitLab instance scenarios.
#
module
Gitlab
module
Group
autoload
:Create
,
'qa/scenario/gitlab/group/create'
end
module
Project
autoload
:Create
,
'qa/scenario/gitlab/project/create'
end
module
Repository
autoload
:Push
,
'qa/scenario/gitlab/repository/push'
end
module
Sandbox
autoload
:Prepare
,
'qa/scenario/gitlab/sandbox/prepare'
end
module
Admin
autoload
:HashedStorage
,
'qa/scenario/gitlab/admin/hashed_storage'
end
end
end
end
end
...
...
qa/qa/factory/base.rb
0 → 100644
View file @
5c393b39
module
QA
module
Factory
class
Base
def
self
.
fabricate!
(
*
args
)
new
.
tap
do
|
factory
|
yield
factory
if
block_given?
return
factory
.
fabricate!
(
*
args
)
end
end
def
fabricate!
(
*
_args
)
raise
NotImplementedError
end
end
end
end
qa/qa/factory/repository/push.rb
0 → 100644
View file @
5c393b39
require
"pry-byebug"
module
QA
module
Factory
module
Repository
class
Push
<
Factory
::
Base
PAGE_REGEX_CHECK
=
%r{
\/
#{
Runtime
::
Namespace
.
sandbox_name
}
\/
qa-test[^
\/
]+
\/
{1}[^
\/
]+
\z
}
.
freeze
attr_writer
:file_name
,
:file_content
,
:commit_message
,
:branch_name
def
initialize
@file_name
=
'file.txt'
@file_content
=
'# This is test project'
@commit_message
=
"Add
#{
@file_name
}
"
@branch_name
=
'master'
end
def
fabricate!
Git
::
Repository
.
perform
do
|
repository
|
repository
.
location
=
Page
::
Project
::
Show
.
act
do
unless
PAGE_REGEX_CHECK
.
match
(
current_path
)
raise
"To perform this scenario the current page should be project show."
end
choose_repository_clone_http
repository_location
end
repository
.
use_default_credentials
repository
.
clone
repository
.
configure_identity
(
'GitLab QA'
,
'root@gitlab.com'
)
repository
.
add_file
(
@file_name
,
@file_content
)
repository
.
commit
(
@commit_message
)
repository
.
push_changes
(
@branch_name
)
end
end
end
end
end
end
qa/qa/factory/resource/group.rb
0 → 100644
View file @
5c393b39
module
QA
module
Factory
module
Resource
class
Group
<
Factory
::
Base
attr_writer
:path
,
:description
def
initialize
@path
=
Runtime
::
Namespace
.
name
@description
=
"QA test run at
#{
Runtime
::
Namespace
.
time
}
"
end
def
fabricate!
Page
::
Group
::
New
.
perform
do
|
group
|
group
.
set_path
(
@path
)
group
.
set_description
(
@description
)
group
.
set_visibility
(
'Private'
)
group
.
create
end
end
end
end
end
end
qa/qa/factory/resource/project.rb
0 → 100644
View file @
5c393b39
require
'securerandom'
module
QA
module
Factory
module
Resource
class
Project
<
Factory
::
Base
attr_writer
:description
def
name
=
(
name
)
@name
=
"
#{
name
}
-
#{
SecureRandom
.
hex
(
8
)
}
"
end
def
fabricate!
Factory
::
Resource
::
Sandbox
.
fabricate!
Page
::
Group
::
Show
.
perform
do
|
page
|
if
page
.
has_subgroup?
(
Runtime
::
Namespace
.
name
)
page
.
go_to_subgroup
(
Runtime
::
Namespace
.
name
)
else
page
.
go_to_new_subgroup
Factory
::
Resource
::
Group
.
fabricate!
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
name
end
end
page
.
go_to_new_project
end
Page
::
Project
::
New
.
perform
do
|
page
|
page
.
choose_test_namespace
page
.
choose_name
(
@name
)
page
.
add_description
(
@description
)
page
.
create_new_project
end
end
end
end
end
end
qa/qa/factory/resource/sandbox.rb
0 → 100644
View file @
5c393b39
module
QA
module
Factory
module
Resource
##
# Ensure we're in our sandbox namespace, either by navigating to it or by
# creating it if it doesn't yet exist.
#
class
Sandbox
<
Factory
::
Base
def
fabricate!
Page
::
Main
::
Menu
.
act
{
go_to_groups
}
Page
::
Dashboard
::
Groups
.
perform
do
|
page
|
if
page
.
has_group?
(
Runtime
::
Namespace
.
sandbox_name
)
page
.
go_to_group
(
Runtime
::
Namespace
.
sandbox_name
)
else
page
.
go_to_new_group
Resource
::
Group
.
fabricate!
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
sandbox_name
group
.
description
=
'GitLab QA Sandbox'
end
end
end
end
end
end
end
end
qa/qa/factory/settings/hashed_storage.rb
0 → 100644
View file @
5c393b39
module
QA
module
Factory
module
Settings
class
HashedStorage
<
Factory
::
Base
def
fabricate!
(
*
traits
)
raise
ArgumentError
unless
traits
.
include?
(
:enabled
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Menu
.
act
{
go_to_admin_area
}
Page
::
Admin
::
Menu
.
act
{
go_to_settings
}
Page
::
Admin
::
Settings
.
act
do
enable_hashed_storage
save_settings
end
QA
::
Page
::
Main
::
Menu
.
act
{
sign_out
}
end
end
end
end
end
qa/qa/scenario/gitlab/admin/hashed_storage.rb
deleted
100644 → 0
View file @
8b436fb8
module
QA
module
Scenario
module
Gitlab
module
Admin
class
HashedStorage
<
Scenario
::
Template
def
perform
(
*
traits
)
raise
ArgumentError
unless
traits
.
include?
(
:enabled
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Menu
.
act
{
go_to_admin_area
}
Page
::
Admin
::
Menu
.
act
{
go_to_settings
}
Page
::
Admin
::
Settings
.
act
do
enable_hashed_storage
save_settings
end
QA
::
Page
::
Main
::
Menu
.
act
{
sign_out
}
end
end
end
end
end
end
qa/qa/scenario/gitlab/group/create.rb
deleted
100644 → 0
View file @
8b436fb8
require
'securerandom'
module
QA
module
Scenario
module
Gitlab
module
Group
class
Create
<
Scenario
::
Template
attr_writer
:path
,
:description
def
initialize
@path
=
Runtime
::
Namespace
.
name
@description
=
"QA test run at
#{
Runtime
::
Namespace
.
time
}
"
end
def
perform
Page
::
Group
::
New
.
perform
do
|
group
|
group
.
set_path
(
@path
)
group
.
set_description
(
@description
)
group
.
set_visibility
(
'Private'
)
group
.
create
end
end
end
end
end
end
end
qa/qa/scenario/gitlab/project/create.rb
deleted
100644 → 0
View file @
8b436fb8
require
'securerandom'
module
QA
module
Scenario
module
Gitlab
module
Project
class
Create
<
Scenario
::
Template
attr_writer
:description
def
name
=
(
name
)
@name
=
"
#{
name
}
-
#{
SecureRandom
.
hex
(
8
)
}
"
end
def
perform
Scenario
::
Gitlab
::
Sandbox
::
Prepare
.
perform
Page
::
Group
::
Show
.
perform
do
|
page
|
if
page
.
has_subgroup?
(
Runtime
::
Namespace
.
name
)
page
.
go_to_subgroup
(
Runtime
::
Namespace
.
name
)
else
page
.
go_to_new_subgroup
Scenario
::
Gitlab
::
Group
::
Create
.
perform
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
name
end
end
page
.
go_to_new_project
end
Page
::
Project
::
New
.
perform
do
|
page
|
page
.
choose_test_namespace
page
.
choose_name
(
@name
)
page
.
add_description
(
@description
)
page
.
create_new_project
end
end
end
end
end
end
end
qa/qa/scenario/gitlab/repository/push.rb
deleted
100644 → 0
View file @
8b436fb8
require
"pry-byebug"
module
QA
module
Scenario
module
Gitlab
module
Repository
class
Push
<
Scenario
::
Template
PAGE_REGEX_CHECK
=
%r{
\/
#{
Runtime
::
Namespace
.
sandbox_name
}
\/
qa-test[^
\/
]+
\/
{1}[^
\/
]+
\z
}
.
freeze
attr_writer
:file_name
,
:file_content
,
:commit_message
,
:branch_name
def
initialize
@file_name
=
'file.txt'
@file_content
=
'# This is test project'
@commit_message
=
"Add
#{
@file_name
}
"
@branch_name
=
'master'
end
def
perform
Git
::
Repository
.
perform
do
|
repository
|
repository
.
location
=
Page
::
Project
::
Show
.
act
do
unless
PAGE_REGEX_CHECK
.
match
(
current_path
)
raise
"To perform this scenario the current page should be project show."
end
choose_repository_clone_http
repository_location
end
repository
.
use_default_credentials
repository
.
clone
repository
.
configure_identity
(
'GitLab QA'
,
'root@gitlab.com'
)
repository
.
add_file
(
@file_name
,
@file_content
)
repository
.
commit
(
@commit_message
)
repository
.
push_changes
(
@branch_name
)
end
end
end
end
end
end
end
qa/qa/scenario/gitlab/sandbox/prepare.rb
deleted
100644 → 0
View file @
8b436fb8
module
QA
module
Scenario
module
Gitlab
module
Sandbox
# Ensure we're in our sandbox namespace, either by navigating to it or
# by creating it if it doesn't yet exist
class
Prepare
<
Scenario
::
Template
def
perform
Page
::
Main
::
Menu
.
act
{
go_to_groups
}
Page
::
Dashboard
::
Groups
.
perform
do
|
page
|
if
page
.
has_group?
(
Runtime
::
Namespace
.
sandbox_name
)
page
.
go_to_group
(
Runtime
::
Namespace
.
sandbox_name
)
else
page
.
go_to_new_group
Scenario
::
Gitlab
::
Group
::
Create
.
perform
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
sandbox_name
group
.
description
=
'QA sandbox'
end
end
end
end
end
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