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
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
Show 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
yield
if
block_given?
end
def
self
.
address
raise
NotImplementedError
end
def
scroll_to
(
selector
,
text:
nil
)
page
.
execute_script
<<~
JS
var elements = Array.from(document.querySelectorAll('
#{
selector
}
'));
...
...
@@ -40,6 +36,10 @@ module QA
page
.
within
(
selector
)
{
yield
}
if
block_given?
end
def
self
.
path
raise
NotImplementedError
end
end
end
end
qa/qa/page/main/login.rb
View file @
b80dc884
...
...
@@ -18,8 +18,8 @@ module QA
click_button
'Sign in'
end
def
self
.
address
Runtime
::
Scenario
.
gitlab_address
+
'/users/sign_in'
def
self
.
path
'/users/sign_in'
end
end
end
...
...
qa/qa/page/mattermost/login.rb
View file @
b80dc884
...
...
@@ -10,8 +10,8 @@ module QA
end
end
def
self
.
address
Runtime
::
Scenario
.
gitlab_address
+
'/login'
def
self
.
path
'/login'
end
end
end
...
...
qa/qa/runtime/browser.rb
View file @
b80dc884
...
...
@@ -12,14 +12,25 @@ module QA
self
.
class
.
configure!
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
)
end
end
def
self
.
visit
(
page
,
&
block
)
new
.
visit
(
page
,
&
block
)
def
self
.
visit
(
address
,
page
,
&
block
)
new
.
visit
(
address
,
page
,
&
block
)
end
def
self
.
configure!
...
...
@@ -52,10 +63,17 @@ module QA
class
Session
include
Capybara
::
DSL
attr_reader
:address
def
initialize
(
instance
,
page
=
nil
)
@instance
=
instance
@address
=
host
+
page
&
.
path
end
def
initialize
(
page
)
@address
=
page
.
is_a?
(
String
)
?
page
:
page
.
address
def
host
if
@instance
.
is_a?
(
Symbol
)
Runtime
::
Scenario
.
send
(
"
#{
@instance
}
_address"
)
else
@instance
.
to_s
end
end
def
perform
(
&
block
)
...
...
qa/qa/specs/features/login/standard_spec.rb
View file @
b80dc884
module
QA
feature
'standard user login'
,
:core
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
}
# TODO, since `Signed in successfully` message was removed
...
...
qa/qa/specs/features/mattermost/group_create_spec.rb
View file @
b80dc884
module
QA
feature
'create a new group'
,
:mattermost
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
::
Menu
.
act
{
go_to_groups
}
...
...
qa/qa/specs/features/mattermost/login_spec.rb
View file @
b80dc884
module
QA
feature
'logging in to Mattermost'
,
:mattermost
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
}
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
::
Main
.
perform
do
|
page
|
...
...
@@ -13,16 +13,5 @@ module QA
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
qa/qa/specs/features/project/create_spec.rb
View file @
b80dc884
module
QA
feature
'create a new project'
,
:core
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
}
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
project
|
...
...
qa/qa/specs/features/repository/clone_spec.rb
View file @
b80dc884
...
...
@@ -9,7 +9,7 @@ module QA
end
before
do
Runtime
::
Browser
.
visit
(
Page
::
Main
::
Login
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Scenario
::
Gitlab
::
Project
::
Create
.
perform
do
|
scenario
|
...
...
qa/qa/specs/features/repository/push_spec.rb
View file @
b80dc884
...
...
@@ -2,7 +2,7 @@ module QA
feature
'push code to repository'
,
:core
do
context
'with regular account over http'
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
}
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