Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
699671bd
Unverified
Commit
699671bd
authored
5 years ago
by
Chris Willis-Ford
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4841 from cwillisf/test-failure-feedback
add timeouts & messages to all driver.wait calls
parents
7facbf35
796339dc
Branches
Branches containing commit
Tags
0.1.0-prerelease.20190528164501
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/helpers/selenium-helper.js
+11
-6
11 additions, 6 deletions
test/helpers/selenium-helper.js
with
11 additions
and
6 deletions
test/helpers/selenium-helper.js
+
11
−
6
View file @
699671bd
...
...
@@ -8,6 +8,11 @@ const {By, until, Button} = webdriver;
const
USE_HEADLESS
=
process
.
env
.
USE_HEADLESS
!==
'
no
'
;
// The main reason for this timeout is so that we can control the timeout message and report details;
// if we hit the Jasmine default timeout then we get a terse message that we can't control.
// The Jasmine default timeout is 30 seconds so make sure this is lower.
const
DEFAULT_TIMEOUT_MILLISECONDS
=
20
*
1000
;
class
SeleniumHelper
{
constructor
()
{
bindAll
(
this
,
[
...
...
@@ -26,8 +31,8 @@ class SeleniumHelper {
]);
}
elementIsVisible
(
element
)
{
return
this
.
driver
.
wait
(
until
.
elementIsVisible
(
element
));
elementIsVisible
(
element
,
timeoutMessage
=
'
elementIsVisible timed out
'
)
{
return
this
.
driver
.
wait
(
until
.
elementIsVisible
(
element
)
,
DEFAULT_TIMEOUT_MILLISECONDS
,
timeoutMessage
);
}
get
scope
()
{
...
...
@@ -79,8 +84,8 @@ class SeleniumHelper {
return
this
.
driver
;
}
findByXpath
(
xpath
)
{
return
this
.
driver
.
wait
(
until
.
elementLocated
(
By
.
xpath
(
xpath
),
5
*
1000
)
);
findByXpath
(
xpath
,
timeoutMessage
=
`findByXpath timed out for path:
${
xpath
}
`
)
{
return
this
.
driver
.
wait
(
until
.
elementLocated
(
By
.
xpath
(
xpath
)
)
,
DEFAULT_TIMEOUT_MILLISECONDS
,
timeoutMessage
);
}
findByText
(
text
,
scope
)
{
...
...
@@ -120,8 +125,8 @@ class SeleniumHelper {
return
this
.
clickXpath
(
`//button//*[contains(text(), '
${
text
}
')]`
);
}
waitUntilGone
(
element
)
{
return
this
.
driver
.
wait
(
until
.
stalenessOf
(
element
));
waitUntilGone
(
element
,
timeoutMessage
=
'
waitUntilGone timed out
'
)
{
return
this
.
driver
.
wait
(
until
.
stalenessOf
(
element
)
,
DEFAULT_TIMEOUT_MILLISECONDS
,
timeoutMessage
);
}
getLogs
(
whitelist
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment