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
Jérome Perrin
gitlab-ce
Commits
7725a707
Commit
7725a707
authored
Jan 09, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce duplication in QA page elements-related code
parent
65615776
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
qa/qa/page/base.rb
qa/qa/page/base.rb
+1
-1
qa/qa/page/element.rb
qa/qa/page/element.rb
+5
-1
qa/qa/scenario/test/sanity/selectors.rb
qa/qa/scenario/test/sanity/selectors.rb
+1
-1
qa/spec/page/element_spec.rb
qa/spec/page/element_spec.rb
+7
-0
No files found.
qa/qa/page/base.rb
View file @
7725a707
...
@@ -41,7 +41,7 @@ module QA
...
@@ -41,7 +41,7 @@ module QA
end
end
def
click_element
(
name
)
def
click_element
(
name
)
find
(
"qa-
#{
name
.
tr
(
'_'
,
'-'
)
}
"
).
click
find
(
Page
::
Element
.
new
(
name
).
selector
).
click
end
end
def
self
.
path
def
self
.
path
...
...
qa/qa/page/element.rb
View file @
7725a707
...
@@ -5,7 +5,11 @@ module QA
...
@@ -5,7 +5,11 @@ module QA
def
initialize
(
name
,
pattern
=
nil
)
def
initialize
(
name
,
pattern
=
nil
)
@name
=
name
@name
=
name
@pattern
=
pattern
||
"qa-
#{
@name
.
to_s
.
tr
(
'_'
,
'-'
)
}
"
@pattern
=
pattern
||
selector
end
def
selector
"qa-
#{
@name
.
to_s
.
tr
(
'_'
,
'-'
)
}
"
end
end
def
expression
def
expression
...
...
qa/qa/scenario/test/sanity/selectors.rb
View file @
7725a707
...
@@ -17,7 +17,7 @@ module QA
...
@@ -17,7 +17,7 @@ module QA
STDERR
.
puts
<<~
EOS
STDERR
.
puts
<<~
EOS
GitLab QA sanity selectors validation test detected problems
GitLab QA sanity selectors validation test detected problems
your merge request!
with
your merge request!
The purpose of this test is to make sure that GitLab QA tests,
The purpose of this test is to make sure that GitLab QA tests,
that are entirely black-box, click-driven scenarios, do match
that are entirely black-box, click-driven scenarios, do match
...
...
qa/spec/page/element_spec.rb
View file @
7725a707
describe
QA
::
Page
::
Element
do
describe
QA
::
Page
::
Element
do
describe
'#selector'
do
it
'transform element name into QA-specific selector'
do
expect
(
described_class
.
new
(
:sign_in_button
).
selector
)
.
to
eq
'qa-sign-in-button'
end
end
context
'when pattern is an expression'
do
context
'when pattern is an expression'
do
subject
{
described_class
.
new
(
:something
,
/button 'Sign in'/
)
}
subject
{
described_class
.
new
(
:something
,
/button 'Sign in'/
)
}
...
...
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