Rollup merge of #99323 - GuillaumeGomez:fix-gui-flaky, r=Dylan-DPC
Fix flakyness of GUI tests Fixes #98163. All flaky tests seemed to be linked to the search. Since the search JS is loaded when we focus the search input, I think it's possible that we enter faster than the JS is actually loaded. The solution for that would be to do it in two steps: first we write into the search input (`browser-ui-test` adds a small sleep time after such commands) and then we press enter to be sure that it wasn't missed. cc `@JohnTitor` r? `@Dylan-DPC`
This commit is contained in:
commit
0c6e01baff
8 changed files with 26 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
// First, we check that the search results are hidden when the Escape key is pressed.
|
// First, we check that the search results are hidden when the Escape key is pressed.
|
||||||
write: (".search-input", "test")
|
write: (".search-input", "test")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
wait-for: "#search h1" // The search element is empty before the first search
|
wait-for: "#search h1" // The search element is empty before the first search
|
||||||
// Check that the currently displayed element is search.
|
// Check that the currently displayed element is search.
|
||||||
wait-for: "#alternative-display #search"
|
wait-for: "#alternative-display #search"
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
show-text: true
|
show-text: true
|
||||||
write: (".search-input", "test")
|
write: (".search-input", "test")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-text: ("#results .externcrate", "test_docs")
|
assert-text: ("#results .externcrate", "test_docs")
|
||||||
|
|
|
@ -7,6 +7,8 @@ reload:
|
||||||
assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;")
|
assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;")
|
||||||
assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"})
|
assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"})
|
||||||
write: (".search-input", "TheStdReexport")
|
write: (".search-input", "TheStdReexport")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
wait-for: "//a[@class='result-import']"
|
wait-for: "//a[@class='result-import']"
|
||||||
assert-attribute: (
|
assert-attribute: (
|
||||||
"//a[@class='result-import']",
|
"//a[@class='result-import']",
|
||||||
|
@ -18,6 +20,8 @@ click: "//a[@class='result-import']"
|
||||||
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
|
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
|
||||||
|
|
||||||
// We now check that the alias is working as well on the reexport.
|
// We now check that the alias is working as well on the reexport.
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
write: (".search-input", "AliasForTheStdReexport")
|
write: (".search-input", "AliasForTheStdReexport")
|
||||||
wait-for: "//a[@class='result-import']"
|
wait-for: "//a[@class='result-import']"
|
||||||
assert-text: (
|
assert-text: (
|
||||||
|
|
|
@ -89,6 +89,8 @@ show-text: true
|
||||||
// We reload the page so the local storage settings are being used.
|
// We reload the page so the local storage settings are being used.
|
||||||
reload:
|
reload:
|
||||||
write: (".search-input", "thisisanalias")
|
write: (".search-input", "thisisanalias")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
// Checking that the colors for the alias element are the ones expected.
|
// Checking that the colors for the alias element are the ones expected.
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
size: (900, 1000)
|
size: (900, 1000)
|
||||||
write: (".search-input", "test")
|
write: (".search-input", "test")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
wait-for: "#search-settings"
|
wait-for: "#search-settings"
|
||||||
// The width is returned by "getComputedStyle" which returns the exact number instead of the
|
// The width is returned by "getComputedStyle" which returns the exact number instead of the
|
||||||
// CSS rule which is "50%"...
|
// CSS rule which is "50%"...
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// Checks that the "keyword" results have the expected text alongside them.
|
// Checks that the "keyword" results have the expected text alongside them.
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "CookieMonster")
|
write: (".search-input", "CookieMonster")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
// Note: The two next assert commands could be merged as one but readability would be
|
// Note: The two next assert commands could be merged as one but readability would be
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// First, try a search-by-name
|
// First, try a search-by-name
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "Foo")
|
write: (".search-input", "Foo")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
|
@ -22,6 +24,8 @@ wait-for-attribute: ("#titles > button:nth-of-type(3)", {"class": "selected"})
|
||||||
// Now try search-by-return
|
// Now try search-by-return
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "-> String")
|
write: (".search-input", "-> String")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
|
@ -42,6 +46,8 @@ wait-for-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
// Try with a search-by-return with no results
|
// Try with a search-by-return with no results
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "-> Something")
|
write: (".search-input", "-> Something")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
|
@ -50,6 +56,8 @@ assert-text: ("#titles > button:nth-of-type(1)", "In Function Return Types", STA
|
||||||
// Try with a search-by-parameter
|
// Try with a search-by-parameter
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "usize pattern")
|
write: (".search-input", "usize pattern")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
|
@ -58,6 +66,8 @@ assert-text: ("#titles > button:nth-of-type(1)", "In Function Parameters", START
|
||||||
// Try with a search-by-parameter-and-return
|
// Try with a search-by-parameter-and-return
|
||||||
goto: file://|DOC_PATH|/test_docs/index.html
|
goto: file://|DOC_PATH|/test_docs/index.html
|
||||||
write: (".search-input", "pattern -> str")
|
write: (".search-input", "pattern -> str")
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
// Waiting for the search results to appear...
|
// Waiting for the search results to appear...
|
||||||
wait-for: "#titles"
|
wait-for: "#titles"
|
||||||
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
|
||||||
|
|
|
@ -20,6 +20,8 @@ wait-for-css: ("#settings", {"display": "none"})
|
||||||
// Let's click on it when the search results are displayed.
|
// Let's click on it when the search results are displayed.
|
||||||
focus: ".search-input"
|
focus: ".search-input"
|
||||||
write: "test"
|
write: "test"
|
||||||
|
// To be SURE that the search will be run.
|
||||||
|
press-key: 'Enter'
|
||||||
wait-for: "#alternative-display #search"
|
wait-for: "#alternative-display #search"
|
||||||
click: "#settings-menu"
|
click: "#settings-menu"
|
||||||
wait-for-css: ("#settings", {"display": "block"})
|
wait-for-css: ("#settings", {"display": "block"})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue