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
760d611b
Commit
760d611b
authored
Jan 11, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy-edit docs about GitLab QA page objects
parent
02500992
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
qa/qa/page/README.md
qa/qa/page/README.md
+13
-13
No files found.
qa/qa/page/README.md
View file @
760d611b
...
@@ -19,18 +19,18 @@ We need page objects, because we need to reduce duplication and avoid problems
...
@@ -19,18 +19,18 @@ We need page objects, because we need to reduce duplication and avoid problems
whenever someone changes some selectors in GitLab's source code.
whenever someone changes some selectors in GitLab's source code.
Imagine that we have a hundred specs in GitLab QA, and we need to sign into
Imagine that we have a hundred specs in GitLab QA, and we need to sign into
GitLab each time, before we make assertions. Without
page object one would nee
d
GitLab each time, before we make assertions. Without
a page object one woul
d
to rely on volatile helpers or invoke Capybara methods directly. Imagine
need
to rely on volatile helpers or invoke Capybara methods directly. Imagine
invoking
`fill_in :user_login`
in every
`*_spec.rb`
file / test example.
invoking
`fill_in :user_login`
in every
`*_spec.rb`
file / test example.
When someone later changes
`t.text_field :login`
in the view associated with
When someone later changes
`t.text_field :login`
in the view associated with
this page to
`t.text_field :username`
it will generate
different field ID,
this page to
`t.text_field :username`
it will generate
a different field
what would effectively break all 100
tests.
identifier, what would effectively break all
tests.
Because we are
now
using
`Page::Main::Login.act { sign_in_using_credentials }`
Because we are using
`Page::Main::Login.act { sign_in_using_credentials }`
everywhere, whe
re we want to sign into GitLab, page object is the single sourc
e
everywhere, whe
n we want to sign into GitLab, the page object is the singl
e
of truth, and we will need to update
`fill_in :user_login`
source
of truth, and we will need to update
`fill_in :user_login`
to
`fill_in :user_username`
only in a one place
as well
.
to
`fill_in :user_username`
only in a one place.
## What problems did we have in the past?
## What problems did we have in the past?
...
@@ -38,9 +38,9 @@ We do not run QA tests for every commit, because of performance reasons, and
...
@@ -38,9 +38,9 @@ We do not run QA tests for every commit, because of performance reasons, and
the time it would take to build packages and test everything.
the time it would take to build packages and test everything.
That is why when someone changes
`t.text_field :login`
to
That is why when someone changes
`t.text_field :login`
to
`t.text_field :username`
in
new session view we won't know about this change
`t.text_field :username`
in
the _new session_ view we won't know about this
until our GitLab QA nightly pipeline runs, or someone triggers
`package-qa`
change until our GitLab QA nightly pipeline fails, or until someone triggers
action in their merge request.
`package-qa`
action in their merge request.
Obviously such a change would break all tests. We call this problem a _fragile
Obviously such a change would break all tests. We call this problem a _fragile
tests problem_.
tests problem_.
...
@@ -53,11 +53,11 @@ problem by introducing coupling between GitLab CE / EE views and GitLab QA.
...
@@ -53,11 +53,11 @@ problem by introducing coupling between GitLab CE / EE views and GitLab QA.
Currently, when you add a new
`Page::Base`
derived class, you will also need to
Currently, when you add a new
`Page::Base`
derived class, you will also need to
define all selectors that your page objects depends on.
define all selectors that your page objects depends on.
Whenever you
r
push your code to CE / EE repository,
`qa:selectors`
sanity test
Whenever you push your code to CE / EE repository,
`qa:selectors`
sanity test
job is going to be run as a part of a CI pipeline.
job is going to be run as a part of a CI pipeline.
This test is going to validate all page objects that we have implemented in
This test is going to validate all page objects that we have implemented in
`qa/page`
directory. When i
f
fails, you will be notified about missing
`qa/page`
directory. When i
t
fails, you will be notified about missing
or invalid views / selectors definition.
or invalid views / selectors definition.
## How to properly implement a page object?
## How to properly implement a page object?
...
...
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