From 1b06f8d1c2c4e8aa06e5351684428bd93f418f42 Mon Sep 17 00:00:00 2001 From: Chris Bennett Date: Thu, 17 Oct 2024 09:22:39 +0100 Subject: [PATCH] update to shiny test to fix failing test --- .Rhistory | 58 +++++++++---------- .../ks5-transition-matrices-001.json | 7 +-- tests/testthat/test-shinytest2.R | 19 +++--- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/.Rhistory b/.Rhistory index 71f3bcc..c8ca8c4 100644 --- a/.Rhistory +++ b/.Rhistory @@ -1,32 +1,3 @@ -# ----------------------------------------------------------------------------------------------------------------------------- -# ---- ANCILLARY DATA FOR EES ---- -# ----------------------------------------------------------------------------------------------------------------------------- -ancillary_data_numbers <- student_numbers %>% -pivot_longer(!c(Qual_Description, SUBLEVNO, Potential_Level, ASIZE, GSIZE, MAPPING, Subject, gradeStructure, PRIOR_BAND, SUBJ, SIZE, QUAL_ID, ROW_ID), -names_to = "grade", -values_to = "count") %>% -select(qualification_name = Qual_Description, -qualification_code = SUBLEVNO, -subject_name = Subject, -subject_code = SUBJ, -size = SIZE, -grade_structure = gradeStructure, -prior_attainment_band = PRIOR_BAND, -grade, -count) %>% -filter(!is.na(count)) %>% -arrange(qualification_code, subject_code, size, grade_structure, prior_attainment_band, grade) -ancillary_data_percentages <- student_percentages %>% -pivot_longer(!c(Qual_Description, SUBLEVNO, Potential_Level, ASIZE, GSIZE, MAPPING, Subject, gradeStructure, PRIOR_BAND, SUBJ, SIZE, QUAL_ID, ROW_ID), -names_to = "grade", -values_to = "percentage") %>% -select(qualification_name = Qual_Description, -qualification_code = SUBLEVNO, -subject_name = Subject, -subject_code = SUBJ, -size = SIZE, -grade_structure = gradeStructure, -prior_attainment_band = PRIOR_BAND, grade, percentage) %>% filter(percentage != "NA%") %>% @@ -510,3 +481,32 @@ shinytest2::record_test() renv::status() renv::snapshot() renv::status() +shiny::runApp() +testthat::snapshot_review('shinytest2/') +shinytest2::test_app() +shinytest2::record_test() +shinytest2::record_test() +testthat::snapshot_review('shinytest2/') +shinytest2::test_app() +runApp() +shinytest2::test_app() +runApp() +runApp() +runApp() +shiny::runApp() +shinytest2::test_app() +shinytest2::test_app() +shinytest2::use_shinytest2(".", setup = TRUE) +shinytest2::test_app() +shinytest2::record_test() +shinytest2::test_app() +shinytest2::test_app() +shinytest2::record_test() +shinytest2::record_test() +renv::status() +renv::snapshot() +renv::status() +shinytest2::record_test() +renv::status() +renv::snapshot() +shinytest2::test_app() diff --git a/tests/testthat/_snaps/shinytest2/ks5-transition-matrices-001.json b/tests/testthat/_snaps/shinytest2/ks5-transition-matrices-001.json index 78f5f6f..a12e029 100644 --- a/tests/testthat/_snaps/shinytest2/ks5-transition-matrices-001.json +++ b/tests/testthat/_snaps/shinytest2/ks5-transition-matrices-001.json @@ -3,10 +3,9 @@ "ReportYr_select": "2023", "cookies": [ "GA1.1.1784488804.1728980230", - "GS1.1.1728987874.2.0.1728987874.0.0.0", - "granted" + "GS1.1.1729152208.1.1.1729152369.0.0.0" ], - "cookies_banner-cookies_accept": 1, + "cookies_banner-cookies_accept": 0, "cookies_banner-cookies_link": 0, "cookies_banner-cookies_reject": 0, "cookies_panel-cookies_analytics": "no", @@ -45,7 +44,7 @@ "example_table_rows_selected": null, "example_table_search": "", "example_table_state": [ - "1728987874960", + "1729152370040", "0", "10", "", diff --git a/tests/testthat/test-shinytest2.R b/tests/testthat/test-shinytest2.R index be7b427..21c0ace 100644 --- a/tests/testthat/test-shinytest2.R +++ b/tests/testthat/test-shinytest2.R @@ -2,10 +2,14 @@ library(shinytest2) test_that("{shinytest2} recording: ks5-transition-matrices", { app <- AppDriver$new(name = "ks5-transition-matrices", height = 911, width = 1619) + app$set_inputs( + cookies = c("GA1.1.1784488804.1728980230", "GS1.1.1729152208.1.1.1729152369.0.0.0"), + allow_no_input_binding_ = TRUE + ) app$set_inputs(example_table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(example_table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(example_table_state = c( - 1728987874960, 0, 10, "", TRUE, FALSE, TRUE, + 1729152370040, 0, 10, "", TRUE, FALSE, TRUE, c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c( TRUE, "", TRUE, FALSE, TRUE @@ -15,17 +19,12 @@ test_that("{shinytest2} recording: ks5-transition-matrices", { ), c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE) ), allow_no_input_binding_ = TRUE) - app$click("cookies_banner-cookies_accept") - app$set_inputs(cookies = c( - "GA1.1.1784488804.1728980230", "GS1.1.1728987874.2.0.1728987874.0.0.0", - "granted" - ), allow_no_input_binding_ = TRUE) app$expect_values() app$set_inputs(navlistPanel = "dashboard") app$set_inputs(tm_table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_state = c( - 1728987905305, 0, 10, "", TRUE, FALSE, TRUE, + 1729152378179, 0, 10, "", TRUE, FALSE, TRUE, c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c( TRUE, "", TRUE, FALSE, TRUE @@ -43,7 +42,7 @@ test_that("{shinytest2} recording: ks5-transition-matrices", { app$set_inputs(tm_table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_state = c( - 1728987938055, 0, 10, "", TRUE, FALSE, TRUE, + 1729152396312, 0, 10, "", TRUE, FALSE, TRUE, c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c( TRUE, "", TRUE, FALSE, TRUE @@ -57,7 +56,7 @@ test_that("{shinytest2} recording: ks5-transition-matrices", { app$set_inputs(tm_table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allow_no_input_binding_ = TRUE) app$set_inputs(tm_table_state = c( - 1728987947448, 0, 10, "", TRUE, FALSE, TRUE, + 1729152401377, 0, 10, "", TRUE, FALSE, TRUE, c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c( TRUE, "", TRUE, FALSE, TRUE @@ -67,5 +66,5 @@ test_that("{shinytest2} recording: ks5-transition-matrices", { ), c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE), c(TRUE, "", TRUE, FALSE, TRUE) ), allow_no_input_binding_ = TRUE) - app$set_inputs(chart_band = "6-<7") + app$set_inputs(chart_band = "4-<5") })