Update browser-ui-test version

This commit is contained in:
Guillaume Gomez 2021-06-19 12:56:55 +02:00
parent 9cf05f3614
commit 1e222ba58a
21 changed files with 101 additions and 101 deletions

View File

@ -71,7 +71,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
# https://github.com/puppeteer/puppeteer/issues/375
#
# We also specify the version in case we need to update it to go around cache limitations.
RUN npm install -g browser-ui-test@0.2.14 --unsafe-perm=true
RUN npm install -g browser-ui-test@0.3.0 --unsafe-perm=true
ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \

View File

@ -1,3 +1,3 @@
goto: file://|DOC_PATH|/test_docs/index.html
click: ".srclink"
assert: (".line-numbers", 1)
assert-count: (".line-numbers", 1)

View File

@ -2,8 +2,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
goto: ./fn.check_list_code_block.html
// If the codeblock is the first element of the docblock, the information tooltip must have
// have some top margin to avoid going over the toggle (the "[+]").
assert: (".docblock > .information > .compile_fail", { "margin-top": "16px" })
assert-css: (".docblock > .information > .compile_fail", { "margin-top": "16px" })
// Checks that the other codeblocks don't have this top margin.
assert: ("ol > li > .information > .compile_fail", { "margin-top": "0px" })
assert: ("ol > li > .information > .ignore", { "margin-top": "0px" })
assert: (".docblock > .information > .ignore", { "margin-top": "0px" })
assert-css: ("ol > li > .information > .compile_fail", { "margin-top": "0px" })
assert-css: ("ol > li > .information > .ignore", { "margin-top": "0px" })
assert-css: (".docblock > .information > .ignore", { "margin-top": "0px" })

View File

@ -3,4 +3,4 @@ click: ".srclink"
click: "#sidebar-toggle"
wait-for: 500
fail: true
assert: ("#source-sidebar", { "left": "-300px" })
assert-css: ("#source-sidebar", { "left": "-300px" })

View File

@ -2,25 +2,25 @@ goto: file://|DOC_PATH|/test_docs/index.html
// First, we check that the search results are hidden when the Escape key is pressed.
write: (".search-input", "test")
wait-for: "#search > h1" // The search element is empty before the first search
assert: ("#search", "class", "content")
assert: ("#main", "class", "content hidden")
assert-attr: ("#search", {"class": "content"})
assert-attr: ("#main", {"class": "content hidden"})
press-key: "Escape"
assert: ("#search", "class", "content hidden")
assert: ("#main", "class", "content")
assert-attr: ("#search", {"class": "content hidden"})
assert-attr: ("#main", {"class": "content"})
// Check that focusing the search input brings back the search results
focus: ".search-input"
assert: ("#search", "class", "content")
assert: ("#main", "class", "content hidden")
assert-attr: ("#search", {"class": "content"})
assert-attr: ("#main", {"class": "content hidden"})
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
// hide the search results too.
click: "#help-button"
assert: ("#help", "class", "")
assert-attr: ("#help", {"class": ""})
press-key: "Escape"
assert: ("#help", "class", "hidden")
assert: ("#search", "class", "content")
assert: ("#main", "class", "content hidden")
assert-attr: ("#help", {"class": "hidden"})
assert-attr: ("#search", {"class": "content"})
assert-attr: ("#main", {"class": "content hidden"})
// Check that Escape hides the search results when a search result is focused.
focus: ".search-input"
@ -29,6 +29,6 @@ press-key: "ArrowDown"
assert-false: ".search-input:focus"
assert: "#results a:focus"
press-key: "Escape"
assert: ("#help", "class", "hidden")
assert: ("#search", "class", "content hidden")
assert: ("#main", "class", "content")
assert-attr: ("#help", {"class": "hidden"})
assert-attr: ("#search", {"class": "content hidden"})
assert-attr: ("#main", {"class": "content"})

View File

