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
b80dc884
Commit
b80dc884
authored
Dec 07, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decouple subject's address from page objects in QA
parent
86aa7ac1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
33 deletions
+40
-33
qa/qa/page/base.rb
qa/qa/page/base.rb
+4
-4
qa/qa/page/main/login.rb
qa/qa/page/main/login.rb
+2
-2
qa/qa/page/mattermost/login.rb
qa/qa/page/mattermost/login.rb
+2
-2
qa/qa/runtime/browser.rb
qa/qa/runtime/browser.rb
+25
-7
qa/qa/specs/features/login/standard_spec.rb
qa/qa/specs/features/login/standard_spec.rb
+1
-1
qa/qa/specs/features/mattermost/group_create_spec.rb
qa/qa/specs/features/mattermost/group_create_spec.rb
+1
-1
qa/qa/specs/features/mattermost/login_spec.rb
qa/qa/specs/features/mattermost/login_spec.rb
+2
-13
qa/qa/specs/features/project/create_spec.rb
qa/qa/specs/features/project/create_spec.rb
+1
-1
qa/qa/specs/features/repository/clone_spec.rb
qa/qa/specs/features/repository/clone_spec.rb
+1
-1
qa/qa/specs/features/repository/push_spec.rb
qa/qa/specs/features/repository/push_spec.rb
+1
-1
No files found.
qa/qa/page/base.rb
View file @
b80dc884
...
@@ -22,10 +22,6 @@ module QA
...
@@ -22,10 +22,6 @@ module QA
yield
if
block_given?
yield
if
block_given?
end
end
def
self
.
address
raise
NotImplementedError
end
def
scroll_to
(
selector
,
text:
nil
)
def
scroll_to
(
selector
,
text:
nil
)
page
.
execute_script
<<~
JS
page
.
execute_script
<<~
JS
var elements = Array.from(document.querySelectorAll('
#{
selector
}
'));
var elements = Array.from(document.querySelectorAll('
#{
selector
}
'));
...
@@ -40,6 +36,10 @@ module QA
...
@@ -40,6 +36,10 @@ module QA
page
.
within
(
selector
)
{
yield
}
if
block_given?
page
.
within
(
selector
)
{
yield
}
if
block_given?
end
end
def
self
.
path
raise
NotImplementedError
end
end
end
end
end
end
end
qa/qa/page/main/login.rb
View file @
b80dc884
...
@@ -18,8 +18,8 @@ module QA
...
@@ -18,8 +18,8 @@ module QA
click_button
'Sign in'
click_button
'Sign in'
end
end
def
self
.
address
def
self
.
path
Runtime
::
Scenario
.
gitlab_address
+
'/users/sign_in'
'/users/sign_in'
end
end
end
end
end
end
...
...
qa/qa/page/mattermost/login.rb
View file @
b80dc884
...
@@ -10,8 +10,8 @@ module QA
...
@@ -10,8 +10,8 @@ module QA
end
end
end
end
def
self
.
address
def
self
.
path
Runtime
::
Scenario
.
gitlab_address
+
'/login'
'/login'
end
end
end
end
end
end
...
...
qa/qa/runtime/browser.rb
View file @
b80dc884
...
@@ -12,14 +12,25 @@ module QA
...
@@ -12,14 +12,25 @@ module QA
self
.
class
.
configure!
self
.
class
.
configure!
end
end
def
visit
(
page
,
&
block
)
##
Browser
::
Session
.
new
(
page
).
tap
do
|
session
|
# Visit a page that belongs to a GitLab instance under given address.
#
# Example:
#
# visit(:gitlab, Page::Main::Login)
# visit('http://gitlab.example/users/sign_in')
#
# In case of an address that is a symbol we will try to guess address
# based on `Runtime::Scenario#something_address`.
#
def
visit
(
address
,
page
,
&
block
)
Browser
::
Session
.
new
(
address
,
page
).
tap
do
|
session
|
session
.
perform
(
&
block
)
session
.
perform
(
&
block
)
end
end
end
end
def
self
.
visit
(
page
,
&
block
)
def
self
.
visit
(
address
,
page
,
&
block
)
new
.
visit
(
page
,
&
block
)
new
.
visit
(
address
,
page
,
&
block
)
end
end
def
self
.
configure!
def
self
.
configure!
...
@@ -52,10 +63,17 @@ module QA
...
@@ -52,10 +63,17 @@ module QA
class
Session
class
Session
include
Capybara
::
DSL
include
Capybara
::
DSL
attr_reader
:address
def
initialize
(
instance
,
page
=
nil
)
@instance
=
instance
@address
=
host
+
page
&
.
path
end
def
initialize
(
page
)
def
host
@address
=
page
.
is_a?
(
String
)
?
page
:
page
.
address
if
@instance
.
is_a?
(
Symbol
)
Runtime
::
Scenario
.
send
(
"
#{
@instance
}
_address"
)
else
@instance
.
to_s
end
end
end
def
perform
(
&
block
)
def
perform
(
&
block
)
...
...
qa/qa/specs/features/login/standard_spec.rb
View file @
b80dc884
module
QA
module
QA
feature
'standard user login'
,
:core
do
feature
'standard user login'
,
:core
do
scenario
'user logs in using credentials'
do
scenario
'user logs in using credentials'
do
Runtime
::
Browser
.
visit
(
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
...
...
qa/qa/specs/features/mattermost/group_create_spec.rb
View file @
b80dc884
module
QA
module
QA
feature
'create a new group'
,
:mattermost
do
feature
'create a new group'
,
:mattermost
do
scenario
'creating a group with a mattermost team'
do
scenario
'creating a group with a mattermost team'
do
Runtime
::
Browser
.
visit
(
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
}
Page
::
Main
::
Menu
.
act
{
go_to_groups
}
Page
::
Main
::
Menu
.
act
{
go_to_groups
}
...
...
qa/qa/specs/features/mattermost/login_spec.rb
View file @
b80dc884
module
QA
module
QA
feature
'logging in to Mattermost'
,
:mattermost
do
feature
'logging in to Mattermost'
,
:mattermost
do
scenario
'can use gitlab oauth'
do
scenario
'can use gitlab oauth'
do
Runtime
::
Browser
.
visit
(
Page
::
Main
::
Login
)
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
visit
(
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
|
...
@@ -13,16 +13,5 @@ module QA
...
@@ -13,16 +13,5 @@ module QA
end
end
end
end
end
end
##
# TODO, temporary workaround for gitlab-org/gitlab-qa#102.
#
after
do
visit
Runtime
::
Scenario
.
mattermost_address
reset_session!
visit
Runtime
::
Scenario
.
gitlab_address
reset_session!
end
end
end
end
end
qa/qa/specs/features/project/create_spec.rb
View file @
b80dc884
module
QA
module
QA
feature
'create a new project'
,
:core
do
feature
'create a new project'
,
:core
do
scenario
'user creates a new project'
do
scenario
'user creates a new project'
do
Runtime
::
Browser
.
visit
(
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
}
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
project
|
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
project
|
...
...
qa/qa/specs/features/repository/clone_spec.rb
View file @
b80dc884
...
@@ -9,7 +9,7 @@ module QA
...
@@ -9,7 +9,7 @@ module QA
end
end
before
do
before
do
Runtime
::
Browser
.
visit
(
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
}
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
scenario
|
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
scenario
|
...
...
qa/qa/specs/features/repository/push_spec.rb
View file @
b80dc884
...
@@ -2,7 +2,7 @@ module QA
...
@@ -2,7 +2,7 @@ module QA
feature
'push code to repository'
,
:core
do
feature
'push code to repository'
,
:core
do
context
'with regular account over http'
do
context
'with regular account over http'
do
scenario
'user pushes code to the repository'
do
scenario
'user pushes code to the repository'
do
Runtime
::
Browser
.
visit
(
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
}
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
scenario
|
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
scenario
|
...
...
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