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
38413c48
Commit
38413c48
authored
Nov 15, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement better version of `scroll_to` QA helper
parent
f7036e9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
qa/qa/page/admin/settings.rb
qa/qa/page/admin/settings.rb
+1
-2
qa/qa/page/base.rb
qa/qa/page/base.rb
+11
-10
No files found.
qa/qa/page/admin/settings.rb
View file @
38413c48
...
...
@@ -3,8 +3,7 @@ module QA
module
Admin
class
Settings
<
Page
::
Base
def
enable_hashed_storage
# TODO need to scroll to "Repository storage" text
scroll_to
'application_setting_clientside_sentry_dsn'
scroll_to
'legend'
,
text:
'Repository Storage'
check
'Create new projects using hashed storage paths'
end
...
...
qa/qa/page/base.rb
View file @
38413c48
...
...
@@ -10,16 +10,17 @@ module QA
visit
current_path
end
def
scroll_to
(
selector
)
if
selector
.
start_with?
(
'.'
)
page
.
execute_script
<<~
JS
document.getElementsByClassName("
#{
selector
.
sub
(
/^\./
,
''
)
}
")[0].scrollIntoView();
JS
else
page
.
execute_script
<<~
JS
document.getElementById("
#{
selector
}
").scrollIntoView();
JS
end
def
scroll_to
(
selector
,
text:
nil
)
page
.
execute_script
<<~
JS
var elements = Array.from(document.querySelectorAll('
#{
selector
}
'));
var text = '
#{
text
}
';
if (text.length > 0) {
elements.find(e => e.textContent === text).scrollIntoView();
} else {
elements[0].scrollIntoView();
}
JS
page
.
within
(
selector
)
{
yield
}
if
block_given?
end
...
...
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