@ -1,7 +1,7 @@
goto: file://|DOC_PATH|/lib2/struct.Foo.html
// This test checks that the font weight is correctly applied.
assert: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"})
assert: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"})
assert: ("#method\.a_method > code", {"font-weight": "600"})
assert: ("#associatedtype\.X > code", {"font-weight": "600"})
assert: ("#associatedconstant\.Y > code", {"font-weight": "600"})
assert-css: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"})
assert-css: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"})
assert-css: ("#method\.a_method > code", {"font-weight": "600"})
assert-css: ("#associatedtype\.X > code", {"font-weight": "600"})
assert-css: ("#associatedconstant\.Y > code", {"font-weight": "600"})

View File

@ -1,15 +1,15 @@
// This test ensures that the element corresponding to the hash is displayed.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "")
assert-attr: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
// We first check that the impl block is open by default.
assert: ("#implementations + details", "open", "")
assert-attr: ("#implementations + details", {"open": ""})
// We collapse it.
click: "#implementations + details > summary"
// We check that it was collapsed as expected.
assert-false: ("#implementations + details", "open", "")
assert-attr-false: ("#implementations + details", {"open": ""})
// To ensure that we will click on the currently hidden method.
assert: (".sidebar-links > a", "must_use")
assert-text: (".sidebar-links > a", "must_use")
click: ".sidebar-links > a"
// We check that the impl block was opened as expected so that we can see the method.
assert: ("#implementations + details", "open", "")
assert-attr: ("#implementations + details", {"open": ""})

View File

@ -1,3 +1,3 @@
// This test ensures that the impl blocks are open by default.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
assert: ("#main > details.implementors-toggle", "open", "")
assert-attr: ("#main > details.implementors-toggle", {"open": ""})

View File

@ -10,5 +10,5 @@ write: (".search-input", "thisisanalias")
// Waiting for the search results to appear...
wait-for: "#titles"
// Checking that the colors for the alias element are the ones expected.
assert: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
assert: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})

View File

@ -2,4 +2,4 @@
goto: file://|DOC_PATH|/test_docs/index.html?search=some_more_function
// Waiting for the search results to appear...
wait-for: "#titles"
assert: (".search-results .desc code", "format!")
assert-text: (".search-results .desc code", "format!")

View File

@ -5,8 +5,8 @@ write: (".search-input", "test")
wait-for: "#titles"
// The width is returned by "getComputedStyle" which returns the exact number instead of the
// CSS rule which is "50%"...
assert: (".search-results div.desc", {"width": "320px"})
assert-css: (".search-results div.desc", {"width": "320px"})
size: (600, 100)
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
// when computed it's larger.
assert: (".search-results div.desc", {"width": "570px"})
assert-css: (".search-results div.desc", {"width": "570px"})

View File

@ -6,5 +6,5 @@ wait-for: "#titles"
// less good.
//
// Checking that the CSS is displaying " (keyword)" in italic.
assert: (".result-name span.keyword > i", "(keyword)")
assert: (".result-name span.keyword", "CookieMonster (keyword)")
assert-text: (".result-name span.keyword > i", "(keyword)")
assert-text: (".result-name span.keyword", "CookieMonster (keyword)")

View File

@ -2,7 +2,7 @@ goto: file://|DOC_PATH|/test_docs/index.html
write: (".search-input", "Foo")
// Waiting for the search results to appear...
wait-for: "#titles"
assert: ("#titles > button:nth-of-type(1)", "class", "selected")
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})
// To go back to the original "state"
goto: file://|DOC_PATH|/test_docs/index.html
@ -10,7 +10,7 @@ write: (".search-input", "-> String")
// Waiting for the search results to appear...
wait-for: "#titles"
// With this search, only the last tab shouldn't be empty so it should be selected.
assert: ("#titles > button:nth-of-type(3)", "class", "selected")
assert-attr: ("#titles > button:nth-of-type(3)", {"class": "selected"})
// To go back to the original "state"
goto: file://|DOC_PATH|/test_docs/index.html
@ -18,4 +18,4 @@ write: (".search-input", "-> Something")
// Waiting for the search results to appear...
wait-for: "#titles"
// With this search, all the tabs are empty so the first one should remain selected.
assert: ("#titles > button:nth-of-type(1)", "class", "selected")
assert-attr: ("#titles > button:nth-of-type(1)", {"class": "selected"})

