Skip to content

Commit

Permalink
change input separately
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit committed Feb 20, 2024
1 parent 5f2f286 commit ec14493
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 41 deletions.
Binary file modified tests/testthat/_snaps/windows-4.3/boxplot/boxplot-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/quality/quality-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 23 additions & 29 deletions tests/testthat/test-pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test_that("pca module works as expected in the test app", {
res <- app$get_value(input = ns("show_matrix"))
expect_true(res)

app$expect_select_screenshot(ns("plot_pca-plot_main"))
app$expect_select_screenshot(ns("plot_pca-plot_main")) #1

# Add a gene filter and deselect everything and check that it does not crash.
app$set_inputs(!!ns2("add-MAE-hd1-row_to_add") := "symbol")
Expand Down Expand Up @@ -88,31 +88,27 @@ test_that("pca module works as expected in the test app", {
res <- app$get_value(input = ns("show_matrix"))
expect_true(res)

app$expect_select_screenshot(ns("plot_cor-plot_main"))
app$expect_select_screenshot(ns("table_cor"))
app$expect_select_screenshot(ns("plot_cor-plot_main")) #2
app$expect_select_screenshot(ns("table_cor")) #3

# Now update experiment name, assay name, cluster & matrix option on correlation tab.
app$set_inputs(
!!ns("experiment-name") := "hd2",
!!ns("assay-name") := "voom",
!!ns("cluster_columns") := TRUE,
!!ns("show_matrix") := FALSE
)
app$set_inputs(!!ns("experiment-name") := "hd2")
app$set_inputs(!!ns("assay-name") := "voom")
app$set_inputs(!!ns("cluster_columns") := TRUE)
app$set_inputs(!!ns("show_matrix") := FALSE)

app$wait_for_idle()
app$expect_select_screenshot(ns("plot_cor-plot_main"))
app$expect_select_screenshot(ns("plot_cor-plot_main")) #4

# Now go back to pca tab and update experiment, assay name, variance % option,
# label option and matrix option.
app$set_inputs(
!!ns("tab_selected") := "PCA",
!!ns("assay-name") := "rpkm",
!!ns("x_var") := "3",
!!ns("y_var") := "4",
!!ns("var_pct") := FALSE,
!!ns("label") := FALSE,
!!ns("show_matrix") := FALSE
)
app$set_inputs(!!ns("tab_selected") := "PCA")
app$set_inputs(!!ns("assay-name") := "rpkm")
app$set_inputs(!!ns("x_var") := "3")
app$set_inputs(!!ns("y_var") := "4")
app$set_inputs(!!ns("var_pct") := FALSE)
app$set_inputs(!!ns("label") := FALSE)
app$set_inputs(!!ns("show_matrix") := FALSE)

app$wait_for_idle()
app$expect_select_screenshot(ns("plot_pca-plot_main"))
Expand Down Expand Up @@ -153,16 +149,14 @@ test_that("pca module works as expected in the test app", {
expect_identical(res$message, "please select two different principal components")

# Update the inputs to PCA tab, hd1, counts, PC3, PC4, and add filters.
app$set_inputs(
!!ns("tab_selected") := "PCA",
!!ns("experiment-name") := "hd1",
!!ns("assay-name") := "counts",
!!ns("x_var") := "3",
!!ns("y_var") := "4",
!!ns("var_pct") := TRUE,
!!ns("label") := TRUE,
!!ns("show_matrix") := TRUE
)
app$set_inputs(!!ns("tab_selected") := "PCA")
app$set_inputs(!!ns("experiment-name") := "hd1")
app$set_inputs(!!ns("assay-name") := "counts")
app$set_inputs(!!ns("x_var") := "3")
app$set_inputs(!!ns("y_var") := "4")
app$set_inputs(!!ns("var_pct") := TRUE)
app$set_inputs(!!ns("label") := TRUE)
app$set_inputs(!!ns("show_matrix") := TRUE)

app$set_inputs(!!ns2("add-MAE-subjects-var_to_add") := "SEX")
app$wait_for_idle()
Expand Down
31 changes: 19 additions & 12 deletions tests/testthat/test-scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ test_that("scatterplot module works as expected in the test app", {
expect_identical(res$message, "please select at least one gene")

# Set one gene each.
app$set_inputs(
!!ns("x_spec-genes") := "GeneID:503538",
!!ns("y_spec-genes") := "GeneID:8086"
)
app$set_inputs(!!ns("x_spec-genes") := "GeneID:503538")
app$set_inputs(!!ns("y_spec-genes") := "GeneID:8086")

app$wait_for_idle()

# Change the sample filter and confirm that genes are not updated.
app$set_inputs(!!ns2("add-MAE-subjects-add_filter") := "ARM")
app$set_inputs(!!ns2("add-MAE-subjects-var_to_add") := "SEX")
app$set_inputs(!!ns2("active-MAE-subjects-MAE_SEX-inputs-selection") := "F")

res <- app$get_value(input = ns("x_spec-genes"))
expect_identical(res, "GeneID:503538")
res <- app$wait_for_value(input = ns("y_spec-genes"))
expect_identical(res, "GeneID:8086")

# Remove sample filter
app$click(ns2("active-MAE-subjects-MAE_SEX-remove"))
app$wait_for_idle()

res <- app$get_value(input = ns("x_spec-genes"))
Expand All @@ -74,13 +83,11 @@ test_that("scatterplot module works as expected in the test app", {
expect_identical(res, "GeneID:8086")

# Now change the experiment_name, genes, method.
app$set_inputs(
!!ns("experiment-name") := "hd2",
!!ns("x_spec-genes") := "GeneID:441376",
!!ns("y_spec-genes") := "GeneID:79963",
!!ns("smooth_method") := "loess",
!!ns("facet_var-sample_var") := "AGE18"
)
app$set_inputs(!!ns("experiment-name") := "hd2")
app$set_inputs(!!ns("x_spec-genes") := "GeneID:441376")
app$set_inputs(!!ns("y_spec-genes") := "GeneID:79963")
app$set_inputs(!!ns("smooth_method") := "loess")
app$set_inputs(!!ns("facet_var-sample_var") := "AGE18")

app$wait_for_idle()
app$expect_select_screenshot(ns("plot-plot_out_main"))
Expand Down

0 comments on commit ec14493

Please sign in to comment.