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
dbfeef25
Commit
dbfeef25
authored
Nov 17, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use QA browser to navigate to pages and handle sessions
[ci skip]
parent
67c572ba
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
49 additions
and
18 deletions
+49
-18
qa/qa/page/base.rb
qa/qa/page/base.rb
+19
-0
qa/qa/page/main/entry.rb
qa/qa/page/main/entry.rb
+1
-5
qa/qa/page/main/login.rb
qa/qa/page/main/login.rb
+8
-0
qa/qa/page/mattermost/login.rb
qa/qa/page/mattermost/login.rb
+2
-2
qa/qa/runtime/browser.rb
qa/qa/runtime/browser.rb
+12
-4
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
-2
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 @
dbfeef25
...
...
@@ -38,6 +38,25 @@ module QA
yield
if
block_given?
end
##
# If you want to use specific page class as an entrypoint
# for Runtime::Browser.session, you need to implement this
# method in a subclass.
#
def
self
.
address
raise
NotImplementedError
end
## TODO
# When we navigate through pages, we want to check if we are on a
# valid page everytime we instantiate a new Page object.
#
# See gitlab-org/gitlab-qa#111
#
# def self.pattern
# raise NotImplementedError
# end
end
end
end
qa/qa/page/main/entry.rb
View file @
dbfeef25
...
...
@@ -2,11 +2,7 @@ module QA
module
Page
module
Main
class
Entry
<
Page
::
Base
def
visit_login_page
wait
(
time:
500
)
do
visit
(
"
#{
Runtime
::
Scenario
.
gitlab_address
}
/users/sign_in"
)
end
end
# TODO remove this class
end
end
end
...
...
qa/qa/page/main/login.rb
View file @
dbfeef25
...
...
@@ -2,6 +2,14 @@ module QA
module
Page
module
Main
class
Login
<
Page
::
Base
def
self
.
address
Runtime
::
Scenario
.
gitlab_address
+
'/users/sign_in'
end
def
initialize
wait
(
'.application'
,
time:
500
)
end
def
sign_in_using_credentials
if
page
.
has_content?
(
'Change your password'
)
fill_in
:user_password
,
with:
Runtime
::
User
.
password
...
...
qa/qa/page/mattermost/login.rb
View file @
dbfeef25
...
...
@@ -2,8 +2,8 @@ module QA
module
Page
module
Mattermost
class
Login
<
Page
::
Base
def
initialize
visit
(
Runtime
::
Scenario
.
mattermost_address
+
'/login'
)
def
self
.
address
Runtime
::
Scenario
.
mattermost_address
+
'/login'
end
def
sign_in_using_oauth
...
...
qa/qa/runtime/browser.rb
View file @
dbfeef25
...
...
@@ -8,14 +8,18 @@ module QA
module
Browser
extend
self
def
session
(
address
,
&
block
)
def
visit
(
entry
,
&
block
)
address
=
entry
.
is_a?
(
String
)
?
entry
:
entry
.
address
configure!
page
.
visit
(
address
)
block
.
call
(
page
)
if
block_given?
block
.
call
(
page
)
page
.
visit
(
address
)
reset_domain_session!
page
.
visit
(
address
)
reset_domain_session!
end
rescue
# RSpec examples will take care of screenshots on their own
#
...
...
@@ -26,6 +30,10 @@ module QA
raise
end
##
# Current session, when Capybara::DSL is included `page` method is
# mixed in as well.
#
def
page
Capybara
.
current_session
end
...
...
qa/qa/specs/features/login/standard_spec.rb
View file @
dbfeef25
module
QA
feature
'standard user login'
,
:core
do
scenario
'user logs in using credentials'
do
Page
::
Main
::
Entry
.
act
{
visit_login_page
}
Runtime
::
Browser
.
visit
(
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 @
dbfeef25
module
QA
feature
'create a new group'
,
:mattermost
do
scenario
'creating a group with a mattermost team'
do
Page
::
Main
::
Entry
.
act
{
visit_login_page
}
Runtime
::
Browser
.
visit
(
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 @
dbfeef25
module
QA
feature
'logging in to Mattermost'
,
:mattermost
do
scenario
'can use gitlab oauth'
do
Runtime
::
Browser
.
session
(
Page
::
Gitlab
::
Login
)
do
Runtime
::
Browser
.
visit
(
Page
::
Gitlab
::
Login
)
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Runtime
::
Browser
.
session
(
Page
::
Mattermost
::
Login
)
do
Runtime
::
Browser
.
visit
(
Page
::
Mattermost
::
Login
)
do
Page
::
Mattermost
::
Login
.
act
{
sign_in_using_oauth
}
Page
::
Mattermost
::
Main
.
perform
do
|
page
|
...
...
qa/qa/specs/features/project/create_spec.rb
View file @
dbfeef25
module
QA
feature
'create a new project'
,
:core
do
scenario
'user creates a new project'
do
Page
::
Main
::
Entry
.
act
{
visit_login_page
}
Runtime
::
Browser
.
visit
(
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 @
dbfeef25
...
...
@@ -9,7 +9,7 @@ module QA
end
before
do
Page
::
Main
::
Entry
.
act
{
visit_login_page
}
Runtime
::
Browser
.
visit
(
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 @
dbfeef25
...
...
@@ -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
Page
::
Main
::
Entry
.
act
{
visit_login_page
}
Runtime
::
Browser
.
visit
(
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