View File

@ -8,19 +8,19 @@ press-key: "Escape"
assert-false: "input.search-input:focus"
// We now check for the help popup.
press-key: "?"
assert: ("#help", {"display": "flex"})
assert-css: ("#help", {"display": "flex"})
assert-false: "#help.hidden"
press-key: "Escape"
assert: ("#help.hidden", {"display": "none"})
assert-css: ("#help.hidden", {"display": "none"})
// Check for the themes list.
assert: ("#theme-choices", {"display": "none"})
assert-css: ("#theme-choices", {"display": "none"})
press-key: "t"
assert: ("#theme-choices", {"display": "block"})
assert-css: ("#theme-choices", {"display": "block"})
press-key: "t"
// We ensure that 't' hides back the menu.
assert: ("#theme-choices", {"display": "none"})
assert-css: ("#theme-choices", {"display": "none"})
press-key: "t"
assert: ("#theme-choices", {"display": "block"})
assert-css: ("#theme-choices", {"display": "block"})
press-key: "Escape"
// We ensure that 'Escape' hides the menu too.
assert: ("#theme-choices", {"display": "none"})
assert-css: ("#theme-choices", {"display": "none"})

View File

@ -1,23 +1,23 @@
goto: file://|DOC_PATH|/test_docs/index.html
assert: (".sidebar > .location", "Crate test_docs")
assert-text: (".sidebar > .location", "Crate test_docs")
// In modules, we only have one "location" element.
assert: (".sidebar .location", 1)
assert: (".sidebar-elems > #all-types", "See all test_docs's items")
assert-count: (".sidebar .location", 1)
assert-text: (".sidebar-elems > #all-types", "See all test_docs's items")
// We check that we have the crates list and that the "current" on is "test_docs".
assert: (".sidebar-elems > .crate > ul > li > a.current", "test_docs")
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "test_docs")
// And we're also supposed to have the list of items in the current module.
assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Enums")
assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits")
assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions")
assert: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions")
assert: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords")
assert: ("#structs + table td > a", "Foo")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Enums")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords")
assert-text: ("#structs + table td > a", "Foo")
click: "#structs + table td > a"
// PAGE: struct.Foo.html
assert: (".sidebar .location", 2)
assert-count: (".sidebar .location", 2)
// We check that there is no crate listed outside of the top level.
assert-false: ".sidebar-elems > .crate"
// We now go back to the crate page to click on the "lib2" crate link.
@ -26,35 +26,35 @@ click: ".sidebar-elems > .crate > ul > li:first-child > a"
// PAGE: lib2/index.html
goto: file://|DOC_PATH|/lib2/index.html
assert: (".sidebar > .location", "Crate lib2")
assert-text: (".sidebar > .location", "Crate lib2")
// We check that we have the crates list and that the "current" on is now "lib2".
assert: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
// We now go to the "foobar" function page.
assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
assert: ("#functions + table td > a", "foobar")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
assert-text: ("#functions + table td > a", "foobar")
click: "#functions + table td > a"
// PAGE: fn.foobar.html
// In items containing no items (like functions or constants) and in modules, we have one
// "location" elements.
assert: (".sidebar .location", 1)
assert-count: (".sidebar .location", 1)
// There is a "<br>" tag between "in" and "lib2", but it doesn't count as a space.
assert: (".sidebar .sidebar-elems .location", "Other items inlib2")
assert-text: (".sidebar .sidebar-elems .location", "Other items inlib2")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
goto: ./module/index.html
assert: (".sidebar > .location", "Module module")
assert-text: (".sidebar > .location", "Module module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
goto: ./sub_module/sub_sub_module/index.html
assert: (".sidebar > .location", "Module sub_sub_module")
assert-text: (".sidebar > .location", "Module sub_sub_module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions")
assert: ("#functions + table td > a", "foo")
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + table td > a", "foo")

View File

@ -3,11 +3,11 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
click: (40, 224) // This is the position of the span for line 4.
// Unfortunately, "#4" isn't a valid query selector, so we have to go around that limitation
// by instead getting the nth span.
assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted")
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
// We now check that the good spans are highlighted
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6
assert-false: (".line-numbers > span:nth-child(3)", "class", "line-highlighted")
assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted")
assert: (".line-numbers > span:nth-child(5)", "class", "line-highlighted")
assert: (".line-numbers > span:nth-child(6)", "class", "line-highlighted")
assert-false: (".line-numbers > span:nth-child(7)", "class", "line-highlighted")
assert-attr-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"})
assert-attr: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"})
assert-attr: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"})
assert-attr: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"})
assert-attr-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"})

View File

@ -3,8 +3,8 @@ click: "#theme-picker"
click: "#theme-choices > button:first-child"
wait-for: 500
// should be the ayu theme so let's check the color
assert: ("body", { "background-color": "rgb(15, 20, 25)" })
assert-css: ("body", { "background-color": "rgb(15, 20, 25)" })
click: "#theme-choices > button:last-child"
wait-for: 500
// should be the light theme so let's check the color
assert: ("body", { "background-color": "rgb(255, 255, 255)" })
assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })

