Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL,
indentation_linter = NULL
indentation_linter = NULL,
pipe_consistency_linter = NULL
)
49 changes: 35 additions & 14 deletions tests/testthat/test-plot_with_settings_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ testthat::test_that(
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand All @@ -133,7 +135,9 @@ testthat::test_that(
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -195,7 +199,9 @@ testthat::test_that(
name = "pws",
variant = "app_driver_pws_ui",
height = 1000,
width = 1000
width = 1000,
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)
app_driver$get_text(paste0(
Expand Down Expand Up @@ -233,7 +239,9 @@ testthat::test_that(
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -273,15 +281,15 @@ testthat::test_that(
name = "pws",
variant = "app_driver_pws_ui",
height = 1000,
width = 1000
width = 1000,
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

testthat::expect_false(is_visible("#plot_with_settings-slider_ui", app_driver))

# nolint start
app_driver$run_js(click_resize_popup)
# nolint end
app_driver$wait_for_idle(timeout = longer_timeout)


Expand Down Expand Up @@ -316,10 +324,13 @@ testthat::test_that(
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

app_driver$run_js(click_resize_popup)
app_driver$wait_for_idle(timeout = longer_timeout)
app_driver$set_inputs(`plot_with_settings-height` = 1000)
app_driver$set_inputs(`plot_with_settings-width_resize_switch` = 350)

Expand All @@ -338,7 +349,9 @@ testthat::test_that(
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand All @@ -359,7 +372,9 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: expanded image can be
name = "pws",
variant = "app_driver_pws_ui",
height = 1000,
width = 1000
width = 1000,
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -410,7 +425,9 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: expanded image can be
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand All @@ -431,7 +448,9 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: main image can be res
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -475,7 +494,9 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: scrollbar appears whe
app_driver <- shinytest2::AppDriver$new(
app_driver_pws(),
name = "pws",
variant = "app_driver_pws_ui"
variant = "app_driver_pws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down
31 changes: 24 additions & 7 deletions tests/testthat/test-table_with_settings_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ app_driver_tws <- function() {
}

longer_timeout <- 80000
longer_duration <- 1000

# nolint start
# JS code to click the expand button popup.
Expand Down Expand Up @@ -73,11 +74,13 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout * 4)

# Check if there is an table.
testthat::expect_true(is_visible("#table_with_settings-table_out_main .rtables-container", app_driver))
testthat::expect_true(is_visible("#table_with_settings-table_out_main > .rtables-container", app_driver))

# Check if the settings buttons are visible.
testthat::expect_true(is_visible(".teal-widgets.settings-buttons", app_driver))
Expand All @@ -95,6 +98,8 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -159,6 +164,8 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -186,14 +193,16 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)
app_driver$wait_for_idle(duration = longer_duration, timeout = longer_timeout * 4)

testthat::expect_false(is_visible("#table_with_settings-table_out_main", app_driver))
testthat::expect_false(is_visible("#bslib-full-screen-overlay", app_driver))

app_driver$run_js(click_expand_popup)
app_driver$wait_for_idle(timeout = longer_timeout * 4)
app_driver$wait_for_idle(duration = longer_duration, timeout = longer_timeout * 4)

table_content <- app_driver$get_text("#table_with_settings-table_out_main")

Expand All @@ -202,7 +211,8 @@ testthat::test_that(
testthat::expect_true(is_visible("#bslib-full-screen-overlay", app_driver))
# Close modal.
app_driver$run_js("document.querySelector('#bslib-full-screen-overlay .bslib-full-screen-exit').click();")
app_driver$wait_for_idle(timeout = longer_timeout)

app_driver$wait_for_idle(duration = longer_duration, timeout = longer_timeout * 4)
testthat::expect_false(is_visible("#bslib-full-screen-overlay", app_driver))

# Review the main table content.
Expand All @@ -222,6 +232,8 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down Expand Up @@ -288,6 +300,8 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand All @@ -312,17 +326,18 @@ testthat::test_that(
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)
app_driver$wait_for_idle(duration = longer_duration, timeout = longer_timeout * 4)

app_driver$run_js(click_download_popup)
app_driver$wait_for_idle(timeout = longer_timeout)
app_driver$wait_for_idle(duration = longer_duration, timeout = longer_timeout * 4)

filename <- app_driver$get_download("table_with_settings-downbutton-data_download")
testthat::expect_match(filename, "txt$", fixed = FALSE)

content <- readLines(filename)

check_table(content)

app_driver$stop()
Expand All @@ -335,6 +350,8 @@ testthat::test_that("e2e teal.widgets::table_with_settings: expanded table can b
app_driver_tws(),
name = "tws",
variant = "app_driver_tws_ui",
timeout = 30000,
load_timeout = 100000
)
app_driver$wait_for_idle(timeout = longer_timeout)

Expand Down
Loading