Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes integration tests when Chrome >=105 is not installed #1202

Merged
merged 15 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fallback to pure js if checkVisibility is not supported
  • Loading branch information
averissimo committed Apr 19, 2024
commit 6662abbdc61aad434093a7025e8afe409d3a578c
18 changes: 17 additions & 1 deletion R/TealAppDriver.R
Original file line number Diff line number Diff line change
@@ -271,7 +271,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
checkmate::assert_flag(content_visibility_auto)
checkmate::assert_flag(opacity_property)
checkmate::assert_flag(visibility_property)
unlist(
result <- unlist(
self$get_js(
sprintf(
"Array.from(document.querySelectorAll('%s')).map(el => el.checkVisibility({%s, %s, %s}))",
@@ -283,6 +283,22 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
)
)
)

# Fallback if chrome/chromium doesn't support el.checkVisibility (< 105)
if (all(vapply(result, is.null, logical(1)))) {
fun_body <- "elem => !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)"
unlist(
self$get_js(
sprintf(
"Array.from(document.querySelectorAll('%s')).map(%s)",
selector,
fun_body
)
)
)
} else {
result
}
averissimo marked this conversation as resolved.
Show resolved Hide resolved
},
#' @description
#' Get the active filter variables from a dataset in the `teal` app.
Loading