Update to new browser-ui-test version

This commit is contained in:
Guillaume Gomez 2024-04-01 21:11:22 +02:00
parent 6bb6b816bf
commit 59120d0ef5
59 changed files with 267 additions and 249 deletions

View File

@ -2,7 +2,7 @@
define-function: (
"check-colors",
(theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color),
[theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color],
block {
go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
// This is needed to ensure that the text color is computed.

View File

@ -8,7 +8,7 @@ show-text: true
define-function: (
"check-colors",
(theme, doc_code_color, doc_inline_code_color),
[theme, doc_code_color, doc_inline_code_color],
block {
// Set the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-colors",
(theme, background, color, border),
[theme, background, color, border],
block {
// Setting the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}

View File

@ -8,7 +8,7 @@ assert-css: ("#toggle-all-docs", {"cursor": "pointer"})
assert-css: ("#copy-path", {"cursor": "pointer"})
// the search tabs
write: (".search-input", "Foo")
write-into: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -10,7 +10,7 @@ assert-false: "pre.example-line-numbers"
// Let's now check some CSS properties...
define-function: (
"check-colors",
(theme, color),
[theme, color],
block {
// We now set the setting to show the line numbers on code examples.
set-local-storage: {

View File

@ -6,7 +6,7 @@ compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock tab
define-function: (
"check-colors",
(theme, border_color, zebra_stripe_color),
[theme, border_color, zebra_stripe_color],
block {
set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
reload:

View File

@ -2,7 +2,7 @@
// current content displayed.
go-to: "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")
write-into: (".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

View File

@ -10,7 +10,7 @@ assert-window-property: {"srcIndex": null}
// Form input
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "Foo")
write-into: (".search-input", "Foo")
press-key: 'Enter'
wait-for: "#search-tabs"
assert-window-property-false: {"searchIndex": null}

View File

@ -9,14 +9,14 @@ set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
click: "//*[@class='sidebar']//a[@href='#method.must_use']"
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
define-function: ("collapsed-from-search", (), block {
define-function: ("collapsed-from-search", [], block {
// Now we do the same through search result.
// First we reload the page without the anchor in the URL.
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// Then we collapse the section again...
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
// Then we run the search.
write: (".search-input", "foo::must_use")
write-into: (".search-input", "foo::must_use")
wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})

View File

@ -2,7 +2,7 @@
define-function: (
"check-colors",
(theme, color, code_header_color, focus_background_color, headings_color),
[theme, color, code_header_color, focus_background_color, headings_color],
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed.

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-heading-anchor",
(heading_id),
[heading_id],
block {
// The anchor should not be displayed by default.
assert-css: ("#" + |heading_id| + " .doc-anchor", { "display": "none" })
@ -27,6 +27,6 @@ move-cursor-to: "#top-doc-prose-title"
// to prevent it from overlapping with the `[-]` element.
assert-css: ("#top-doc-prose-title:hover .doc-anchor", { "display": "none" })
call-function: ("check-heading-anchor", ("top-doc-prose-sub-heading"))
call-function: ("check-heading-anchor", ("top-doc-prose-sub-sub-heading"))
call-function: ("check-heading-anchor", ("you-know-the-drill"))
call-function: ("check-heading-anchor", {"heading_id": "top-doc-prose-sub-heading"})
call-function: ("check-heading-anchor", {"heading_id": "top-doc-prose-sub-sub-heading"})
call-function: ("check-heading-anchor", {"heading_id": "you-know-the-drill"})

View File

@ -156,7 +156,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
define-function: (
"check-colors",
(theme, heading_color, small_heading_color, heading_border_color),
[theme, heading_color, small_heading_color, heading_border_color],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
@ -220,7 +220,7 @@ call-function: (
define-function: (
"check-since-color",
(theme),
[theme],
block {
set-local-storage: {"rustdoc-theme": |theme|}
reload:
@ -229,6 +229,6 @@ define-function: (
)
go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
call-function: ("check-since-color", ("ayu"))
call-function: ("check-since-color", ("dark"))
call-function: ("check-since-color", ("light"))
call-function: ("check-since-color", {"theme": "ayu"})
call-function: ("check-since-color", {"theme": "dark"})
call-function: ("check-since-color", {"theme": "light"})

View File

@ -7,17 +7,17 @@ assert-css: ("#help dd", {"font-size": "16px"})
click: "#help-button > a"
assert-css: ("#help", {"display": "block"})
compare-elements-property: (".sub", "#help", ["offsetWidth"])
compare-elements-position: (".sub", "#help", ("x"))
compare-elements-position: (".sub", "#help", ["x"])
set-window-size: (500, 1000) // Try mobile next.
assert-css: ("#help", {"display": "block"})
compare-elements-property: (".sub", "#help", ["offsetWidth"])
compare-elements-position: (".sub", "#help", ("x"))
compare-elements-position: (".sub", "#help", ["x"])
// Checking the color of the elements of the help menu.
show-text: true
define-function: (
"check-colors",
(theme, color, background, box_shadow),
[theme, color, background, box_shadow],
block {
// Setting the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
@ -60,7 +60,7 @@ assert-css: ("#help dd", {"font-size": "16px"})
click: "#help-button > a"
assert-css: ("#help", {"display": "none"})
compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
compare-elements-position-false: (".sub", "#help", ("x"))
compare-elements-position-false: (".sub", "#help", ["x"])
// This test ensures that the "the rustdoc book" anchor link within the help popover works.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-colors",
(
[
theme,
kw,
kw2,
@ -20,7 +20,7 @@ define-function: (
question_mark,
comment,
doc_comment,
),
],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -6,7 +6,7 @@ fail-on-request-error: false
define-function: (
"check-colors",
(
[
theme,
attr_color,
trait_color,
@ -16,7 +16,7 @@ define-function: (
constant_color,
fn_color,
assoc_type_color,
),
],
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"
show-text: true

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-item-decl-comment",
(theme, url, comment_color),
[theme, url, comment_color],
block {
go-to: |url|
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
@ -15,7 +15,7 @@ define-function: (
define-function: (
"check-items-for-theme",
(theme, comment_color),
[theme, comment_color],
block {
call-function: ("check-item-decl-comment", {
"theme": |theme|,

View File

@ -4,7 +4,7 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html"
// First, we try it in "desktop" mode.
set-window-size: (1200, 870)
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])
// Next, we try it in "mobile" mode (max-width: 700px).
set-window-size: (650, 650)
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])

View File

@ -31,13 +31,13 @@ assert-count: ("#main-content > .item-info .stab", 2)
compare-elements-position-false: (
"#main-content > .item-info .stab:nth-of-type(1)",
"#main-content > .item-info .stab:nth-of-type(2)",
("y"),
["y"],
)
// But they should have the same `x` position.
compare-elements-position: (
"#main-content > .item-info .stab:nth-of-type(1)",
"#main-content > .item-info .stab:nth-of-type(2)",
("x"),
["x"],
)
// They are supposed to have the same height too.
compare-elements-css: (

View File

@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
define-function: (
"check-background-color",
(theme, background_color),
[theme, background_color],
block {
// Set the theme.
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
@ -17,6 +17,15 @@ define-function: (
},
)
call-function: ("check-background-color", ("ayu", "#333"))
call-function: ("check-background-color", ("dark", "#333"))
call-function: ("check-background-color", ("light", "#eee"))
call-function: ("check-background-color", {
"theme": "ayu",
"background_color": "#333",
})
call-function: ("check-background-color", {
"theme": "dark",
"background_color": "#333",
})
call-function: ("check-background-color", {
"theme": "light",
"background_color": "#eee",
})

View File

@ -27,14 +27,14 @@ compare-elements-position-near: (
compare-elements-position: (
".item-name .stab.deprecated",
".item-name .stab.portability",
("y"),
["y"],
)
// Ensure no wrap
compare-elements-position: (
"//*[@class='item-name']//a[text()='replaced_function']/..",
"//*[@class='desc docblock-short'][text()='a thing with a label']",
("y"),
["y"],
)
// Mobile view
@ -49,19 +49,19 @@ compare-elements-position-near: (
compare-elements-position: (
".item-name .stab.deprecated",
".item-name .stab.portability",
("y"),
["y"],
)
// Ensure wrap
compare-elements-position-false: (
"//*[@class='item-name']//a[text()='replaced_function']/..",
"//*[@class='desc docblock-short'][text()='a thing with a label']",
("y"),
["y"],
)
compare-elements-position-false: (
".item-name .stab.deprecated",
"//*[@class='desc docblock-short'][text()='a thing with a label']",
("y"),
["y"],
)
// Ensure it doesn't expand.
@ -72,5 +72,5 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html"
compare-elements-position-false: (
"//*[@class='stab portability']/code[text()='appservice-api-c']",
"//*[@class='stab portability']/code[text()='server']",
("y"),
["y"],
)

View File

@ -6,8 +6,8 @@ show-text: true
define-function: (
"check-colors",
(theme, mod, macro, struct, enum, trait, fn, type, union, keyword,
sidebar, sidebar_current, sidebar_current_background),
[theme, mod, macro, struct, enum, trait, fn, type, union, keyword,
sidebar, sidebar_current, sidebar_current_background],
block {
set-local-storage: {
"rustdoc-theme": |theme|,

View File

@ -7,13 +7,13 @@ set-window-size: (1100, 600)
compare-elements-position: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("y"),
["y"],
)
// Checking they don't have the same x position.
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("x"),
["x"],
)
// The `i` should be *after* the type.
assert-position: (
@ -37,7 +37,7 @@ compare-elements-position-near: (
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
"//*[@class='tooltip popover']",
("x")
["x"]
)
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
move-cursor-to: "//h1"
@ -48,7 +48,7 @@ set-window-size: (1055, 600)
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("y", "x"),
["y", "x"],
)
// Now both the `i` and the struct name should be on the next line.
@ -57,13 +57,13 @@ set-window-size: (980, 600)
compare-elements-position: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("y"),
["y"],
)
// Checking they don't have the same x position.
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("x"),
["x"],
)
// The `i` should be *after* the type.
assert-position: (
@ -81,13 +81,13 @@ set-window-size: (650, 600)
compare-elements-position: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("y"),
["y"],
)
// Checking they don't have the same x position.
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
("x"),
["x"],
)
// The `i` should be *after* the type.
assert-position: (
@ -109,7 +109,7 @@ compare-elements-position-near: (
compare-elements-position-false: (
"//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
"//*[@class='tooltip popover']",
("x")
["x"]
)
assert-position: (
"//*[@class='tooltip popover']",
@ -122,7 +122,7 @@ assert-count: ("//*[@class='tooltip popover']", 0)
// Now check the colors.
define-function: (
"check-colors",
(theme, header_color, content_color, type_color, trait_color, link_color),
[theme, header_color, content_color, type_color, trait_color, link_color],
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
// This is needed to ensure that the text color is computed.

View File

@ -31,7 +31,7 @@ assert-css: ("#settings-menu .popover", {"display": "none"})
define-function: (
"check-popover-colors",
(theme, border_color),
[theme, border_color],
block {
set-local-storage: {
"rustdoc-theme": |theme|,

View File

@ -7,7 +7,7 @@ show-text: true
define-function: (
"check-run-button",
(theme, color, background, hover_color, hover_background),
[theme, color, background, hover_color, hover_background],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/staged_api/index.html"
define-function: (
"check-logo",
(theme, filter),
[theme, filter],
block {
// Going to the doc page.
go-to: "file://" + |DOC_PATH| + "/staged_api/index.html"

View File

@ -4,8 +4,8 @@ show-text: true
define-function: (
"check-colors",
(theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
help_hover_color),
[theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
help_hover_color],
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
reload:
@ -64,7 +64,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
define-function: (
"check-background",
(theme, background_color_start, background_color_end),
[theme, background_color_start, background_color_end],
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
reload:

View File

@ -5,7 +5,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
show-text: true
define-function: (
"check-color",
(theme, toggle_line_color, toggle_line_hover_color),
[theme, toggle_line_color, toggle_line_hover_color],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -4,7 +4,7 @@
// First, try a search-by-name
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Intentionally wrong spelling of "NotableStructWithLongName"
write: (".search-input", "NotableStructWithLongNamr")
write-into: (".search-input", "NotableStructWithLongNamr")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -41,7 +41,7 @@ assert-text: (
// Now, explicit return values
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Intentionally wrong spelling of "NotableStructWithLongName"
write: (".search-input", "-> NotableStructWithLongNamr")
write-into: (".search-input", "-> NotableStructWithLongNamr")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -58,7 +58,7 @@ assert-text: (
// Now, generic correction
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Intentionally wrong spelling of "NotableStructWithLongName"
write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
write-into: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -75,7 +75,7 @@ assert-text: (
// Now, generic correction plus error
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Intentionally wrong spelling of "NotableStructWithLongName"
write: (".search-input", "Foo<NotableStructWithLongNamr>,y")
write-into: (".search-input", "Foo<NotableStructWithLongNamr>,y")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -91,7 +91,7 @@ assert-text: (
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Intentionally wrong spelling of "NotableStructWithLongName"
write: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
write-into: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-colors",
(theme, error_background),
[theme, error_background],
block {
// Setting the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}

View File

@ -1,7 +1,7 @@
// Checks that the crate search filtering is handled correctly and changes the results.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true
write: (".search-input", "test")
write-into: (".search-input", "test")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -4,10 +4,10 @@ show-text: true
define-function: (
"check-search-colors",
(
[
theme, border, background, search_input_color, search_input_border_focus,
menu_button_border, menu_button_a_color, menu_button_a_border_hover, menu_a_color,
),
],
block {
set-local-storage: {
"rustdoc-theme": |theme|,

View File

@ -1,7 +1,7 @@
// Checks that the search tab results work correctly with function signature syntax
// First, try a search-by-name
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "Foo")
write-into: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -4,7 +4,7 @@ show-text: true
define-function: (
"check-no-result",
(theme, link, link_hover),
[theme, link, link_hover],
block {
// Changing theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}

View File

@ -6,7 +6,7 @@ reload:
// First we check that the reexport has the correct ID and no background color.
assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;")
assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"})
write: (".search-input", "TheStdReexport")
write-into: (".search-input", "TheStdReexport")
// To be SURE that the search will be run.
press-key: 'Enter'
wait-for: "//a[@class='result-import']"
@ -22,7 +22,7 @@ wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a
// 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-into: (".search-input", "AliasForTheStdReexport")
wait-for: "//a[@class='result-import']"
assert-text: (
"a.result-import .result-name",

View File

@ -2,7 +2,7 @@
define-function: (
"check-result-color",
(result_kind, color, hover_color),
[result_kind, color, hover_color],
block {
assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL)
assert-css: (
@ -78,60 +78,60 @@ store-value: (hover_background_color, "#3c3c3c") // hover background color
store-value: (grey, "#999")
call-function: (
"check-result-color", (
"keyword", // item kind
"#39afd7", // color of item kind
"#39afd7", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "keyword", // item kind
"color": "#39afd7", // color of item kind
"hover_color": "#39afd7", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"struct", // item kind
"#ffa0a5", // color of item kind
"#ffa0a5", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "struct", // item kind
"color": "#ffa0a5", // color of item kind
"hover_color": "#ffa0a5", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
"#39afd7", // color of item kind
"#39afd7", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "associatedtype", // item kind
"color": "#39afd7", // color of item kind
"hover_color": "#39afd7", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"tymethod", // item kind
"#fdd687", // color of item kind
"#fdd687", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "tymethod", // item kind
"color": "#fdd687", // color of item kind
"hover_color": "#fdd687", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"method", // item kind
"#fdd687", // color of item kind
"#fdd687", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "method", // item kind
"color": "#fdd687", // color of item kind
"hover_color": "#fdd687", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"structfield", // item kind
"#0096cf", // color of item kind
"#fff", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "structfield", // item kind
"color": "#0096cf", // color of item kind
"hover_color": "#fff", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"macro", // item kind
"#a37acc", // color of item kind
"#a37acc", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "macro", // item kind
"color": "#a37acc", // color of item kind
"hover_color": "#a37acc", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"fn", // item kind
"#fdd687", // color of item kind
"#fdd687", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "fn", // item kind
"color": "#fdd687", // color of item kind
"hover_color": "#fdd687", // color of hovered/focused item kind
},
)
// Checking the `<a>` container.
@ -190,60 +190,60 @@ store-value: (hover_background_color, "#616161") // hover background color
store-value: (grey, "#ccc")
call-function: (
"check-result-color", (
"keyword", // item kind
"#d2991d", // color of item kind
"#d2991d", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "keyword", // item kind
"color": "#d2991d", // color of item kind
"hover_color": "#d2991d", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"struct", // item kind
"#2dbfb8", // color of item kind
"#2dbfb8", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "struct", // item kind
"color": "#2dbfb8", // color of item kind
"hover_color": "#2dbfb8", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
"#d2991d", // color of item kind
"#d2991d", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "associatedtype", // item kind
"color": "#d2991d", // color of item kind
"hover_color": "#d2991d", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"tymethod", // item kind
"#2bab63", // color of item kind
"#2bab63", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "tymethod", // item kind
"color": "#2bab63", // color of item kind
"hover_color": "#2bab63", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"method", // item kind
"#2bab63", // color of item kind
"#2bab63", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "method", // item kind
"color": "#2bab63", // color of item kind
"hover_color": "#2bab63", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"structfield", // item kind
"#ddd", // color of item kind
"#ddd", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "structfield", // item kind
"color": "#ddd", // color of item kind
"hover_color": "#ddd", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"macro", // item kind
"#09bd00", // color of item kind
"#09bd00", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "macro", // item kind
"color": "#09bd00", // color of item kind
"hover_color": "#09bd00", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"fn", // item kind
"#2bab63", // color of item kind
"#2bab63", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "fn", // item kind
"color": "#2bab63", // color of item kind
"hover_color": "#2bab63", // color of hovered/focused item kind
},
)
// Checking the `<a>` container.
@ -287,60 +287,60 @@ store-value: (hover_background_color, "#ccc") // hover background color
store-value: (grey, "#999")
call-function: (
"check-result-color", (
"keyword", // item kind
"#3873ad", // color of item kind
"#3873ad", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "keyword", // item kind
"color": "#3873ad", // color of item kind
"hover_color": "#3873ad", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"struct", // item kind
"#ad378a", // color of item kind
"#ad378a", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "struct", // item kind
"color": "#ad378a", // color of item kind
"hover_color": "#ad378a", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
"#3873ad", // color of item kind
"#3873ad", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "associatedtype", // item kind
"color": "#3873ad", // color of item kind
"hover_color": "#3873ad", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"tymethod", // item kind
"#ad7c37", // color of item kind
"#ad7c37", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "tymethod", // item kind
"color": "#ad7c37", // color of item kind
"hover_color": "#ad7c37", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"method", // item kind
"#ad7c37", // color of item kind
"#ad7c37", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "method", // item kind
"color": "#ad7c37", // color of item kind
"hover_color": "#ad7c37", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"structfield", // item kind
"#000", // color of item kind
"#000", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "structfield", // item kind
"color": "#000", // color of item kind
"hover_color": "#000", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"macro", // item kind
"#068000", // color of item kind
"#068000", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "macro", // item kind
"color": "#068000", // color of item kind
"hover_color": "#068000", // color of hovered/focused item kind
},
)
call-function: (
"check-result-color", (
"fn", // item kind
"#ad7c37", // color of item kind
"#ad7c37", // color of hovered/focused item kind
),
"check-result-color", {
"result_kind": "fn", // item kind
"color": "#ad7c37", // color of item kind
"hover_color": "#ad7c37", // color of hovered/focused item kind
},
)
// Checking the `<a>` container.
@ -358,11 +358,11 @@ show-text: true
define-function: (
"check-alias",
(theme, alias, grey),
[theme, alias, grey],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
write: (".search-input", "thisisanalias")
write-into: (".search-input", "thisisanalias")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -2,7 +2,7 @@
// Checks that the search results have the expected width.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-window-size: (900, 1000)
write: (".search-input", "test")
write-into: (".search-input", "test")
// To be SURE that the search will be run.
press-key: 'Enter'
wait-for: "#crate-search"
@ -69,7 +69,7 @@ assert-css: ("#search", {"width": "640px"})
show-text: true
define-function: (
"check-filter",
(theme, border, filter, hover_border, hover_filter),
[theme, border, filter, hover_border, hover_filter],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -5,7 +5,7 @@
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// This should link to the inherent impl
write: (".search-input", "ZyxwvutMethodDisambiguation -> bool")
write-into: (".search-input", "ZyxwvutMethodDisambiguation -> bool")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -25,7 +25,7 @@ assert: "section:target"
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// This should link to the trait impl
write: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize")
write-into: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -1,6 +1,6 @@
// Checks that the "keyword" results have the expected text alongside them.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "CookieMonster")
write-into: (".search-input", "CookieMonster")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -1,7 +1,7 @@
// Checks that the search tab results work correctly with function signature syntax
// First, try a search-by-name
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "Foo")
write-into: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -23,7 +23,7 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected
// Now try search-by-return
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "-> String")
write-into: (".search-input", "-> String")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -45,7 +45,7 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected
// Try with a search-by-return with no results
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "-> Something")
write-into: (".search-input", "-> Something")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -55,7 +55,7 @@ assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types"
// Try with a search-by-parameter
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "usize,pattern")
write-into: (".search-input", "usize,pattern")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
@ -65,7 +65,7 @@ assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Parameters",
// Try with a search-by-parameter-and-return
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "pattern -> str")
write-into: (".search-input", "pattern -> str")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...

View File

@ -4,9 +4,9 @@ show-text: true
define-function: (
"check-colors",
(theme, background, background_selected, background_hover, border_bottom,
[theme, background, background_selected, background_hover, border_bottom,
border_bottom_selected, border_bottom_hover, border_top, border_top_selected,
border_top_hover),
border_top_hover],
block {
// Setting the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
@ -93,12 +93,12 @@ assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth":
compare-elements-position: (
"#search-tabs > button:nth-child(1) > .count",
"#search-tabs > button:nth-child(2) > .count",
("y")
["y"]
)
compare-elements-position: (
"#search-tabs > button:nth-child(2) > .count",
"#search-tabs > button:nth-child(3) > .count",
("y")
["y"]
)
// Check that counts are beside the titles and haven't wrapped
compare-elements-position-near: (
@ -135,12 +135,12 @@ assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth":
compare-elements-position: (
"#search-tabs > button:nth-child(1) > .count",
"#search-tabs > button:nth-child(2) > .count",
("y")
["y"]
)
compare-elements-position: (
"#search-tabs > button:nth-child(2) > .count",
"#search-tabs > button:nth-child(3) > .count",
("y")
["y"]
)
// Check that counts are NOT beside the titles; now they have wrapped
compare-elements-position-near-false: (

View File

@ -6,7 +6,7 @@ fail-on-request-error: false
define-function: (
"check-setting",
(storage_value, setting_attribute_value, toggle_attribute_value),
[storage_value, setting_attribute_value, toggle_attribute_value],
block {
assert-local-storage: {"rustdoc-auto-hide-large-items": |storage_value|}
click: "#settings-menu"

View File

@ -3,7 +3,7 @@
define-function: (
"check-setting",
(storage_value, setting_attribute_value, toggle_attribute_value),
[storage_value, setting_attribute_value, toggle_attribute_value],
block {
assert-local-storage: {"rustdoc-auto-hide-method-docs": |storage_value|}
click: "#settings-menu"

View File

@ -2,7 +2,7 @@
define-function: (
"check-setting",
(storage_value, setting_attribute_value, toggle_attribute_value),
[storage_value, setting_attribute_value, toggle_attribute_value],
block {
assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|}
click: "#settings-menu"

View File

@ -2,7 +2,7 @@
define-function: (
"check-setting",
(storage_value, setting_attribute_value),
[storage_value, setting_attribute_value],
block {
assert-local-storage: {"rustdoc-go-to-only-result": |storage_value|}
click: "#settings-menu"
@ -32,7 +32,7 @@ assert-local-storage: {"rustdoc-go-to-only-result": "true"}
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
// We enter it into the search.
write: (".search-input", "HasALongTraitWithParams")
write-into: (".search-input", "HasALongTraitWithParams")
wait-for-document-property: {"title": "HasALongTraitWithParams in lib2 - Rust"}
assert-window-property: ({"location": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH)

View File

@ -304,7 +304,7 @@ wait-for: "#settings"
assert-css: (".setting-radio", {"cursor": "pointer"})
assert-attribute-false: ("#settings", {"class": "popover"}, CONTAINS)
compare-elements-position: (".sub form", "#settings", ("x"))
compare-elements-position: (".sub form", "#settings", ["x"])
// Check that setting-line has the same margin in this mode as in the popover.
assert-css: (".setting-line", {"margin": |setting_line_margin|})

View File

@ -6,12 +6,12 @@ show-text: true
define-function: (
"check-colors",
(
[
theme, struct, struct_hover, struct_hover_background, enum, enum_hover,
enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover,
trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover,
type_hover_background, keyword, keyword_hover, keyword_hover_background,
),
],
block {
set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
reload:

View File

@ -57,7 +57,7 @@ show-text: true
define-function: (
"check-colors",
(theme, color, background),
[theme, color, background],
block {
set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
reload:

View File

@ -30,9 +30,9 @@ show-text: true
define-function: (
"check-colors",
(
[
theme, color, color_hover, background, background_hover, background_toggle,
),
],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -6,7 +6,7 @@ show-text: true
// First, check the sidebar colors.
define-function: (
"check-colors",
(theme, color, background_color),
[theme, color, background_color],
block {
set-local-storage: {
"rustdoc-theme": |theme|,

View File

@ -6,7 +6,7 @@ show-text: true
// First, check the sidebar colors.
define-function: (
"check-colors",
(theme, color, background_color),
[theme, color, background_color],
block {
set-local-storage: {
"rustdoc-theme": |theme|,

View File

@ -21,7 +21,7 @@ assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-h
define-function: (
"check-colors",
(theme, color, background_color, highlight_color, highlight_background_color),
[theme, color, background_color, highlight_color, highlight_background_color],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
@ -61,7 +61,7 @@ call-function: ("check-colors", {
})
// This is to ensure that the content is correctly align with the line numbers.
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ["y"])
// Check the `href` property so that users can treat anchors as links.
assert-property: (".src-line-numbers > a:nth-child(1)", {
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
@ -122,7 +122,7 @@ store-property: (
)
define-function: (
"check-sidebar-dir-entry",
(x, y),
[x, y],
block {
assert: "details:first-of-type.dir-entry[open] > summary::marker"
assert-css: ("#src-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"})

View File

@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true
define-function: (
"check-badge",
(theme, background, color),
[theme, background, color],
block {
set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"

View File

@ -7,7 +7,7 @@ assert: "#method\.a_method:target"
define-function: (
"check-style",
(theme, background, border),
[theme, background, border],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -49,7 +49,7 @@ assert-attribute: ("details.toggle", {"open": ""}, ALL)
show-text: true
define-function: (
"check-color",
(theme, filter),
[theme, filter],
block {
// Setting the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}

View File

@ -47,18 +47,18 @@ assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
// On desktop, they wrap when too big.
set-window-size: (1100, 800)
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"])
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y"))
compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ["y"])
// make sure there is a gap between them
compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550})
// On mobile, they always wrap.
set-window-size: (600, 600)
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"])
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"])
// Now we will check that the scrolling is working.
// First on an item with "hidden methods".

View File

@ -13,7 +13,7 @@ define-function: (
"sup-check",
// `theme` is the theme being tested.
// `color` is the expected color of the `<sup>` element.
(theme, color),
[theme, color],
block {
// Set the theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
@ -23,6 +23,15 @@ define-function: (
},
)
call-function: ("sup-check", ("ayu", "#c5c5c5"))
call-function: ("sup-check", ("dark", "#ddd"))
call-function: ("sup-check", ("light", "black"))
call-function: ("sup-check", {
"theme": "ayu",
"color": "#c5c5c5",
})
call-function: ("sup-check", {
"theme": "dark",
"color": "#ddd",
})
call-function: ("sup-check", {
"theme": "light",
"color": "black",
})

View File

@ -5,7 +5,7 @@ show-text: true
store-value: (default_y_pos, 5)
define-function: (
"check-warning",
(theme, color, border_color),
[theme, color, border_color],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:

View File

@ -3,25 +3,25 @@ go-to: "file://" + |DOC_PATH| + "/lib2/trait.Whitespace.html"
show-text: true
// First, we check in the trait definition if the where clause is "on its own" (not on the same
// line than "pub trait Whitespace<Idx>").
compare-elements-position-false: (".item-decl code", "div.where", ("y"))
compare-elements-position-false: (".item-decl code", "div.where", ["y"])
// And that the code following it isn't on the same line either.
compare-elements-position-false: (".item-decl .fn", "div.where", ("y"))
compare-elements-position-false: (".item-decl .fn", "div.where", ["y"])
go-to: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html"
// We make the screen a bit wider to ensure that the trait impl is on one line.
set-window-size: (915, 915)
compare-elements-position-false: ("#method\.new .fn", "#method\.new div.where", ("y"))
compare-elements-position-false: ("#method\.new .fn", "#method\.new div.where", ["y"])
// We ensure that both the trait name and the struct name are on the same line in
// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
compare-elements-position: (
"#trait-implementations-list .impl h3 .trait",
"#trait-implementations-list .impl h3 .struct",
("y"),
["y"],
)
// And we now check that the where condition isn't on the same line.
compare-elements-position-false: (
"#trait-implementations-list .impl h3 .trait",
"#trait-implementations-list .impl h3 div.where",
("y"),
["y"],
)