Skip to content

Commit

Permalink
Unifying shinytest2 (#739)
Browse files Browse the repository at this point in the history
Few improvements to unify the shinytest2
- [x] Title case in description

---------

Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com>
  • Loading branch information
kartikeyakirar and m7pr authored Apr 23, 2024
1 parent d595de1 commit e19d753
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 70 deletions.
51 changes: 30 additions & 21 deletions tests/testthat/test-shinytest2-tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ app_driver_tm_a_pca <- function() {
)
}

# Defaults --------------------------------------------------------------------

testthat::test_that("e2e - tm_a_pca: module is initialised with the specified defaults in function call", {
testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified defaults in function call.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -59,9 +57,7 @@ testthat::test_that("e2e - tm_a_pca: module is initialised with the specified de
app_driver$stop()
})

# Data extract ----------------------------------------------------------------

testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/Assault on header", {
testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/Assault on header.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -74,9 +70,11 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
testthat::expect_match(app_driver$get_active_module_output("tbl_eigenvector"), "Murder")

testthat::expect_no_match(app_driver$get_active_module_output("tbl_eigenvector"), "UrbanPop")

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/UrbanPop on header", {
testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/UrbanPop on header.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -89,9 +87,11 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
testthat::expect_match(app_driver$get_active_module_output("tbl_eigenvector"), "UrbanPop")
testthat::expect_match(app_driver$get_active_module_output("tbl_eigenvector"), "Murder")
testthat::expect_no_match(app_driver$get_active_module_output("tbl_eigenvector"), "Assault")

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be from non-selected variable set", {
testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be from non-selected variable set.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -108,9 +108,7 @@ testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be fro
app_driver$stop()
})

# Encodings -------------------------------------------------------------------

testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -127,9 +125,11 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display

testthat::expect_type(app_driver$get_active_module_output("tbl_eigenvector"), "list")
testthat::expect_setequal(names(app_driver$get_active_module_output("tbl_eigenvector")), c("message", "call", "type"))

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -148,9 +148,11 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' d

app_driver$set_active_module_input("plot_type", "Elbow plot") # Initial value
app_driver$expect_no_validation_error()

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardization' does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardization' does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -159,14 +161,16 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardizati
# Pre-processing

app_driver$set_active_module_input("standardization", "center")
app_driver$expect_no_validation_error
app_driver$expect_no_validation_error()
app_driver$set_active_module_input("standardization", "center_scale")
app_driver$expect_no_validation_error
app_driver$expect_no_validation_error()
app_driver$set_active_module_input("standardization", "none") # Initial value
app_driver$expect_no_validation_error
app_driver$expect_no_validation_error()

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -176,9 +180,11 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' do

app_driver$set_active_module_input("na_action", "drop")
app_driver$set_active_module_input("na_action", "none")

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hides and shows options", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hides and shows options.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand Down Expand Up @@ -206,9 +212,11 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hi
testthat::expect_false(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_true(app_driver$is_visible(x_axis_selector))
testthat::expect_true(app_driver$is_visible(color_by_selector))

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -222,16 +230,17 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does n
app_driver$expect_no_validation_error()
app_driver$set_active_module_input("ggtheme-selectized", "dark")
app_driver$expect_no_validation_error()

app_driver$stop()
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'font size' does not generate errors", {
testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'font size' does not generate errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
app_driver$expect_no_validation_error()

# Font size

app_driver$set_active_module_input("font_size", "8")
app_driver$expect_no_validation_error()

Expand Down
15 changes: 8 additions & 7 deletions tests/testthat/test-shinytest2-tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app_driver_tm_a_regression <- function() {
)
}

testthat::test_that("e2e - tm_a_regression: data parameter and module label is passed properly", {
testthat::test_that("e2e - tm_a_regression: Data parameter and module label is passed properly.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand All @@ -64,7 +64,7 @@ testthat::test_that("e2e - tm_a_regression: data parameter and module label is p
})

testthat::test_that("e2e - tm_a_regression:
data extract spec elements are initialized with the default values specified by response and regressor arg", {
Data extract spec elements are initialized with the default values specified by response and regressor arg.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand All @@ -79,10 +79,11 @@ testthat::test_that("e2e - tm_a_regression:
"conc"
)
app_driver$set_active_module_input("regressor-dataset_CO2_singleextract-select", "Treatment")

app_driver$stop()
})

