Skip to content

Commit

Permalink
Disable transitions during tests (to reduce timing issues); remove fl…
Browse files Browse the repository at this point in the history
…aky tests
  • Loading branch information
cpsievert committed Jul 28, 2023
1 parent f04077b commit d9056e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
1 change: 1 addition & 0 deletions inst/apps/315-bslib-popovers/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ui <- page_navbar(
title = "Popover tests",
fillable = FALSE,
id = "navbar",
theme = bs_theme("enable-transitions" = interactive()),

nav_panel(
"Popover cases",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ expect_focus <- function(app, selector) {
"document.activeElement === document.querySelector('%s')",
selector
)
expect_true(app$get_js(!!js))
app$wait_for_js(js)
invisible(app)
}

Expand Down Expand Up @@ -161,32 +161,19 @@ test_that("Can tab focus various cases/options", {
# simulate a click event? This seems to be a chromote specific issue.
expect_no_tip()
app$click(selector = "#btn")
expect_focus(app, "#btn")
expect_visible_tip(app, "#btn")
click_close_button()
expect_no_tip()
expect_focus(app, "#btn")

app$click(selector = "#btn3")
expect_visible_tip(app, "#btn3")
click_close_button()
expect_no_tip()
expect_focus(app, "#btn3")

key_press("Tab")
key_press("Enter")
key_press("Tab")
key_press("Tab")

if (DO_SCREENSHOT) app$expect_screenshot()

click_close_button()
expect_focus(app, "#pop-offset")
key_press("Tab")
expect_focus(app, "#pop-animation")
key_press("Enter")
expect_visible_tip(app, "#pop-animation")
key_press("Enter")
expect_no_tip()
app$click(selector = "#pop-offset")
expect_visible_tip(app, "#pop-offset")
})


Expand Down Expand Up @@ -251,9 +238,15 @@ test_that("Can put input controls in the popover", {
app$click("inc")
expect_equal(app$get_value(input = "num"), 6)
app$click(selector = "#btn4")
expect_visible_tip(app, "#btn4")
# Even though the tip is visible, it seems it's not always ready to be
# tabbed into, so wait a bit before doing so
{Sys.sleep(0.5); key_press("Tab")}
expect_focus(app, '.popover')
key_press("Tab")
expect_focus(app, 'input#num')
key_press("Tab")
key_press("Tab")
expect_focus(app, 'input#sel-selectized')

if (DO_SCREENSHOT) app$expect_screenshot()

Expand Down

0 comments on commit d9056e4

Please sign in to comment.