Skip to content

Commit

Permalink
Don’t depend on a fixed loading timeout in visual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 19, 2018
1 parent dfc201a commit 6aea94e
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -39,7 +39,7 @@ script:
polymer lint --rules polymer-2 --input ./src/*.html ./theme/**/*.html &&
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" && "$TRAVIS_BRANCH" != quick/* ]]; then
if [[ "$TEST_SUITE" = "visual_tests" ]]; then
npm i -q --no-save gemini@^4.0.0 gemini-sauce gemini-polyserve &&
npm i -q --no-save gemini@^5.0.0 gemini-sauce gemini-polyserve &&
gemini test test/visual;
else
wct --env saucelabs;
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion test/visual/test.js
@@ -1,6 +1,9 @@
gemini.suite('vaadin-text-field', function(rootSuite) {
function wait(actions, find) {
actions.wait(5000);
return actions
.waitForJSCondition(function(window) {
return window.webComponentsAreReady;
}, 60000);
}

function goToAboutBlank(actions, find) {
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-password-field/password-field.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-password-field.html">`);

window.addEventListener('WebComponentsReady', function() {
customElements.whenDefined('vaadin-password-field').then(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-password-field/rtl.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-password-field.html">`);

window.addEventListener('WebComponentsReady', function() {
customElements.whenDefined('vaadin-password-field').then(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
8 changes: 7 additions & 1 deletion test/visual/vaadin-text-area/rtl.html
Expand Up @@ -7,7 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-area.html">`);
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-password-field.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-area/styling.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-area.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
</head>

Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-area/text-area-1.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-area.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-area/text-area-2.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-area.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-area/text-area-3.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-area.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
8 changes: 7 additions & 1 deletion test/visual/vaadin-text-field/rtl.html
Expand Up @@ -7,7 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-field.html">`);
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-password-field.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-field/styling.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-field.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
</head>

Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-field/text-field-1.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-field.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down
7 changes: 7 additions & 0 deletions test/visual/vaadin-text-field/text-field-2.html
Expand Up @@ -7,6 +7,13 @@
<script>
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
document.write(`<link rel="import" href="../../../theme/${theme}/vaadin-text-field.html">`);

window.addEventListener('WebComponentsReady', function() {
setTimeout(function() {
window.ShadyDOM && window.ShadyDOM.flush(); // Force DOM composition
window.webComponentsAreReady = true; // Checked in gemini before capture callback
});
});
</script>
<link href="../common.html" rel="import">
</head>
Expand Down

0 comments on commit 6aea94e

Please sign in to comment.