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
feat: skip tests if API Element.checkVisibility() is not supported
averissimo committed Apr 23, 2024
commit ae27c01008ed9b6c0ba879591cd08c2eaaa224e5
24 changes: 7 additions & 17 deletions R/TealAppDriver.R
Original file line number Diff line number Diff line change
@@ -268,7 +268,13 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
checkmate::assert_flag(content_visibility_auto)
checkmate::assert_flag(opacity_property)
checkmate::assert_flag(visibility_property)
result <- unlist(

testthat::skip_if(
app$get_js("typeof Element.prototype.checkVisibility === 'function'"),
"Element.prototype.checkVisibility is not supported in the current browser."
)

unlist(
self$get_js(
sprintf(
"Array.from(document.querySelectorAll('%s')).map(el => el.checkVisibility({%s, %s, %s}))",
@@ -280,22 +286,6 @@ 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
}
},
#' @description
#' Get the active filter variables from a dataset in the `teal` app.