|
| 1 | +// This GUI test checks search is working as expected. |
| 2 | + |
| 3 | +go-to: |DOC_PATH| + "index.html" |
| 4 | +// First we ensure that the search input is disabled and hidden. |
| 5 | +assert: "#searchbar:disabled" |
| 6 | +// This check is to ensure that the search bar is inside the search wrapper. |
| 7 | +assert: "#search-wrapper #searchbar" |
| 8 | +assert-css: ("#search-wrapper", {"display": "none"}) |
| 9 | + |
| 10 | +// Now we make the search input appear with the `S` shortcut. |
| 11 | +press-key: 'S' |
| 12 | +wait-for: "#searchbar:not(:disabled)" |
| 13 | +assert-css: ("#search-wrapper", {"display": "block"}) |
| 14 | +// We ensure the search bar has the focus. |
| 15 | +assert: "#searchbar:focus" |
| 16 | + |
| 17 | +// Now we press `Escape` to ensure that the search input disappears again. |
| 18 | +press-key: 'Escape' |
| 19 | +wait-for-css: ("#search-wrapper", {"display": "none"}) |
| 20 | + |
| 21 | +// Making it appear by clicking on the search button. |
| 22 | +click: "#search-toggle" |
| 23 | +wait-for-css: ("#search-wrapper", {"display": "block"}) |
| 24 | +// We ensure the search bar has the focus. |
| 25 | +assert: "#searchbar:focus" |
| 26 | + |
| 27 | +// We input "test". |
| 28 | +write: "test" |
| 29 | +// The results should now appear. |
| 30 | +wait-for-text: ("#searchresults-header", "search results for 'test':", ENDS_WITH) |
| 31 | +assert: "#searchresults" |
| 32 | +// Ensure that the URL was updated as well. |
| 33 | +assert-document-property: ({"URL": "?search=test"}, ENDS_WITH) |
| 34 | + |
| 35 | +// Now we ensure that when we land on the page with a "search in progress", the search results are |
| 36 | +// loaded and that the search input has focus. |
| 37 | +go-to: |DOC_PATH| + "index.html?search=test" |
| 38 | +wait-for-text: ("#searchresults-header", "search results for 'test':", ENDS_WITH) |
| 39 | +assert: "#searchbar:focus" |
| 40 | +assert: "#searchresults" |
| 41 | + |
| 42 | +// And now we press `Escape` to close everything. |
| 43 | +press-key: 'Escape' |
| 44 | +wait-for-css: ("#search-wrapper", {"display": "none"}) |
0 commit comments