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
4d36096c
Commit
4d36096c
authored
May 14, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the new 'QA::Page::PageConcern' module
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
be7393dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
doc/development/testing_guide/end_to_end/page_objects.md
doc/development/testing_guide/end_to_end/page_objects.md
+47
-0
No files found.
doc/development/testing_guide/end_to_end/page_objects.md
View file @
4d36096c
...
@@ -238,6 +238,53 @@ the view for code in a library.
...
@@ -238,6 +238,53 @@ the view for code in a library.
In such rare cases it's reasonable to use CSS selectors in page object methods,
In such rare cases it's reasonable to use CSS selectors in page object methods,
with a comment explaining why an
`element`
can't be added.
with a comment explaining why an
`element`
can't be added.
### Define Page concerns
Some pages share common behaviors, and/or are prepended with EE-specific modules that adds EE-specific methods.
These modules must:
1.
Extend from the
`QA::Page::PageConcern`
module, with
`extend QA::Page::PageConcern`
.
1.
Override the
`self.prepended`
method if they need to
`include`
/
`prepend`
other modules themselves, and/or define
`view`
or
`elements`
.
1.
Call
`super`
as the first thing in
`self.prepended`
.
1.
Include/prepend other modules and define their
`view`
/
`elements`
in a
`base.class_eval`
block to ensure they're
defined in the class that prepends the module.
These steps ensure the sanity selectors check will detect problems properly.
For example,
`qa/qa/ee/page/merge_request/show.rb`
adds EE-specific methods to
`qa/qa/page/merge_request/show.rb`
(with
`QA::Page::MergeRequest::Show.prepend_if_ee('QA::EE::Page::MergeRequest::Show')`
) and following is how it's implemented
(only showing the relevant part and refering to the 4 steps described above with inline comments):
```
ruby
module
QA
module
EE
module
Page
module
MergeRequest
module
Show
extend
QA
::
Page
::
PageConcern
# 1.
def
self
.
prepended
(
base
)
# 2.
super
# 3.
base
.
class_eval
do
# 4.
prepend
Page
::
Component
::
LicenseManagement
view
'app/assets/javascripts/vue_merge_request_widget/components/states/sha_mismatch.vue'
do
element
:head_mismatch
,
"The source branch HEAD has recently changed."
end
[
...
]
end
end
end
end
end
end
end
```
## Running the test locally
## Running the test locally
During development, you can run the
`qa:selectors`
test by running
During development, you can run the
`qa:selectors`
test by running
...
...
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