Skip to content

Commit

Permalink
Update to new browser-ui-test version
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 1, 2024
1 parent 6bb6b81 commit 59120d0
Show file tree
Hide file tree
Showing 59 changed files with 267 additions and 249 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.11
0.17.0
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/anchors.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/code-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/codeblock-tooltip.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/cursor.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/docblock-code-block-line-number.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/docblock-table.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/escape-key.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/globals.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/go-to-collapsed-elem.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/headers-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions tests/rustdoc-gui/headings-anchor.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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" })
Expand All @@ -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"})
10 changes: 5 additions & 5 deletions tests/rustdoc-gui/headings.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -220,7 +220,7 @@ call-function: (

define-function: (
"check-since-color",
(theme),
[theme],
block {
set-local-storage: {"rustdoc-theme": |theme|}
reload:
Expand All @@ -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"})
8 changes: 4 additions & 4 deletions tests/rustdoc-gui/help-page.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/highlight-colors.goml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ show-text: true

define-function: (
"check-colors",
(
[
theme,
kw,
kw2,
Expand All @@ -20,7 +20,7 @@ define-function: (
question_mark,
comment,
doc_comment,
),
],
block {
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/item-decl-colors.goml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fail-on-request-error: false

define-function: (
"check-colors",
(
[
theme,
attr_color,
trait_color,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/item-decl-comment-highlighting.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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|,
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/item-info-alignment.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/item-info.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down
17 changes: 13 additions & 4 deletions tests/rustdoc-gui/jump-to-def-background.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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",
})
12 changes: 6 additions & 6 deletions tests/rustdoc-gui/label-next-to-symbol.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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"],
)
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/links-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -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|,
Expand Down
Loading

0 comments on commit 59120d0

Please sign in to comment.