View File

@ -1,21 +1,21 @@
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
size: (433, 600)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})
click: (4, 280) // This is the position of the top doc comment toggle
assert-false: (".top-doc", "open", "")
assert-attr-false: (".top-doc", {"open": ""})
click: (4, 280)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
click: (3, 280)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})
// Now we do the same but with a little bigger width
size: (600, 600)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})
click: (4, 240) // New Y position since all search elements are back on one line.
assert-false: (".top-doc", "open", "")
assert-attr-false: (".top-doc", {"open": ""})
click: (4, 240)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
click: (3, 240)
assert: (".top-doc", "open", "")
assert-attr: (".top-doc", {"open": ""})

View File

@ -1,10 +1,10 @@
goto: file://|DOC_PATH|/test_docs/index.html
assert: ("#main > details.top-doc", "open", "")
assert-attr: ("#main > details.top-doc", {"open": ""})
click: "#toggle-all-docs"
wait-for: 1000
// This is now collapsed so there shouldn't be the "open" attribute on details.
assert-false: ("#main > details.top-doc", "open", "")
assert-attr-false: ("#main > details.top-doc", {"open": ""})
click: "#toggle-all-docs"
wait-for: 1000
// Not collapsed anymore so the "open" attribute should be back.
assert: ("#main > details.top-doc", "open", "")
assert-attr: ("#main > details.top-doc", {"open": ""})

View File

@ -2,4 +2,4 @@
// has all the implementations toggled open by default, so users can
// find method names in those implementations with Ctrl-F.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
assert: (".rustdoc-toggle.implementors-toggle", "open", "")
assert-attr: (".rustdoc-toggle.implementors-toggle", {"open": ""})

View File

@ -1,7 +1,7 @@
goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html
assert: (".sidebar-links a:nth-of-type(1)", "another")
assert: (".sidebar-links a:nth-of-type(2)", "func1")
assert: (".sidebar-links a:nth-of-type(3)", "func2")
assert: (".sidebar-links a:nth-of-type(4)", "func3")
assert: (".sidebar-links a:nth-of-type(5)", "hello")
assert: (".sidebar-links a:nth-of-type(6)", "why_not")
assert-text: (".sidebar-links a:nth-of-type(1)", "another")
assert-text: (".sidebar-links a:nth-of-type(2)", "func1")
assert-text: (".sidebar-links a:nth-of-type(3)", "func2")
assert-text: (".sidebar-links a:nth-of-type(4)", "func3")
assert-text: (".sidebar-links a:nth-of-type(5)", "hello")
assert-text: (".sidebar-links a:nth-of-type(6)", "why_not")