Skip to content

Commit

Permalink
tests(308): Temporarily disable sidebar transition
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Oct 24, 2023
1 parent ebd1562 commit 528680e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions inst/apps/308-sidebar-kitchen-sink/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ sidebar_short <- local({
ui <- page_navbar(
title = "Sidebar kitchen sink",
fillable = c("Fill", "Fill+Scroll", "Global card sidebar"),
# Disable sidebar transitions for tests
tags$style(".bslib-sidebar-layout {--bslib-sidebar-transition-duration: 5ms};"),
id = "navbar",
sidebar = sidebar(
open = FALSE,
Expand All @@ -34,6 +32,11 @@ ui <- page_navbar(
)
),
header = tagList(
# Disable sidebar transitions for tests
tags$style(
id = "disable-sidebar-transition",
".bslib-sidebar-layout {--bslib-sidebar-transition-duration: 0};"
),
tags$style(HTML(".plotly .modebar-container { display: none; }")),
span("header", class = "bg-dark"),
span("content", class = "bg-dark")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ release <- paste0(
is_testing_on_ci <- identical(Sys.getenv("CI"), "true") && testthat::is_testing()
is_mac_release <- identical(paste0("mac-", release), platform_variant())

DO_SCREENSHOT <- is_testing_on_ci && is_mac_release
DO_SCREENSHOT <- (is_testing_on_ci && is_mac_release) ||
identical(Sys.getenv("SHINYTEST2_SCREENSHOT"), "true")

test_that("{shinytest2} recording: 308-sidebar-kitchen-sink", {
height <- 1200
Expand Down Expand Up @@ -49,7 +50,10 @@ test_that("{shinytest2} recording: 308-sidebar-kitchen-sink", {
Sys.sleep(1) # Wait for the tab to receive focus
expect_screenshot()

app$run_js("document.getElementById('disable-sidebar-transition').remove()")
app$click("toggle_sidebar")
Sys.sleep(1) # Wait for transition to complete
app$wait_for_js("
document.querySelector('.bslib-sidebar-layout.transitioning') === null
")
expect_screenshot()
})

0 comments on commit 528680e

Please sign in to comment.