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
832ce1f3
Commit
832ce1f3
authored
Jan 06, 2021
by
Mark Lapierre
Committed by
Ramya Authappan
Jan 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to find elements before waiting for requests
parent
2779d69b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
qa/qa/page/base.rb
qa/qa/page/base.rb
+22
-10
No files found.
qa/qa/page/base.rb
View file @
832ce1f3
...
...
@@ -188,19 +188,31 @@ module QA
end
def
has_element?
(
name
,
**
kwargs
)
wait_for_requests
(
skip_finished_loading_check:
!!
kwargs
.
delete
(
:skip_finished_loading_check
))
disabled
=
kwargs
.
delete
(
:disabled
)
original_kwargs
=
kwargs
.
dup
wait
=
kwargs
.
delete
(
:wait
)
||
Capybara
.
default_max_wait_time
text
=
kwargs
.
delete
(
:text
)
klass
=
kwargs
.
delete
(
:class
)
if
disabled
.
nil?
wait
=
kwargs
.
delete
(
:wait
)
||
Capybara
.
default_max_wait_time
text
=
kwargs
.
delete
(
:text
)
klass
=
kwargs
.
delete
(
:class
)
has_css?
(
element_selector_css
(
name
,
kwargs
),
text:
text
,
wait:
wait
,
class:
klass
)
else
find_element
(
name
,
kwargs
).
disabled?
==
disabled
try_find_element
=
->
(
wait
)
do
if
disabled
.
nil?
has_css?
(
element_selector_css
(
name
,
kwargs
),
text:
text
,
wait:
wait
,
class:
klass
)
else
find_element
(
name
,
original_kwargs
).
disabled?
==
disabled
end
end
# Check for the element before waiting for requests, just in case unrelated requests are in progress.
# This is to avoid waiting unnecessarily after the element we're interested in has already appeared.
return
true
if
try_find_element
.
call
(
wait
)
# If the element didn't appear, wait for requests and then check again
wait_for_requests
(
skip_finished_loading_check:
!!
kwargs
.
delete
(
:skip_finished_loading_check
))
# We only wait one second now because we previously waited the full expected duration,
# plus however long it took for requests to complete. One second should be enough
# for the UI to update after requests complete.
try_find_element
.
call
(
1
)
end
def
has_no_element?
(
name
,
**
kwargs
)
...
...
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