Skip to content

Commit

Permalink
Add browser navigation test
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 23, 2023
1 parent b074861 commit 837e50f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/html_files/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ <h1>Welcome to the basic test!</h1>
<a id="button" href="./other_page.html">Go somewhere else!</a>
</div>
<input id="the-input">
<button id="js-wait-nav" onclick="changePage()">hey</button>
<script>
function changePage() {
setTimeout(() => {
const parts = document.location.pathname.split('/').filter(x => x.length > 0);
parts[parts.length - 1] = 'elements.html';
document.location.pathname = parts.join('/');
}, 250);
}
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions tests/ui-tests/page-change-in-wait.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This test ensures that the script is working as expecting even through browser navigation and
// page changes.
goto: "file://" + |CURRENT_DIR| + "/" + |DOC_PATH| + "/basic.html"
click: "#js-wait-nav"
wait-for-document-property: {"title": "Other page"}
5 changes: 5 additions & 0 deletions tests/ui-tests/page-change-in-wait.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=> Starting doc-ui tests...

page-change-in-wait... ok

<= doc-ui tests done: 1 succeeded, 0 failed

0 comments on commit 837e50f

Please sign in to comment.