Update rustdoc GUI tests

This commit is contained in:
Guillaume Gomez
2025-06-29 15:12:42 +02:00
parent 8e329b210d
commit 7c3bddaa74
3 changed files with 25 additions and 10 deletions

View File

@@ -129,13 +129,13 @@ define-function: ("check-line-numbers-existence", [], block {
wait-for-local-storage-false: {"rustdoc-line-numbers": "true" }
assert-false: ".example-line-numbers"
// Line numbers should still be there.
assert-css: ("[data-nosnippet]", { "display": "inline-block"})
assert-css: ("[data-nosnippet]", { "display": "block"})
// Now disabling the setting.
click: "input#line-numbers"
wait-for-local-storage: {"rustdoc-line-numbers": "true" }
assert-false: ".example-line-numbers"
// Line numbers should still be there.
assert-css: ("[data-nosnippet]", { "display": "inline-block"})
assert-css: ("[data-nosnippet]", { "display": "block"})
// Closing settings menu.
click: "#settings-menu"
wait-for-css: ("#settings", {"display": "none"})

View File

@@ -5,7 +5,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
// The next/prev buttons vertically scroll the code viewport between examples
move-cursor-to: ".scraped-example-list > .scraped-example"
wait-for: ".scraped-example-list > .scraped-example .next"
store-value: (initialScrollTop, 250)
store-value: (initialScrollTop, 236)
assert-property: (".scraped-example-list > .scraped-example .rust", {
"scrollTop": |initialScrollTop|,
}, NEAR)

View File

@@ -31,17 +31,32 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/index.html"
click: "#settings-menu"
wait-for: "#settings"
store-size: (".example-wrap .rust code", {"width": rust_width, "height": rust_height})
store-size: (".example-wrap .language-text code", {"width": txt_width, "height": txt_height})
store-property: (".example-wrap .rust code", {"scrollWidth": rust_width, "scrollHeight": rust_height})
store-property: (".example-wrap .language-text code", {"scrollWidth": txt_width, "scrollHeight": txt_height})
call-function: ("click-code-wrapping", {"expected": "true"})
wait-for-size-false: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|})
wait-for-property-false: (
".example-wrap .rust code",
{"scrollWidth": |rust_width|, "scrollHeight": |rust_height|},
)
store-size: (".example-wrap .rust code", {"width": new_rust_width, "height": new_rust_height})
store-size: (".example-wrap .language-text code", {"width": new_txt_width, "height": new_txt_height})
store-property: (
".example-wrap .rust code",
{"scrollWidth": new_rust_width, "scrollHeight": new_rust_height},
)
store-property: (
".example-wrap .language-text code",
{"scrollWidth": new_txt_width, "scrollHeight": new_txt_height},
)
assert: |rust_width| > |new_rust_width| && |rust_height| < |new_rust_height|
assert: |txt_width| > |new_txt_width| && |txt_height| < |new_txt_height|
call-function: ("click-code-wrapping", {"expected": "false"})
wait-for-size: (".example-wrap .rust code", {"width": |rust_width|, "height": |rust_height|})
assert-size: (".example-wrap .language-text code", {"width": |txt_width|, "height": |txt_height|})
wait-for-property: (
".example-wrap .rust code",
{"scrollWidth": |rust_width|, "scrollHeight": |rust_height|},
)
assert-property: (
".example-wrap .language-text code",
{"scrollWidth": |txt_width|, "scrollHeight": |txt_height|},
)