testthat::test_that("e2e - tm_a_regression: plot_type is set properly", {
testthat::test_that("e2e - tm_a_regression: Plot type is set properly.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand All @@ -95,7 +96,7 @@ testthat::test_that("e2e - tm_a_regression: plot_type is set properly", {
})

testthat::test_that("e2e - tm_a_regression:
plot type has 7 specific choices & changing choices does not throw errors", {
Plot type has 7 specific choices & changing choices does not throw errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand All @@ -122,7 +123,7 @@ testthat::test_that("e2e - tm_a_regression:
app_driver$stop()
})

testthat::test_that("e2e - tm_a_regression: outlier definition and label are visible by default", {
testthat::test_that("e2e - tm_a_regression: Outlier definition and label are visible by default.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand All @@ -134,7 +135,7 @@ testthat::test_that("e2e - tm_a_regression: outlier definition and label are vis
app_driver$stop()
})

testthat::test_that("e2e - tm_a_regression: outlier definition and label have default values and label text", {
testthat::test_that("e2e - tm_a_regression: Outlier definition and label have default values and label text.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand Down Expand Up @@ -162,7 +163,7 @@ testthat::test_that("e2e - tm_a_regression: outlier definition and label have de
app_driver$stop()
})

testthat::test_that("e2e - tm_a_regression: unchecking display outlier hides outlier label and definition", {
testthat::test_that("e2e - tm_a_regression: Unchecking display outlier hides outlier label and definition.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_regression()
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-shinytest2-tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ app_driver_tm_g_association <- function() {
)
}

testthat::test_that("e2e - tm_g_association: data parameter and module label is passed properly", {
testthat::test_that("e2e - tm_g_association: Data parameter and module label is passed properly.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_association()
Expand All @@ -63,7 +63,7 @@ testthat::test_that("e2e - tm_g_association: data parameter and module label is
})

testthat::test_that("e2e - tm_g_association:
data extract spec elements are initialized with the default values specified by ref and vars arguments", {
Data extract spec elements are initialized with the default values specified by ref and vars arguments.", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_association()

Expand All @@ -83,7 +83,8 @@ testthat::test_that("e2e - tm_g_association:

app_driver$stop()
})
testthat::test_that("e2e - tm_g_association: module plot is visible", {

testthat::test_that("e2e - tm_g_association: Module plot is visible.", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_association()

Expand All @@ -92,8 +93,7 @@ testthat::test_that("e2e - tm_g_association: module plot is visible", {
app_driver$stop()
})


testthat::test_that("e2e - tm_g_association: test if default radio buttons are checked", {
testthat::test_that("e2e - tm_g_association: Check and set default values for radio buttons.", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_association()

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-shinytest2-tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ app_driver_tm_g_bivariate <- function() {
)
}

testthat::test_that("e2e - tm_g_bivariate: module is initialised with the specified defaults", {
testthat::test_that("e2e - tm_g_bivariate: Module is initialised with the specified defaults.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_bivariate()
Expand Down Expand Up @@ -113,7 +113,7 @@ testthat::test_that("e2e - tm_g_bivariate: module is initialised with the specif
app_driver$stop()
})

testthat::test_that("e2e - tm_g_bivariate: coloring options are hidden when coloring is toggled off", {
testthat::test_that("e2e - tm_g_bivariate: Coloring options are hidden when coloring is toggled off.", {
skip_if_too_deep(5)
app_driver <- app_driver_tm_g_bivariate()

Expand Down Expand Up @@ -154,7 +154,7 @@ testthat::test_that("e2e - tm_g_bivariate: coloring options are hidden when colo
app_driver$stop()
})

testthat::test_that("e2e - tm_g_bivariate: facetting options are hidden when facet is toggled off", {
testthat::test_that("e2e - tm_g_bivariate: Facetting options are hidden when facet is toggled off.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_bivariate()
Expand Down Expand Up @@ -190,7 +190,7 @@ testthat::test_that("e2e - tm_g_bivariate: facetting options are hidden when fac
app_driver$stop()
})

testthat::test_that("e2e - tm_g_bivariate: setting encoding inputs produces outputs without validation errors", {
testthat::test_that("e2e - tm_g_bivariate: Setting encoding inputs produces outputs without validation errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_bivariate()
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-shinytest2-tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ app_driver_tm_g_distribution <- function() {
)
}

testthat::test_that("e2e - tm_g_distribution: module is initialised with the specified defaults", {
testthat::test_that("e2e - tm_g_distribution: Module is initialised with the specified defaults.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_distribution()
Expand All @@ -71,7 +71,7 @@ testthat::test_that("e2e - tm_g_distribution: module is initialised with the spe
app_driver$stop()
})

testthat::test_that("e2e - tm_g_distribution: histogram encoding inputs produce output without validation errors", {
testthat::test_that("e2e - tm_g_distribution: Histogram encoding inputs produce output without validation errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_distribution()
Expand Down Expand Up @@ -108,7 +108,7 @@ testthat::test_that("e2e - tm_g_distribution: histogram encoding inputs produce
app_driver$stop()
})

testthat::test_that("e2e - tm_g_distribution: qqplot encoding inputs produce output without validation errors", {
testthat::test_that("e2e - tm_g_distribution: QQ plot encoding inputs produce output without validation errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_distribution()
Expand Down
9 changes: 5 additions & 4 deletions tests/testthat/test-shinytest2-tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ app_driver_tm_g_response <- function() {
)
}

testthat::test_that("e2e - tm_g_response: module is initialised with the specified defaults", {
testthat::test_that("e2e - tm_g_response: module is initialised with the specified defaults.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_response()
Expand All @@ -57,7 +57,8 @@ testthat::test_that("e2e - tm_g_response: module is initialised with the specifi

app_driver$stop()
})
testthat::test_that("e2e - tm_g_response: encoding inputs produce output without validation errors", {

testthat::test_that("e2e - tm_g_response: encoding inputs produce output without validation errors.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_response()
Expand Down Expand Up @@ -87,7 +88,7 @@ testthat::test_that("e2e - tm_g_response: encoding inputs produce output without
app_driver$stop()
})

testthat::test_that("e2e - tm_g_response: deselecting response produces validation error", {
testthat::test_that("e2e - tm_g_response: deselecting response produces validation error.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_response()
Expand All @@ -98,7 +99,7 @@ testthat::test_that("e2e - tm_g_response: deselecting response produces validati
app_driver$stop()
})

testthat::test_that("e2e - tm_g_response: deselecting x produces validation error", {
testthat::test_that("e2e - tm_g_response: deselecting x produces validation error.", {
skip_if_too_deep(5)

app_driver <- app_driver_tm_g_response()
Expand Down
Loading

0 comments on commit e19d753

Please sign in to comment.