BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
131 deletions
+135
-131
qa.rb
qa/qa.rb
+21
-23
base.rb
qa/qa/factory/base.rb
+16
-0
push.rb
qa/qa/factory/repository/push.rb
+30
-32
group.rb
qa/qa/factory/resource/group.rb
+14
-18
project.rb
qa/qa/factory/resource/project.rb
+24
-26
sandbox.rb
qa/qa/factory/resource/sandbox.rb
+17
-17
hashed_storage.rb
qa/qa/factory/settings/hashed_storage.rb
+13
-15
No files found.
qa/qa.rb
View file @
5c393b39
...
...
@@ -13,6 +13,27 @@ module QA
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
#
module
Scenario
...
...
@@ -35,29 +56,6 @@ module QA
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
...
...
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/
scenario/gitlab
/repository/push.rb
→
qa/qa/
factory
/repository/push.rb
View file @
5c393b39
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
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
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
def
initialize
@file_name
=
'file.txt'
@file_content
=
'# This is test project'
@commit_message
=
"Add
#{
@file_name
}
"
@branch_name
=
'master'
end
choose_repository_clone_http
repository_location
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
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
)
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
...
...
qa/qa/
scenario/gitlab/group/create
.rb
→
qa/qa/
factory/resource/group
.rb
View file @
5c393b39
require
'securerandom'
module
QA
module
Scenario
module
Gitlab
module
Group
class
Create
<
Scenario
::
Template
attr_writer
:path
,
:description
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
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
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
...
...
qa/qa/
scenario/gitlab/project/create
.rb
→
qa/qa/
factory/resource/project
.rb
View file @
5c393b39
require
'securerandom'
module
QA
module
Scenario
module
Gitlab
module
Project
class
Create
<
Scenario
::
Template
attr_writer
:description
module
Factory
module
Resource
class
Project
<
Factory
::
Base
attr_writer
:description
def
name
=
(
name
)
@name
=
"
#{
name
}
-
#{
SecureRandom
.
hex
(
8
)
}
"
end
def
name
=
(
name
)
@name
=
"
#{
name
}
-
#{
SecureRandom
.
hex
(
8
)
}
"
end
def
perform
Scenario
::
Gitlab
::
Sandbox
::
Prepare
.
perform
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
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
Factory
::
Resource
::
Group
.
fabricate!
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
name
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
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
...
...
qa/qa/
scenario/gitlab/sandbox/prepare
.rb
→
qa/qa/
factory/resource/sandbox
.rb
View file @
5c393b39
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
}
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
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
Resource
::
Group
.
fabricate!
do
|
group
|
group
.
path
=
Runtime
::
Namespace
.
sandbox_name
group
.
description
=
'GitLab QA Sandbox'
end
end
end
...
...
qa/qa/
scenario/gitlab/admin
/hashed_storage.rb
→
qa/qa/
factory/settings
/hashed_storage.rb
View file @
5c393b39
module
QA
module
Scenario
module
Gitlab
module
Admin
class
HashedStorage
<
Scenario
::
Template
def
perform
(
*
traits
)
raise
ArgumentError
unless
traits
.
include?
(
:enabled
)
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
::
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
}
Page
::
Admin
::
Settings
.
act
do
enable_hashed_storage
save_settings
end
QA
::
Page
::
Main
::
Menu
.
act
{
sign_out
}
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