Skip to content

Commit

Permalink
Update GUI test to check for the presence of horizontal scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez authored and syphar committed Jan 12, 2024
1 parent ad1d680 commit e3e1502
Showing 1 changed file with 77 additions and 62 deletions.
139 changes: 77 additions & 62 deletions gui-tests/topbar-resize.goml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ define-function: (
block {
set-window-size: (|width|, |window_height|)
wait-for-css: (".nav-container > .container a > .title", {"display": |text_display|})

// We check that there is no horizontal scrollbar (which would be because of docs.rs
// topbar).
assert-window-property: {"innerWidth": |width|}

assert-css: ("#search-input-nav", {"display": |search_display|, "max-width": |search_max_width|})
assert-size: ("body > .nav-container", {"height": |top_navbar_height|})

Expand All @@ -17,67 +22,77 @@ define-function: (
}
)

go-to: |DOC_PATH| + "/sysinfo"
define-function: (
"check-topbar-sizes",
(),
block {
set-window-size: (1100, |window_height|)
store-size: ("body > .nav-container", {"height": top_navbar_height})

set-window-size: (1100, |window_height|)
store-size: ("body > .nav-container", {"height": top_navbar_height})
call-function: ("check-topbar", {
"width": 1000,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 900,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 872,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
// From this point, text should not be displayed anymore.
call-function: ("check-topbar", {
"width": 871,
"text_display": "none",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 768,
"text_display": "none",
"search_display": "block",
"search_max_width": "200px",
})
// From this point, search input should be smaller.
call-function: ("check-topbar", {
"width": 767,
"text_display": "none",
"search_display": "block",
"search_max_width": "150px",
})
call-function: ("check-topbar", {
"width": 568,
"text_display": "none",
"search_display": "block",
"search_max_width": "150px",
})
// From this point, search input should not be displayed anymore.
call-function: ("check-topbar", {
"width": 567,
"text_display": "none",
"search_display": "none",
"search_max_width": "150px",
})
// Even at very small width, we maintain the height of the topbar, but such cases will very likely
// never happen "in real life".
call-function: ("check-topbar", {
"width": 272,
"text_display": "none",
"search_display": "none",
"search_max_width": "150px",
})
}
)

go-to: |DOC_PATH| + "/sysinfo"
call-function: ("check-topbar-sizes", ())

call-function: ("check-topbar", {
"width": 1000,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 900,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 872,
"text_display": "inline",
"search_display": "block",
"search_max_width": "200px",
})
// From this point, text should not be displayed anymore.
call-function: ("check-topbar", {
"width": 871,
"text_display": "none",
"search_display": "block",
"search_max_width": "200px",
})
call-function: ("check-topbar", {
"width": 768,
"text_display": "none",
"search_display": "block",
"search_max_width": "200px",
})
// From this point, search input should be smaller.
call-function: ("check-topbar", {
"width": 767,
"text_display": "none",
"search_display": "block",
"search_max_width": "150px",
})
call-function: ("check-topbar", {
"width": 568,
"text_display": "none",
"search_display": "block",
"search_max_width": "150px",
})
// From this point, search input should not be displayed anymore.
call-function: ("check-topbar", {
"width": 567,
"text_display": "none",
"search_display": "none",
"search_max_width": "150px",
})
// Even at very small width, we maintain the height of the topbar, but such cases will very likely
// never happen "in real life".
call-function: ("check-topbar", {
"width": 272,
"text_display": "none",
"search_display": "none",
"search_max_width": "150px",
})
go-to: |DOC_PATH| + "/releases/search?query=sysinfo"
call-function: ("check-topbar-sizes", ())

0 comments on commit e3e1502

Please sign in to comment.