Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Octant
Commits
72e66943
Unverified
Commit
72e66943
authored
5 years ago
by
Sam Foo
Committed by
GitHub
5 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #565 from GuessWhoSamFoo/e2e-flake
Fix flaky namespace dropdown test
parents
85de2351
241e34e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/cypress/integration/namespace.spec.js
+32
-2
web/cypress/integration/namespace.spec.js
with
32 additions
and
2 deletions
+32
-2
web/cypress/integration/namespace.spec.js
+
32
-
2
View file @
72e66943
describe
(
'
Namespace
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
visit
(
'
/
'
);
cy
.
visit
(
'
/
'
,
{
onBeforeLoad
:
spyOnAddEventListener
}).
then
(
waitForAppStart
);
});
it
(
'
namespaces navigation
'
,
()
=>
{
...
...
@@ -15,8 +17,36 @@ describe('Namespace', () => {
it
(
'
namespace dropdown
'
,
()
=>
{
cy
.
get
(
'
input[role="combobox"]
'
).
click
();
cy
.
get
(
'
[class="ng-option-label ng-star-inserted"]
'
).
contains
(
'
octant-cypress
'
).
parent
().
click
();
cy
.
get
(
'
span[class="ng-option-label ng-star-inserted"]
'
)
.
contains
(
'
octant-cypress
'
)
.
parent
()
.
click
()
cy
.
location
(
'
hash
'
).
should
(
'
include
'
,
'
/
'
+
'
octant-cypress
'
);
});
});
let
appHasStarted
function
spyOnAddEventListener
(
win
)
{
const
addListener
=
win
.
EventTarget
.
prototype
.
addEventListener
win
.
EventTarget
.
prototype
.
addEventListener
=
function
(
name
)
{
console
.
log
(
'
Event listener added:
'
,
name
)
if
(
name
===
'
test
'
)
{
// that means the web application has started
appHasStarted
=
true
win
.
EventTarget
.
prototype
.
addEventListener
=
addListener
}
return
addListener
.
apply
(
this
,
arguments
)
}
}
function
waitForAppStart
()
{
return
new
Cypress
.
Promise
((
resolve
,
reject
)
=>
{
const
isReady
=
()
=>
{
if
(
appHasStarted
)
{
return
resolve
();
}
setTimeout
(
isReady
,
0
);
}
isReady
();
});
};
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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