diff --git a/.gitignore b/.gitignore
index 1d547385..679f0782 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ docs
inst/doc
/doc/
/Meta/
+CRAN-SUBMISSION
diff --git a/DESCRIPTION b/DESCRIPTION
index 5b75e773..0df6ae47 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: shinytest2
Title: Testing for Shiny Applications
-Version: 0.3.2.9000
+Version: 0.3.2.9001
Authors@R:
c(
person("Barret", "Schloerke", role = c("cre", "aut"), email = "barret@posit.co", comment = c(ORCID = "0000-0001-9986-114X")),
@@ -31,6 +31,7 @@ Imports:
globals (>= 0.14.0),
httr,
jsonlite,
+ lifecycle (>= 1.0.3),
pingr,
rlang (>= 1.0.0),
rmarkdown,
diff --git a/NAMESPACE b/NAMESPACE
index 302cc1c0..fc98a895 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -23,6 +23,7 @@ importFrom(cli,col_magenta)
importFrom(cli,col_red)
importFrom(cli,col_silver)
importFrom(cli,make_ansi_style)
+importFrom(lifecycle,deprecated)
importFrom(rlang,"%||%")
importFrom(rlang,":=")
importFrom(rlang,list2)
diff --git a/R/record-test.R b/R/record-test.R
index 9d582115..bc3a1652 100644
--- a/R/record-test.R
+++ b/R/record-test.R
@@ -1,3 +1,5 @@
+warning("TODO-barret; Record test should save the recording into the package if within a package.")
+
#' Launch test event recorder for a Shiny app
#'
#' Once a recording is completed, it will create or append a new
diff --git a/R/test-app.R b/R/test-app.R
index 1d52571e..c53c3194 100644
--- a/R/test-app.R
+++ b/R/test-app.R
@@ -1,3 +1,7 @@
+warning("TODO-barret; test check_setup values")
+warning("TODO-barret; requires R file loading; Look into using `testthat::test_dir(load_package=)` and `testthat:::test_files_setup_env()`")
+warning("TODO-barret; use-package.Rmd vignette")
+
# Import something from testthat to avoid a check error that nothing is imported from a `Depends` package
#' @importFrom testthat default_reporter
NULL
@@ -70,11 +74,9 @@ NULL
#' @param name Name to display in the middle of the test name. This value is only used
#' when calling `test_app()` inside of \pkg{testhat} test. The final testing context will
#' have the format of `"{test_context} - {name} - {app_test_context}"`.
-#' @param check_setup If `TRUE`, the app will be checked for the presence of
-#' `./tests/testthat/setup-shinytest2.R`. This file must contain a call to
-#' [`shinytest2::load_app_env()`].
#' @param reporter Reporter to pass through to [`testthat::test_dir()`].
#' @param stop_on_failure If missing, the default value of `TRUE` will be used. However, if missing and currently testing, `FALSE` will be used to seamlessly integrate the app reporter to `reporter`.
+#' @param check_setup [Deprecated]. Parameter ignored.
#' @seealso
#' * [`record_test()`] to create tests to record against your Shiny application.
#' * [testthat::snapshot_review()] and [testthat::snapshot_accept()] if
@@ -83,13 +85,15 @@ NULL
#' This is only necessary if you want access to the values while testing.
#'
#' @export
+#' @importFrom lifecycle deprecated
test_app <- function(
app_dir = missing_arg(),
...,
name = missing_arg(),
- check_setup = TRUE,
reporter = testthat::get_reporter(),
- stop_on_failure = missing_arg()
+ # TODO-v0.4.0; Remove this argument and let `...` handle it
+ stop_on_failure = missing_arg(),
+ check_setup = deprecated()
) {
# Inspiration from https://github.com/rstudio/shiny/blob/a8c14dab9623c984a66fcd4824d8d448afb151e7/inst/app_template/tests/testthat.R
@@ -114,40 +118,29 @@ test_app <- function(
app_dir <- app_dir_value(app_dir)
- if (isTRUE(check_setup)) {
- # Legacy support for `setup.R`; Same content, just different name
- setup_paths <- fs::path(app_dir, "tests", "testthat", c("setup-shinytest2.R", "setup.R"))
- setup_paths_exist <- fs::file_exists(setup_paths)
- if (!any(setup_paths_exist)) {
- rlang::abort(
- c(
- "No `setup-shinytest2.R` file found in `./tests/testthat`",
- "i" = paste0("To create a `setup-shinytest2.R` file, please run `shinytest2::use_shinytest2(\"", app_dir, "\", setup = TRUE)`"),
- "i" = "To disable this message, please set `test_app(check_setup = FALSE)`"
- )
- )
- }
- found <- FALSE
- for (setup_path in setup_paths) {
- if (has_load_app_env(setup_path)) {
- found <- TRUE
- break
- }
- }
- if (!found) {
- rlang::abort(
- c(
- "No call to `shinytest2::load_app_env()` found in `./tests/testthat/setup-shinytest2.R`",
- "i" = paste0("To create a `setup-shinytest2.R` file, please run `shinytest2::use_shinytest2(\"", app_dir, "\", setup = TRUE)`"),
- "i" = "To disable this message, please set `test_app(check_setup = FALSE)`"
+ # If value is provided and `TRUE`...
+ if (lifecycle::is_present(check_setup)) {
+ if (isTRUE(check_setup)) {
+ lifecycle::deprecate_warn(
+ "0.1.0",
+ "shinytest2::test_app(check_setup = 'is no longer used')",
+ details = c(
+ "To manually load an app's support files, call `shinytest2::local_app_support(app_dir=)` within your {testthat} test",
+ i = "Please see `?shinytest2::local_app_support` for more information"
)
)
}
}
-
-
if (testthat::is_testing()) {
+ warning("TODO-barret; missing url for migration warning")
+ rlang::warn(c(
+ "x" = "Calling `shinytest2::test_app()` within a {testthat} test has been deprecated in {shinytest2} v0.3.0",
+ "!" = "Calling `shinytest2::test_app()` within a {testthat} test will be hard deprecated in {shinytest2} v0.4.0",
+ "i" = "If you are testing within a package, please see URL on how to migrate your App tests to be located in your package tests.",
+ "i" = "If you are using CI, don't forget to collect your new snapshots after your initial run."
+ ))
+
# Normalize the reporter given any input
outer_reporter <- testthat::with_reporter(reporter, testthat::get_reporter(), start_end_reporter = FALSE)
@@ -283,6 +276,32 @@ load_app_env <- function(
shiny::loadSupport(app_dir, renv = renv, globalrenv = globalrenv)
}
+warning("Document how to use load_app_env() in both an app testing context and a package testing context.")
+
+# warning("load_app_env() is deprecated. Use `load_app_support()` / `with_app_support()` instead.")
+# # #' @export
+# # local_app_env <- function(
+# local_app_support <- function(
+# app_dir,
+# envir = rlang::caller_env()
+# ) {
+# shiny::loadSupport(app_dir, renv = envir, globalrenv = envir)
+# }
+
+# with_app_support <- function(
+# app_dir,
+# expr,
+# envir = rlang::caller_env()
+# ) {
+
+# # Make new environment
+# tmp_envir <- rlang::new_environment(parent = envir)
+# # Load support files into new environment
+# local_app_support(app_dir, envir = tmp_envir)
+# # Evaluate expression in new environment
+# withr::with_environment(tmp_envir, expr, name = "app_support")
+# }
+
has_load_app_env <- function(file) {
if (!fs::file_exists(file)) {
diff --git a/logo/shinytest2.png b/logo/shinytest2.png
index 3770a9d9..77b4d315 100644
Binary files a/logo/shinytest2.png and b/logo/shinytest2.png differ
diff --git a/logo/shinytest2.svg b/logo/shinytest2.svg
index ceb96b25..8717df4c 100644
--- a/logo/shinytest2.svg
+++ b/logo/shinytest2.svg
@@ -1,154 +1,107 @@
-
+
diff --git a/man/test_app.Rd b/man/test_app.Rd
index 08a76a54..2d3feea6 100644
--- a/man/test_app.Rd
+++ b/man/test_app.Rd
@@ -8,9 +8,9 @@ test_app(
app_dir = missing_arg(),
...,
name = missing_arg(),
- check_setup = TRUE,
reporter = testthat::get_reporter(),
- stop_on_failure = missing_arg()
+ stop_on_failure = missing_arg(),
+ check_setup = deprecated()
)
}
\arguments{
@@ -27,13 +27,11 @@ test_app(
when calling \code{test_app()} inside of \pkg{testhat} test. The final testing context will
have the format of \code{"{test_context} - {name} - {app_test_context}"}.}
-\item{check_setup}{If \code{TRUE}, the app will be checked for the presence of
-\code{./tests/testthat/setup-shinytest2.R}. This file must contain a call to
-\code{\link[=load_app_env]{load_app_env()}}.}
-
\item{reporter}{Reporter to pass through to \code{\link[testthat:test_dir]{testthat::test_dir()}}.}
\item{stop_on_failure}{If missing, the default value of \code{TRUE} will be used. However, if missing and currently testing, \code{FALSE} will be used to seamlessly integrate the app reporter to \code{reporter}.}
+
+\item{check_setup}{\link{Deprecated}. Parameter ignored.}
}
\description{
This is a helper method that wraps around \code{\link[testthat:test_dir]{testthat::test_dir()}} to test
diff --git a/tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001.json b/tests/testthat/_snaps/app-bookmark/001.json
similarity index 60%
rename from tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001.json
rename to tests/testthat/_snaps/app-bookmark/001.json
index 1d0ff37d..d6a4e975 100644
--- a/tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001.json
+++ b/tests/testthat/_snaps/app-bookmark/001.json
@@ -1,11 +1,11 @@
{
"input": {
"._bookmark_": 0,
- "caps": true,
- "txt": "abcd"
+ "caps": false,
+ "txt": ""
},
"output": {
- "out": "ABCD"
+ "out": ""
},
"export": {
diff --git a/tests/testthat/_snaps/app-bookmark/001_.png b/tests/testthat/_snaps/app-bookmark/001_.png
new file mode 100644
index 00000000..994c7d08
Binary files /dev/null and b/tests/testthat/_snaps/app-bookmark/001_.png differ
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download.md b/tests/testthat/_snaps/app-download.md
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download.md
rename to tests/testthat/_snaps/app-download.md
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/001-download-link.txt b/tests/testthat/_snaps/app-download/001-download-link.txt
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/001-download-link.txt
rename to tests/testthat/_snaps/app-download/001-download-link.txt
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/002-download-button.txt b/tests/testthat/_snaps/app-download/002-download-button.txt
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/002-download-button.txt
rename to tests/testthat/_snaps/app-download/002-download-button.txt
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/003-download-link.csv b/tests/testthat/_snaps/app-download/003-download-link.csv
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/003-download-link.csv
rename to tests/testthat/_snaps/app-download/003-download-link.csv
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/004-download-button.csv b/tests/testthat/_snaps/app-download/004-download-button.csv
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/004-download-button.csv
rename to tests/testthat/_snaps/app-download/004-download-button.csv
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/005-bear.png b/tests/testthat/_snaps/app-download/005-bear.png
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/005-bear.png
rename to tests/testthat/_snaps/app-download/005-bear.png
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/006-bear.png b/tests/testthat/_snaps/app-download/006-bear.png
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/006-bear.png
rename to tests/testthat/_snaps/app-download/006-bear.png
diff --git a/tests/testthat/apps/download/tests/testthat/_snaps/app-download/007-my_custom_name.txt b/tests/testthat/_snaps/app-download/007-my_custom_name.txt
similarity index 100%
rename from tests/testthat/apps/download/tests/testthat/_snaps/app-download/007-my_custom_name.txt
rename to tests/testthat/_snaps/app-download/007-my_custom_name.txt
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-long/cars-points-10.svg b/tests/testthat/_snaps/app-export/cars-points-10.svg
similarity index 100%
rename from tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-long/cars-points-10.svg
rename to tests/testthat/_snaps/app-export/cars-points-10.svg
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-long/cars-points-20.svg b/tests/testthat/_snaps/app-export/cars-points-20.svg
similarity index 100%
rename from tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-long/cars-points-20.svg
rename to tests/testthat/_snaps/app-export/cars-points-20.svg
diff --git a/tests/testthat/apps/files-server-ui/tests/testthat/_snaps/shinytest2/kgs-001.json b/tests/testthat/_snaps/app-files/kgs-001.json
similarity index 100%
rename from tests/testthat/apps/files-server-ui/tests/testthat/_snaps/shinytest2/kgs-001.json
rename to tests/testthat/_snaps/app-files/kgs-001.json
diff --git a/tests/testthat/_snaps/app-files/kgs-001_.png b/tests/testthat/_snaps/app-files/kgs-001_.png
new file mode 100644
index 00000000..3e924806
Binary files /dev/null and b/tests/testthat/_snaps/app-files/kgs-001_.png differ
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-click/001.json b/tests/testthat/_snaps/app-hello-click/001.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-click/001.json
rename to tests/testthat/_snaps/app-hello-click/001.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-click/001_.png b/tests/testthat/_snaps/app-hello-click/001_.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-click/001_.png
rename to tests/testthat/_snaps/app-hello-click/001_.png
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-click/002.json b/tests/testthat/_snaps/app-hello-click/002.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-click/002.json
rename to tests/testthat/_snaps/app-hello-click/002.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-click/002_.png b/tests/testthat/_snaps/app-hello-click/002_.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-click/002_.png
rename to tests/testthat/_snaps/app-hello-click/002_.png
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/execute-js.md b/tests/testthat/_snaps/app-hello-execute-js.md
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/execute-js.md
rename to tests/testthat/_snaps/app-hello-execute-js.md
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-init-args/test-001.json b/tests/testthat/_snaps/app-hello-init-args/test-001.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-init-args/test-001.json
rename to tests/testthat/_snaps/app-hello-init-args/test-001.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-init-args/test-custom.json b/tests/testthat/_snaps/app-hello-init-args/test-custom.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-init-args/test-custom.json
rename to tests/testthat/_snaps/app-hello-init-args/test-custom.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-variant/001.json b/tests/testthat/_snaps/app-hello-variant/001.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-variant/001.json
rename to tests/testthat/_snaps/app-hello-variant/001.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/app-variant/001_.png b/tests/testthat/_snaps/app-hello-variant/001_.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/app-variant/001_.png
rename to tests/testthat/_snaps/app-hello-variant/001_.png
diff --git a/tests/testthat/apps/text_html/tests/testthat/_snaps/expect-snapshot-js.md b/tests/testthat/_snaps/app-html-text.md
similarity index 100%
rename from tests/testthat/apps/text_html/tests/testthat/_snaps/expect-snapshot-js.md
rename to tests/testthat/_snaps/app-html-text.md
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/no-pic1-001.json b/tests/testthat/_snaps/app-image/no-pic1-001.json
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/no-pic1-001.json
rename to tests/testthat/_snaps/app-image/no-pic1-001.json
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/no-pic2-001.json b/tests/testthat/_snaps/app-image/no-pic2-001.json
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/no-pic2-001.json
rename to tests/testthat/_snaps/app-image/no-pic2-001.json
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001.json b/tests/testthat/_snaps/app-image/sa-user-001.json
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001.json
rename to tests/testthat/_snaps/app-image/sa-user-001.json
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png b/tests/testthat/_snaps/app-image/sa-user-001_.png
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png
rename to tests/testthat/_snaps/app-image/sa-user-001_.png
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001.json b/tests/testthat/_snaps/app-image/sa-values-001.json
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001.json
rename to tests/testthat/_snaps/app-image/sa-values-001.json
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png b/tests/testthat/_snaps/app-image/sa-values-001_.png
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png
rename to tests/testthat/_snaps/app-image/sa-values-001_.png
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png b/tests/testthat/_snaps/app-image/screen1-001.png
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png
rename to tests/testthat/_snaps/app-image/screen1-001.png
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png b/tests/testthat/_snaps/app-image/screen2-001.png
similarity index 100%
rename from tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png
rename to tests/testthat/_snaps/app-image/screen2-001.png
diff --git a/tests/testthat/apps/plotly/tests/testthat/_snaps/plotly/001.json b/tests/testthat/_snaps/app-plotly/001.json
similarity index 100%
rename from tests/testthat/apps/plotly/tests/testthat/_snaps/plotly/001.json
rename to tests/testthat/_snaps/app-plotly/001.json
diff --git a/tests/testthat/apps/qmd/tests/testthat/_snaps/quarto/001.json b/tests/testthat/_snaps/app-quarto/001.json
similarity index 100%
rename from tests/testthat/apps/qmd/tests/testthat/_snaps/quarto/001.json
rename to tests/testthat/_snaps/app-quarto/001.json
diff --git a/tests/testthat/_snaps/app-quarto/001_.png b/tests/testthat/_snaps/app-quarto/001_.png
new file mode 100644
index 00000000..35b31ce3
Binary files /dev/null and b/tests/testthat/_snaps/app-quarto/001_.png differ
diff --git a/tests/testthat/apps/rmd-pre/tests/testthat/_snaps/prerendered/001.json b/tests/testthat/_snaps/app-rmd/pre-001.json
similarity index 100%
rename from tests/testthat/apps/rmd-pre/tests/testthat/_snaps/prerendered/001.json
rename to tests/testthat/_snaps/app-rmd/pre-001.json
diff --git a/tests/testthat/_snaps/app-rmd/pre-001_.png b/tests/testthat/_snaps/app-rmd/pre-001_.png
new file mode 100644
index 00000000..2c5e1ea7
Binary files /dev/null and b/tests/testthat/_snaps/app-rmd/pre-001_.png differ
diff --git a/tests/testthat/apps/rmd-shiny/tests/testthat/_snaps/rmd/001.json b/tests/testthat/_snaps/app-rmd/shiny-001.json
similarity index 100%
rename from tests/testthat/apps/rmd-shiny/tests/testthat/_snaps/rmd/001.json
rename to tests/testthat/_snaps/app-rmd/shiny-001.json
diff --git a/tests/testthat/apps/rmd-shiny/tests/testthat/_snaps/rmd/001_.png b/tests/testthat/_snaps/app-rmd/shiny-001_.png
similarity index 100%
rename from tests/testthat/apps/rmd-shiny/tests/testthat/_snaps/rmd/001_.png
rename to tests/testthat/_snaps/app-rmd/shiny-001_.png
diff --git a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/click-001.json b/tests/testthat/_snaps/app-update/click-001.json
similarity index 100%
rename from tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/click-001.json
rename to tests/testthat/_snaps/app-update/click-001.json
diff --git a/tests/testthat/_snaps/app-update/click-001_.png b/tests/testthat/_snaps/app-update/click-001_.png
new file mode 100644
index 00000000..8c0c43b9
Binary files /dev/null and b/tests/testthat/_snaps/app-update/click-001_.png differ
diff --git a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/no-binding-001.json b/tests/testthat/_snaps/app-update/no-binding-001.json
similarity index 100%
rename from tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/no-binding-001.json
rename to tests/testthat/_snaps/app-update/no-binding-001.json
diff --git a/tests/testthat/_snaps/app-update/no-binding-001_.png b/tests/testthat/_snaps/app-update/no-binding-001_.png
new file mode 100644
index 00000000..dc6b2b1d
Binary files /dev/null and b/tests/testthat/_snaps/app-update/no-binding-001_.png differ
diff --git a/tests/testthat/apps/upload/tests/testthat/_snaps/app-upload/upload-001.json b/tests/testthat/_snaps/app-upload/001.json
similarity index 100%
rename from tests/testthat/apps/upload/tests/testthat/_snaps/app-upload/upload-001.json
rename to tests/testthat/_snaps/app-upload/001.json
diff --git a/tests/testthat/_snaps/app-upload/001_.png b/tests/testthat/_snaps/app-upload/001_.png
new file mode 100644
index 00000000..3d0e5c2e
Binary files /dev/null and b/tests/testthat/_snaps/app-upload/001_.png differ
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json b/tests/testthat/_snaps/app-widgets/001.json
similarity index 100%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json
rename to tests/testthat/_snaps/app-widgets/001.json
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png b/tests/testthat/_snaps/app-widgets/001_.png
similarity index 100%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png
rename to tests/testthat/_snaps/app-widgets/001_.png
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json b/tests/testthat/_snaps/app-widgets/002.json
similarity index 100%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json
rename to tests/testthat/_snaps/app-widgets/002.json
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png b/tests/testthat/_snaps/app-widgets/002_.png
similarity index 99%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png
rename to tests/testthat/_snaps/app-widgets/002_.png
index 26975b4f..44d1292a 100644
Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png and b/tests/testthat/_snaps/app-widgets/002_.png differ
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json b/tests/testthat/_snaps/app-widgets/003.json
similarity index 100%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json
rename to tests/testthat/_snaps/app-widgets/003.json
diff --git a/tests/testthat/_snaps/app-widgets/003_.png b/tests/testthat/_snaps/app-widgets/003_.png
new file mode 100644
index 00000000..8ef0f12e
Binary files /dev/null and b/tests/testthat/_snaps/app-widgets/003_.png differ
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json b/tests/testthat/_snaps/app-widgets/004.json
similarity index 100%
rename from tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json
rename to tests/testthat/_snaps/app-widgets/004.json
diff --git a/tests/testthat/_snaps/app-widgets/004_.png b/tests/testthat/_snaps/app-widgets/004_.png
new file mode 100644
index 00000000..78443641
Binary files /dev/null and b/tests/testthat/_snaps/app-widgets/004_.png differ
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app.md b/tests/testthat/_snaps/mac-4.1/app-hello.md
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app.md
rename to tests/testthat/_snaps/mac-4.1/app-hello.md
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/001.png b/tests/testthat/_snaps/mac-4.1/app-hello/001.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/001.png
rename to tests/testthat/_snaps/mac-4.1/app-hello/001.png
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002.json b/tests/testthat/_snaps/mac-4.1/app-hello/002.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002.json
rename to tests/testthat/_snaps/mac-4.1/app-hello/002.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002_.png b/tests/testthat/_snaps/mac-4.1/app-hello/002_.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002_.png
rename to tests/testthat/_snaps/mac-4.1/app-hello/002_.png
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003.json b/tests/testthat/_snaps/mac-4.1/app-hello/003.json
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003.json
rename to tests/testthat/_snaps/mac-4.1/app-hello/003.json
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003_.png b/tests/testthat/_snaps/mac-4.1/app-hello/003_.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003_.png
rename to tests/testthat/_snaps/mac-4.1/app-hello/003_.png
diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/manual-screenshot.png b/tests/testthat/_snaps/mac-4.1/app-hello/manual-screenshot.png
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/manual-screenshot.png
rename to tests/testthat/_snaps/mac-4.1/app-hello/manual-screenshot.png
diff --git a/tests/testthat/_snaps/mac-4.1/app-image/001.json b/tests/testthat/_snaps/mac-4.1/app-image/001.json
new file mode 100644
index 00000000..1b5b569e
--- /dev/null
+++ b/tests/testthat/_snaps/mac-4.1/app-image/001.json
@@ -0,0 +1,13 @@
+{
+ "input": {
+ "rawr": 1
+ },
+ "output": {
+ "img": [
+
+ ]
+ },
+ "export": {
+
+ }
+}
diff --git a/tests/testthat/_snaps/mac-4.1/app-image/001_.png b/tests/testthat/_snaps/mac-4.1/app-image/001_.png
new file mode 100644
index 00000000..e1f36ed5
Binary files /dev/null and b/tests/testthat/_snaps/mac-4.1/app-image/001_.png differ
diff --git a/tests/testthat/_snaps/mac-4.1/app-image/002.json b/tests/testthat/_snaps/mac-4.1/app-image/002.json
new file mode 100644
index 00000000..4cffa9d3
--- /dev/null
+++ b/tests/testthat/_snaps/mac-4.1/app-image/002.json
@@ -0,0 +1,7 @@
+{
+ "output": {
+ "img": [
+
+ ]
+ }
+}
diff --git a/tests/testthat/_snaps/mac-4.1/app-image/002_.png b/tests/testthat/_snaps/mac-4.1/app-image/002_.png
new file mode 100644
index 00000000..2cef4d1d
Binary files /dev/null and b/tests/testthat/_snaps/mac-4.1/app-image/002_.png differ
diff --git a/tests/testthat/apps/upload/tests/testthat/cars.csv b/tests/testthat/app-files/cars.csv
similarity index 100%
rename from tests/testthat/apps/upload/tests/testthat/cars.csv
rename to tests/testthat/app-files/cars.csv
diff --git a/tests/testthat/apps/bookmark/app.R b/tests/testthat/apps/bookmark/app.R
deleted file mode 100644
index 30cf8fa1..00000000
--- a/tests/testthat/apps/bookmark/app.R
+++ /dev/null
@@ -1,21 +0,0 @@
-library(shiny)
-
-ui <- function(request) {
- fluidPage(
- textInput("txt", "Enter text"),
- checkboxInput("caps", "Capitalize"),
- verbatimTextOutput("out"),
- bookmarkButton()
- )
-}
-server <- function(input, output, session) {
- output$out <- renderText({
- if (input$caps) {
- toupper(input$txt)
- } else {
- input$txt
- }
- })
-}
-
-shinyApp(ui, server, enableBookmarking = "url")
diff --git a/tests/testthat/apps/bookmark/tests/testthat.R b/tests/testthat/apps/bookmark/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/bookmark/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001_.png b/tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001_.png
deleted file mode 100644
index 7be77abb..00000000
Binary files a/tests/testthat/apps/bookmark/tests/testthat/_snaps/bookmark/001_.png and /dev/null differ
diff --git a/tests/testthat/apps/bookmark/tests/testthat/setup-shinytest2.R b/tests/testthat/apps/bookmark/tests/testthat/setup-shinytest2.R
deleted file mode 100644
index be65b4f0..00000000
--- a/tests/testthat/apps/bookmark/tests/testthat/setup-shinytest2.R
+++ /dev/null
@@ -1,2 +0,0 @@
-# Load application support files into testing environment
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/dir-profile/tests/testthat.R b/tests/testthat/apps/dir-profile/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/dir-profile/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/dir-profile/tests/testthat/setup-shinytest2.R b/tests/testthat/apps/dir-profile/tests/testthat/setup-shinytest2.R
deleted file mode 100644
index be65b4f0..00000000
--- a/tests/testthat/apps/dir-profile/tests/testthat/setup-shinytest2.R
+++ /dev/null
@@ -1,2 +0,0 @@
-# Load application support files into testing environment
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/dir-profile/.Rprofile b/tests/testthat/apps/dir-rprofile/.Rprofile
similarity index 100%
rename from tests/testthat/apps/dir-profile/.Rprofile
rename to tests/testthat/apps/dir-rprofile/.Rprofile
diff --git a/tests/testthat/apps/dir-profile/app.R b/tests/testthat/apps/dir-rprofile/app.R
similarity index 100%
rename from tests/testthat/apps/dir-profile/app.R
rename to tests/testthat/apps/dir-rprofile/app.R
diff --git a/tests/testthat/apps/download/app.R b/tests/testthat/apps/download/app.R
deleted file mode 100644
index a2b6541d..00000000
--- a/tests/testthat/apps/download/app.R
+++ /dev/null
@@ -1,66 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- downloadButton("download_button_txt", "Download Button - Text"),
- downloadButton("download_link_txt", "Download Link - Text"),
- downloadButton("download_button_csv", "Download Button - CSV"),
- downloadButton("download_link_csv", "Download Link - CSV"),
- downloadButton("download_button_binary", "Download Button - Binary"),
- downloadButton("download_link_binary", "Download Link - Binary"),
-)
-
-server <- function(input, output) {
-
- output$download_button_txt <- downloadHandler(
- filename = function() {
- "download-button.txt"
- },
- content = function(file) {
- cat("Download content!\n", file = file)
- }
- )
- output$download_link_txt <- downloadHandler(
- filename = function() {
- "download-link.txt"
- },
- content = function(file) {
- cat("Download content!\n", file = file)
- }
- )
-
- output$download_button_csv <- downloadHandler(
- filename = function() {
- "download-button.csv"
- },
- content = function(file) {
- write.csv(head(cars, 10), file)
- }
- )
- output$download_link_csv <- downloadHandler(
- filename = function() {
- "download-link.csv"
- },
- content = function(file) {
- write.csv(tail(cars, 10), file)
- }
- )
-
- output$download_button_binary <- downloadHandler(
- filename = function() {
- "bear.png"
- },
- content = function(file) {
- file.copy("bear.png", file)
- }
- )
- output$download_link_binary <- downloadHandler(
- filename = function() {
- "bear.png"
- },
- content = function(file) {
- file.copy("bear.png", file)
- }
- )
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/download/bear.png b/tests/testthat/apps/download/bear.png
deleted file mode 100644
index 60b3710a..00000000
Binary files a/tests/testthat/apps/download/bear.png and /dev/null differ
diff --git a/tests/testthat/apps/download/tests/testthat.R b/tests/testthat/apps/download/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/download/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/download/tests/testthat/setup.R b/tests/testthat/apps/download/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/download/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/download/tests/testthat/test-app-download.R b/tests/testthat/apps/download/tests/testthat/test-app-download.R
deleted file mode 100644
index 89ebe1f7..00000000
--- a/tests/testthat/apps/download/tests/testthat/test-app-download.R
+++ /dev/null
@@ -1,46 +0,0 @@
-
-test_that("download files work from link and button", {
- app <- AppDriver$new(variant = NULL)
-
- app$wait_for_js("$('#download_link_csv').attr('href') != ''")
- app$wait_for_js("$('#download_button_csv').attr('href') != ''")
- app$wait_for_js("$('#download_link_txt').attr('href') != ''")
- app$wait_for_js("$('#download_button_txt').attr('href') != ''")
- app$wait_for_js("$('#download_link_binary').attr('href') != ''")
- app$wait_for_js("$('#download_button_binary').attr('href') != ''")
-
- app$expect_download("download_link_txt")
- app$expect_download("download_button_txt")
-
- app$expect_download("download_link_csv")
- app$expect_download("download_button_csv")
-
- app$expect_download("download_link_binary")
- app$expect_download("download_button_binary")
-
- # Try custom name
- app$expect_download("download_button_txt", name = "my/custom/name.txt")
-})
-
-
-test_that("download files can be retrieved", {
- on.exit({
- if (fs::file_exists("barret.test")) {
- fs::file_delete("barret.test")
- }
- }, add = TRUE)
-
- app <- AppDriver$new(variant = NULL)
-
- app$wait_for_js("$('#download_link_csv').attr('href') != ''")
- app$wait_for_js("$('#download_button_csv').attr('href') != ''")
-
- link_file <- app$get_download("download_link_csv")
- button_file <- app$get_download("download_button_csv", "barret.test")
-
- expect_equal(fs::path_file(link_file), "download-link.csv")
- expect_equal(fs::path_file(button_file), "barret.test")
-
- expect_gt(file.info(link_file)$size, 0)
- expect_gt(file.info(button_file)$size, 0)
-})
diff --git a/tests/testthat/apps/export/app.R b/tests/testthat/apps/export/app.R
deleted file mode 100644
index ba326250..00000000
--- a/tests/testthat/apps/export/app.R
+++ /dev/null
@@ -1,36 +0,0 @@
-library(shiny)
-
-shinyApp(
- ui = basicPage(
- h4("Snapshot URL: "),
- uiOutput("url"),
- h4("Current values:"),
- verbatimTextOutput("values"),
- actionButton("inc", "Increment x")
- ),
-
- server = function(input, output, session) {
- vals <- reactiveValues(x = 1)
- y <- reactive({
- vals$x + 1
- })
-
- observeEvent(input$inc, {
- vals$x <<- vals$x + 1
- })
-
- exportTestValues(
- x = vals$x,
- y = y()
- )
-
- output$url <- renderUI({
- url <- session$getTestSnapshotUrl(format = "json")
- a(href = url, url)
- })
-
- output$values <- renderText({
- paste0("vals$x: ", vals$x, "\ny: ", y())
- })
- }
-)
diff --git a/tests/testthat/apps/export/tests/testthat.R b/tests/testthat/apps/export/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/export/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/export/tests/testthat/setup.R b/tests/testthat/apps/export/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/export/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/export/tests/testthat/test-app-export.R b/tests/testthat/apps/export/tests/testthat/test-app-export.R
deleted file mode 100644
index d404bf57..00000000
--- a/tests/testthat/apps/export/tests/testthat/test-app-export.R
+++ /dev/null
@@ -1,15 +0,0 @@
-
-test_that("Exported values", {
- app <- AppDriver$new()
-
- x <- app$get_values()
- expect_identical(x$export$x, 1)
- expect_identical(x$export$y, 2)
-
- app$set_inputs(inc = "click")
- app$set_inputs(inc = "click")
-
- x <- app$get_values()
- expect_identical(x$export$x, 3)
- expect_identical(x$export$y, 4)
-})
diff --git a/tests/testthat/apps/files-app-rmd/tests/testthat.R b/tests/testthat/apps/files-app-rmd/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/files-app-rmd/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/files-app-rmd/tests/testthat/setup.R b/tests/testthat/apps/files-app-rmd/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/files-app-rmd/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/files-app-rmd/tests/testthat/test-shinytest2.R b/tests/testthat/apps/files-app-rmd/tests/testthat/test-shinytest2.R
deleted file mode 100644
index 5f179022..00000000
--- a/tests/testthat/apps/files-app-rmd/tests/testthat/test-shinytest2.R
+++ /dev/null
@@ -1,9 +0,0 @@
-library(shinytest2)
-
-test_that("rmarkdown and app.R are not compatible", {
- expect_error(
- AppDriver$new(),
- "`app_dir` must be a directory containing",
- fixed = TRUE
- )
-})
diff --git a/tests/testthat/apps/files-app-server/tests/testthat.R b/tests/testthat/apps/files-app-server/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/files-app-server/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/files-app-server/tests/testthat/setup.R b/tests/testthat/apps/files-app-server/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/files-app-server/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/files-app-server/tests/testthat/test-shinytest2.R b/tests/testthat/apps/files-app-server/tests/testthat/test-shinytest2.R
deleted file mode 100644
index 936e8db7..00000000
--- a/tests/testthat/apps/files-app-server/tests/testthat/test-shinytest2.R
+++ /dev/null
@@ -1,9 +0,0 @@
-library(shinytest2)
-
-test_that("server.R and app.R are not compatible", {
- expect_error(
- AppDriver$new()$stop(),
- "Unintented behavior may occur",
- fixed = TRUE
- )
-})
diff --git a/tests/testthat/apps/files-server-ui/tests/testthat.R b/tests/testthat/apps/files-server-ui/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/files-server-ui/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/files-server-ui/tests/testthat/_snaps/shinytest2/kgs-001_.png b/tests/testthat/apps/files-server-ui/tests/testthat/_snaps/shinytest2/kgs-001_.png
deleted file mode 100644
index 4323c27d..00000000
Binary files a/tests/testthat/apps/files-server-ui/tests/testthat/_snaps/shinytest2/kgs-001_.png and /dev/null differ
diff --git a/tests/testthat/apps/files-server-ui/tests/testthat/setup-shinytest2.R b/tests/testthat/apps/files-server-ui/tests/testthat/setup-shinytest2.R
deleted file mode 100644
index be65b4f0..00000000
--- a/tests/testthat/apps/files-server-ui/tests/testthat/setup-shinytest2.R
+++ /dev/null
@@ -1,2 +0,0 @@
-# Load application support files into testing environment
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/files-server-ui/tests/testthat/test-shinytest2.R b/tests/testthat/apps/files-server-ui/tests/testthat/test-shinytest2.R
deleted file mode 100644
index 51910051..00000000
--- a/tests/testthat/apps/files-server-ui/tests/testthat/test-shinytest2.R
+++ /dev/null
@@ -1,7 +0,0 @@
-library(shinytest2)
-
-test_that("{shinytest2} recording: kgs", {
- app <- AppDriver$new(name = "kgs", height = 1321, width = 1221)
- app$set_inputs(kg = 100)
- app$expect_values()
-})
diff --git a/tests/testthat/apps/hello/tests/testthat/js/execute-js.js b/tests/testthat/apps/hello/js/execute-js.js
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/js/execute-js.js
rename to tests/testthat/apps/hello/js/execute-js.js
diff --git a/tests/testthat/apps/hello/tests/testthat/js/expect-js.js b/tests/testthat/apps/hello/js/expect-js.js
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/js/expect-js.js
rename to tests/testthat/apps/hello/js/expect-js.js
diff --git a/tests/testthat/apps/hello/tests/testthat/js/one-plus-one.js b/tests/testthat/apps/hello/js/one-plus-one.js
similarity index 100%
rename from tests/testthat/apps/hello/tests/testthat/js/one-plus-one.js
rename to tests/testthat/apps/hello/js/one-plus-one.js
diff --git a/tests/testthat/apps/hello/tests/testthat.R b/tests/testthat/apps/hello/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/hello/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/hello/tests/testthat/setup.R b/tests/testthat/apps/hello/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/hello/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/image/app.R b/tests/testthat/apps/image/app.R
deleted file mode 100644
index 58893b74..00000000
--- a/tests/testthat/apps/image/app.R
+++ /dev/null
@@ -1,27 +0,0 @@
-library(shiny)
-
-# App that uses `renderImage()`
-
-ui <- fluidPage(
- h3("A bear"),
- actionButton("rawr", "Rawr!"),
- tags$br(),
- imageOutput("img", width = 500, height = 500),
-
- tags$br(),
- h3("A red box"),
- div(id = "red", style = "background-color: red; width: 100px; height: 100px;"),
- h3("A green box"),
- div(id = "green", style = "background-color: darkgreen; width: 100px; height: 100px;"),
-)
-
-server <- function(input, output, session) {
- output$img <- renderImage({
- shiny::req(input$rawr)
-
- list(src = "bear.png")
- }, deleteFile = FALSE)
-
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/image/bear.png b/tests/testthat/apps/image/bear.png
deleted file mode 100644
index 60b3710a..00000000
Binary files a/tests/testthat/apps/image/bear.png and /dev/null differ
diff --git a/tests/testthat/apps/image/tests/testthat.R b/tests/testthat/apps/image/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/image/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001.json b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001.json
deleted file mode 100644
index 0f9d1170..00000000
--- a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "input": {
- "rawr": 1
- },
- "output": {
- "img": {
- "src": "[image data hash: 29837440fa6116731e3cfdb9c02bc1e1]"
- }
- },
- "export": {
-
- }
-}
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png
deleted file mode 100644
index bbb05432..00000000
Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png and /dev/null differ
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002.json b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002.json
deleted file mode 100644
index 22b85200..00000000
--- a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "output": {
- "img": {
- "src": "[image data hash: 29837440fa6116731e3cfdb9c02bc1e1]"
- }
- }
-}
diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png
deleted file mode 100644
index 85cd6637..00000000
Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png and /dev/null differ
diff --git a/tests/testthat/apps/image/tests/testthat/setup.R b/tests/testthat/apps/image/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/image/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/logs/app.R b/tests/testthat/apps/logs/app.R
deleted file mode 100644
index 17e161f3..00000000
--- a/tests/testthat/apps/logs/app.R
+++ /dev/null
@@ -1,33 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- "For testing logging purposes only",
- verbatimTextOutput("time"),
- # Print all known types
- tags$script("console.log('Nullish', null, undefined)"),
- tags$script("console.log('Boolean', false, true)"),
- tags$script("console.log('Character', 'abc')"),
- tags$script("console.log('Number', 123)"),
- tags$script("console.log('BigInt', 10n)"),
- tags$script("console.log('Object', {'a': 'b'})"),
- tags$script("console.log('Math', Math)"),
- tags$script("console.log('Symbol', Symbol('abc'))"),
- tags$script("console.log('Array', [1,2, 3])"),
- tags$script("console.log('Function', Date)"),
- # Capture throw
- tags$script("setTimeout(function() { throw 'Exception msg' }, 2)"),
- # Capture exception
- tags$script("setTimeout(function() { window.test_method(); }, 4)"),
-)
-server <- function(input, output, session) {
- cat("Cat msg!\n")
-
- message("Message msg!")
-
- output$time <- renderText({
- shiny::invalidateLater(3 * 1000)
- Sys.time()
- })
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/logs/tests/testthat.R b/tests/testthat/apps/logs/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/logs/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/logs/tests/testthat/setup.R b/tests/testthat/apps/logs/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/logs/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/plotly/app.R b/tests/testthat/apps/plotly/app.R
deleted file mode 100644
index e979d70f..00000000
--- a/tests/testthat/apps/plotly/app.R
+++ /dev/null
@@ -1,19 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- plotly::plotlyOutput(outputId = "p")
-)
-
-server <- function(input, output, session, ...) {
- output$p <- shiny::snapshotPreprocessOutput(
- plotly::renderPlotly({
- plotly::plot_ly(x = cars[, 1], y = cars[, 2], type = "scattergl", mode = "markers")
- }),
- function(p) {
- jsonlite::parse_json(p, simplifyVector = TRUE, simplifyDataFrame = FALSE,
- simplifyMatrix = FALSE)$x$data[[1]][c("x", "y")]
- }
- )
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/plotly/tests/testthat.R b/tests/testthat/apps/plotly/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/plotly/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/plotly/tests/testthat/setup.R b/tests/testthat/apps/plotly/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/plotly/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/plotly/tests/testthat/test-plotly.R b/tests/testthat/apps/plotly/tests/testthat/test-plotly.R
deleted file mode 100644
index 8d328f9a..00000000
--- a/tests/testthat/apps/plotly/tests/testthat/test-plotly.R
+++ /dev/null
@@ -1,11 +0,0 @@
-
-test_that("plotly webgl works", {
- skip_if_not_installed("plotly")
- # TODO-future; Good candidate for fuzzy picture matching
-
- app <- AppDriver$new()
-
- app$wait_for_value(output = "p", ignore = list(NULL))
-
- app$expect_values(output = "p", screenshot_args = FALSE)
-})
diff --git a/tests/testthat/apps/qmd/tests/testthat.R b/tests/testthat/apps/qmd/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/qmd/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/qmd/tests/testthat/_snaps/quarto/001_.png b/tests/testthat/apps/qmd/tests/testthat/_snaps/quarto/001_.png
deleted file mode 100644
index 350a8ce4..00000000
Binary files a/tests/testthat/apps/qmd/tests/testthat/_snaps/quarto/001_.png and /dev/null differ
diff --git a/tests/testthat/apps/qmd/tests/testthat/setup.R b/tests/testthat/apps/qmd/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/qmd/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/rmd-not-shiny/tests/testthat.R b/tests/testthat/apps/rmd-not-shiny/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/rmd-not-shiny/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/rmd-not-shiny/tests/testthat/setup.R b/tests/testthat/apps/rmd-not-shiny/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/rmd-not-shiny/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/rmd-not-shiny/tests/testthat/test-ignore-regular-rmd.R b/tests/testthat/apps/rmd-not-shiny/tests/testthat/test-ignore-regular-rmd.R
deleted file mode 100644
index d2622b46..00000000
--- a/tests/testthat/apps/rmd-not-shiny/tests/testthat/test-ignore-regular-rmd.R
+++ /dev/null
@@ -1,10 +0,0 @@
-library(shinytest2)
-
-test_that("Regular Rmd files are ignored", {
- app <- AppDriver$new()
-
- expect_equal(
- app$get_value(output = "format_type"),
- "PDF"
- )
-})
diff --git a/tests/testthat/apps/rmd-pre/tests/testthat.R b/tests/testthat/apps/rmd-pre/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/rmd-pre/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/rmd-pre/tests/testthat/_snaps/prerendered/001_.png b/tests/testthat/apps/rmd-pre/tests/testthat/_snaps/prerendered/001_.png
deleted file mode 100644
index a0d470ad..00000000
Binary files a/tests/testthat/apps/rmd-pre/tests/testthat/_snaps/prerendered/001_.png and /dev/null differ
diff --git a/tests/testthat/apps/rmd-pre/tests/testthat/setup.R b/tests/testthat/apps/rmd-pre/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/rmd-pre/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/rmd-pre/tests/testthat/test-prerendered.R b/tests/testthat/apps/rmd-pre/tests/testthat/test-prerendered.R
deleted file mode 100644
index 26a27d68..00000000
--- a/tests/testthat/apps/rmd-pre/tests/testthat/test-prerendered.R
+++ /dev/null
@@ -1,13 +0,0 @@
-library(shinytest2)
-
-test_that("Prerendered Shiny R Markdown documents can test", {
- app <- AppDriver$new(seed = 9767)
-
- app$set_inputs(name = "barret")
- app$click("greet")
- app$expect_values()
- expect_equal(
- app$get_value(output = "greeting"),
- "Hello barret!"
- )
-})
diff --git a/tests/testthat/apps/rmd-shiny/tests/testthat.R b/tests/testthat/apps/rmd-shiny/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/rmd-shiny/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/rmd-shiny/tests/testthat/setup.R b/tests/testthat/apps/rmd-shiny/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/rmd-shiny/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/rmd-shiny/tests/testthat/test-rmd.R b/tests/testthat/apps/rmd-shiny/tests/testthat/test-rmd.R
deleted file mode 100644
index e50a4850..00000000
--- a/tests/testthat/apps/rmd-shiny/tests/testthat/test-rmd.R
+++ /dev/null
@@ -1,13 +0,0 @@
-library(shinytest2)
-
-test_that("Shiny R Markdown documents can test", {
- app <- AppDriver$new(seed = 9767)
-
- app$set_inputs(name = "barret")
- app$click("greet")
- app$expect_values(input = TRUE, output = "greeting")
- expect_equal(
- app$get_value(output = "greeting"),
- "Hello barret!"
- )
-})
diff --git a/tests/testthat/apps/robust-ex/app.R b/tests/testthat/apps/robust-ex/app.R
deleted file mode 100644
index 081b5f18..00000000
--- a/tests/testthat/apps/robust-ex/app.R
+++ /dev/null
@@ -1,26 +0,0 @@
-library(shiny)
-library(ggplot2)
-
-ui <- fluidPage(
- numericInput("n", "Number of rows", 10, 1, nrow(cars)),
- plotOutput("plot")
-)
-server <- function(input, output) {
- dt <- reactive({
- head(cars, input$n)
- })
- plot_obj <- reactive({
- ggplot2::ggplot(dt(), ggplot2::aes_string("speed", "dist")) + ggplot2::geom_point()
- })
-
- output$plot <- renderPlot({
- plot_obj()
- })
-
- exportTestValues(
- dt = dt(),
- plot_obj = plot_obj()
- )
-}
-
-shinyApp(ui = ui, server = server)
diff --git a/tests/testthat/apps/robust-ex/tests/testthat.R b/tests/testthat/apps/robust-ex/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-10.svg b/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-10.svg
deleted file mode 100644
index 733856ae..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-10.svg
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-20.svg b/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-20.svg
deleted file mode 100644
index 4c026535..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat/_snaps/export-short/cars-points-20.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/setup.R b/tests/testthat/apps/robust-ex/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/test-export-long.R b/tests/testthat/apps/robust-ex/tests/testthat/test-export-long.R
deleted file mode 100644
index 72264b96..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat/test-export-long.R
+++ /dev/null
@@ -1,35 +0,0 @@
-library(shinytest2)
-
-test_that("`export`ed `plot_obj` is updated by `n`", {
- skip_if_not_installed("vdiffr")
-
- app <- AppDriver$new()
-
- # Verify `dt()` uses first 10 lines of `cars`
- n10 <- app$get_value(input = "n")
- expect_equal(n10, 10)
- # Verify `dt10()` data is first 10 lines of `cars`
- dt10 <- app$get_value(export = "dt")
- expect_equal(dt10, head(cars, n10))
-
- # Verify `plot_obj()` data is `dt()`
- plot_obj_10 <- app$get_value(export = "plot_obj")
- expect_equal(plot_obj_10$data, dt10)
- # Verify `plot_obj()` is consistent
- vdiffr::expect_doppelganger("cars-points-10", plot_obj_10)
-
- ## Update `n` to 20
- app$set_inputs(n = 20)
-
- # Verify `n` was updated
- n20 <- app$get_value(input = "n")
- expect_equal(n20, 20)
- # Verify `dt()` uses first 20 lines of `cars`
- dt20 <- app$get_value(export = "dt")
- expect_equal(dt20, head(cars, n20))
-
- # Verify `plot_obj()` data is `dt()`
- plot_obj_20 <- app$get_value(export = "plot_obj")
- expect_equal(plot_obj_20$data, dt20)
- vdiffr::expect_doppelganger("cars-points-20", plot_obj_20)
-})
diff --git a/tests/testthat/apps/robust-ex/tests/testthat/test-export-short.R b/tests/testthat/apps/robust-ex/tests/testthat/test-export-short.R
deleted file mode 100644
index 6e1743c9..00000000
--- a/tests/testthat/apps/robust-ex/tests/testthat/test-export-short.R
+++ /dev/null
@@ -1,29 +0,0 @@
-library(shinytest2)
-
-
-test_that("`export`ed `plot_obj` is updated by `n`", {
-
- skip_if_not_installed("vdiffr")
-
- app <- AppDriver$new()
-
- expect_n_and_plot <- function(n) {
- # Verify `n` input equals `n`
- n_val <- app$get_value(input = "n")
- testthat::expect_equal(n_val, n, expected.label = n)
- # Verify `dt()` data is first `n` lines of `cars`
- dt <- app$get_value(export = "dt")
- testthat::expect_equal(dt, head(cars, n), expected.label = paste0("head(cars, ", n, ")"))
-
- # Verify `plot_obj()` data is `dt()`
- plot_obj <- app$get_value(export = "plot_obj")
- testthat::expect_equal(plot_obj$data, dt, info = paste0("n = ", n))
- # Verify `plot_obj()` is consistent
- vdiffr::expect_doppelganger(paste0("cars-points-", n), plot_obj)
- }
-
- expect_n_and_plot(10)
-
- app$set_inputs(n = 20)
- expect_n_and_plot(20)
-})
diff --git a/tests/testthat/apps/stop/app.R b/tests/testthat/apps/stop/app.R
deleted file mode 100644
index 473659a7..00000000
--- a/tests/testthat/apps/stop/app.R
+++ /dev/null
@@ -1,13 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- h1("Click the button and the app dies and returns `42`"),
- actionButton("button", "What is the meaning of life?")
-)
-server <- function(input, output, session) {
- observeEvent(input$button, {
- shiny::stopApp(42)
- })
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/stop/tests/testthat.R b/tests/testthat/apps/stop/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/stop/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/stop/tests/testthat/setup.R b/tests/testthat/apps/stop/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/stop/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/stop/tests/testthat/test-stop.R b/tests/testthat/apps/stop/tests/testthat/test-stop.R
deleted file mode 100644
index c10e20b8..00000000
--- a/tests/testthat/apps/stop/tests/testthat/test-stop.R
+++ /dev/null
@@ -1,17 +0,0 @@
-
-test_that("App returns value from script", {
- app <- AppDriver$new()
- app$click("button")
- app$wait_for_idle() # Wait for the app to stop
-
- meaning_of_life <- app$stop()
- expect_equal(meaning_of_life, 42)
-})
-
-test_that("App returns value from script", {
- app <- AppDriver$new()
- # app$click("button")
-
- normal_return <- app$stop()
- expect_equal(normal_return, NULL)
-})
diff --git a/tests/testthat/apps/text_html/app.R b/tests/testthat/apps/text_html/app.R
deleted file mode 100644
index 02567ab5..00000000
--- a/tests/testthat/apps/text_html/app.R
+++ /dev/null
@@ -1,18 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- textInput("val", "UI Output", "Insert HTML here
"),
- uiOutput("html"),
- verbatimTextOutput("text")
-)
-server <- function(input, output, session) {
- output$html <- renderText({
- shiny::req(input$val)
- shiny::HTML(input$val)
- })
- output$text <- renderText({
- shiny::req(input$val)
- input$val
- })
-}
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/text_html/tests/testthat.R b/tests/testthat/apps/text_html/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/text_html/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/text_html/tests/testthat/setup.R b/tests/testthat/apps/text_html/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/text_html/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/update/tests/testthat.R b/tests/testthat/apps/update/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/update/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/click-001_.png b/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/click-001_.png
deleted file mode 100644
index ecc75370..00000000
Binary files a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/click-001_.png and /dev/null differ
diff --git a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/no-binding-001_.png b/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/no-binding-001_.png
deleted file mode 100644
index 455e4bc3..00000000
Binary files a/tests/testthat/apps/update/tests/testthat/_snaps/shinytest2/no-binding-001_.png and /dev/null differ
diff --git a/tests/testthat/apps/update/tests/testthat/setup.R b/tests/testthat/apps/update/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/update/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/update/tests/testthat/test-shinytest2.R b/tests/testthat/apps/update/tests/testthat/test-shinytest2.R
deleted file mode 100644
index 7b58b99e..00000000
--- a/tests/testthat/apps/update/tests/testthat/test-shinytest2.R
+++ /dev/null
@@ -1,21 +0,0 @@
-library(shinytest2)
-
-test_that("click causes input without binding to update", {
- app <- AppDriver$new(name = "click")
-
- app$click("click")
- app$click("click")
- app$click("click")
- app$click("click")
- app$expect_values()
-})
-
-test_that("Can update the input without biding individually", {
- app <- AppDriver$new(name = "no-binding")
-
- app$set_inputs(counter = 1, allow_no_input_binding_ = TRUE, priority_ = "event")
- app$set_inputs(counter = 2, allow_no_input_binding_ = TRUE, priority_ = "event")
- app$set_inputs(counter = 3, allow_no_input_binding_ = TRUE, priority_ = "event")
- app$set_inputs(counter = 4, allow_no_input_binding_ = TRUE, priority_ = "event")
- app$expect_values()
-})
diff --git a/tests/testthat/apps/upload/tests/testthat.R b/tests/testthat/apps/upload/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/upload/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/upload/tests/testthat/_snaps/app-upload/upload-001_.png b/tests/testthat/apps/upload/tests/testthat/_snaps/app-upload/upload-001_.png
deleted file mode 100644
index 1644c389..00000000
Binary files a/tests/testthat/apps/upload/tests/testthat/_snaps/app-upload/upload-001_.png and /dev/null differ
diff --git a/tests/testthat/apps/upload/tests/testthat/setup.R b/tests/testthat/apps/upload/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/upload/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/upload/tests/testthat/test-app-upload.R b/tests/testthat/apps/upload/tests/testthat/test-app-upload.R
deleted file mode 100644
index b4e26cdf..00000000
--- a/tests/testthat/apps/upload/tests/testthat/test-app-upload.R
+++ /dev/null
@@ -1,13 +0,0 @@
-library(shinytest2)
-
-test_that("Make sure upload can use a local file", {
- app <- AppDriver$new(name = "upload")
-
- app$upload_file(file = "cars.csv")
- app$expect_values()
-
- expect_error(
- app$upload_file(file = "missing_file.csv"),
- "Error finding upload file at path", fixed = TRUE
- )
-})
diff --git a/tests/testthat/apps/wait-setup/R/n.R b/tests/testthat/apps/wait-setup/R/n.R
deleted file mode 100644
index 99386e83..00000000
--- a/tests/testthat/apps/wait-setup/R/n.R
+++ /dev/null
@@ -1,4 +0,0 @@
-# Keep this file.
-# This is a good candidate for knowing that `shinytest2::test_app()` is being called in `tests/testthat.R`
-
-n <- 750
diff --git a/tests/testthat/apps/wait-setup/app.R b/tests/testthat/apps/wait-setup/app.R
deleted file mode 100644
index 4087313f..00000000
--- a/tests/testthat/apps/wait-setup/app.R
+++ /dev/null
@@ -1,73 +0,0 @@
-library(shiny)
-
-ui <- fluidPage(
- h1("Dynamic UI"),
- uiOutput("first")
-)
-server <- function(input, output, session) {
-
- # This app appears in three stages.
- # If the logic was to "wait for idle", it would return after the first stage is init'ed
- # If the logic is to "wait for stable", it would return after sitting idle for a set amount of time. Ex 1500ms
-
-
- timeout <- n # Found in `./R/n.R` # nolint
-
- first_flag <- FALSE
- second_flag <- FALSE
- third_flag <- FALSE
-
- output$first <- renderUI({
- if (!first_flag) {
- first_flag <<- TRUE
- shiny::invalidateLater(timeout)
- return(
- h3("(waiting on first)")
- )
- }
-
- list(
- h3("first"),
- sliderInput("slider1", "Slider1", 0, 10, 1),
- uiOutput("second")
- )
- })
- output$second <- renderUI({
- if (!second_flag) {
- second_flag <<- TRUE
- shiny::invalidateLater(timeout)
- return(
- h3("(waiting on second)")
- )
- }
-
- list(
- h3("second"),
- sliderInput("slider2", "Slider2", 0, 10, 2),
- uiOutput("third")
- )
- })
- output$third <- renderUI({
- if (!third_flag) {
- third_flag <<- TRUE
- shiny::invalidateLater(timeout)
- return(
- h3("(waiting on third)")
- )
- }
-
- list(
- h3("third"),
- sliderInput("slider3", "Slider3", 0, 10, 3),
- uiOutput("verbatim_txt")
- )
- })
- output$verbatim_txt <- renderUI({
- shiny::verbatimTextOutput("txt")
- })
- output$txt <- renderText({
- paste(input$slider1, input$slider2, input$slider3, sep = " ")
- })
-}
-
-shinyApp(ui, server)
diff --git a/tests/testthat/apps/wait-setup/tests/testthat.R b/tests/testthat/apps/wait-setup/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/wait-setup/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/wait-setup/tests/testthat/setup.R b/tests/testthat/apps/wait-setup/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/wait-setup/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/wait-setup/tests/testthat/test-wait-for-idle.R b/tests/testthat/apps/wait-setup/tests/testthat/test-wait-for-idle.R
deleted file mode 100644
index 8bd94407..00000000
--- a/tests/testthat/apps/wait-setup/tests/testthat/test-wait-for-idle.R
+++ /dev/null
@@ -1,11 +0,0 @@
-
-# Testing that `./setup.R` is loaded
-
-test_that("wait for idle works", {
-
- app <- AppDriver$new()
-
- app$wait_for_idle(duration = 2 * n)
-
- expect_equal(app$get_value(output = "txt"), "1 2 3")
-})
diff --git a/tests/testthat/apps/wait/tests/testthat.R b/tests/testthat/apps/wait/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/wait/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/wait/tests/testthat/setup-shinytest2.R b/tests/testthat/apps/wait/tests/testthat/setup-shinytest2.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/wait/tests/testthat/setup-shinytest2.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/widgits/app.R b/tests/testthat/apps/widgets/app.R
similarity index 100%
rename from tests/testthat/apps/widgits/app.R
rename to tests/testthat/apps/widgets/app.R
diff --git a/tests/testthat/apps/widgits/tests/testthat.R b/tests/testthat/apps/widgits/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/widgits/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png
deleted file mode 100644
index 8bf7f29d..00000000
Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png and /dev/null differ
diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png
deleted file mode 100644
index 11b01fb4..00000000
Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png and /dev/null differ
diff --git a/tests/testthat/apps/widgits/tests/testthat/setup.R b/tests/testthat/apps/widgits/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/widgits/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/window/app.R b/tests/testthat/apps/window/app.R
deleted file mode 100644
index 37c2b8ac..00000000
--- a/tests/testthat/apps/window/app.R
+++ /dev/null
@@ -1,3 +0,0 @@
-
-# Empty app to test window sizes
-shinyApp("", function(input, output) {}) # nolint: brace_linter
diff --git a/tests/testthat/apps/window/tests/testthat.R b/tests/testthat/apps/window/tests/testthat.R
deleted file mode 100644
index 7d25b5b9..00000000
--- a/tests/testthat/apps/window/tests/testthat.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::test_app()
diff --git a/tests/testthat/apps/window/tests/testthat/setup.R b/tests/testthat/apps/window/tests/testthat/setup.R
deleted file mode 100644
index 80d55d27..00000000
--- a/tests/testthat/apps/window/tests/testthat/setup.R
+++ /dev/null
@@ -1 +0,0 @@
-shinytest2::load_app_env()
diff --git a/tests/testthat/apps/bookmark/tests/testthat/test-bookmark.R b/tests/testthat/test-app-bookmark.R
similarity index 54%
rename from tests/testthat/apps/bookmark/tests/testthat/test-bookmark.R
rename to tests/testthat/test-app-bookmark.R
index 68c3dec6..cb0e5ee1 100644
--- a/tests/testthat/apps/bookmark/tests/testthat/test-bookmark.R
+++ b/tests/testthat/test-app-bookmark.R
@@ -1,13 +1,33 @@
-library(shinytest2)
+library(shiny)
+
+ui <- function(request) {
+ fluidPage(
+ textInput("txt", "Enter text"),
+ checkboxInput("caps", "Capitalize"),
+ verbatimTextOutput("out"),
+ bookmarkButton()
+ )
+}
+server <- function(input, output, session) {
+ output$out <- renderText({
+ if (input$caps) {
+ toupper(input$txt)
+ } else {
+ input$txt
+ }
+ })
+}
+
+shiny_app <- shinyApp(ui, server, enableBookmarking = "url")
test_that("Bookmark works", {
# Start local app in the background in test mode
- bg_app <- shinytest2::AppDriver$new()
+ bg_app <- AppDriver$new(shiny_app)
# Capture the background app's URL and add appropriate query parameters
bookmark_url <- paste0(bg_app$get_url(), "?_inputs_&txt=%22abcd%22&caps=true")
# Open the bookmark URL in a new AppDriver object
- app <- shinytest2::AppDriver$new(bookmark_url)
+ app <- AppDriver$new(bookmark_url)
# Run your tests on the bookmarked `app`
app$expect_values()
diff --git a/tests/testthat/test-app-download.R b/tests/testthat/test-app-download.R
new file mode 100644
index 00000000..b421cf5e
--- /dev/null
+++ b/tests/testthat/test-app-download.R
@@ -0,0 +1,116 @@
+library(shiny)
+
+bear_img <- fs::path_abs(test_path("app-files/bear.png"))
+
+ui <- fluidPage(
+ downloadButton("download_button_txt", "Download Button - Text"),
+ downloadButton("download_link_txt", "Download Link - Text"),
+ downloadButton("download_button_csv", "Download Button - CSV"),
+ downloadButton("download_link_csv", "Download Link - CSV"),
+ downloadButton("download_button_binary", "Download Button - Binary"),
+ downloadButton("download_link_binary", "Download Link - Binary"),
+)
+
+server <- function(input, output) {
+
+ output$download_button_txt <- downloadHandler(
+ filename = function() {
+ "download-button.txt"
+ },
+ content = function(file) {
+ cat("Download content!\n", file = file)
+ }
+ )
+ output$download_link_txt <- downloadHandler(
+ filename = function() {
+ "download-link.txt"
+ },
+ content = function(file) {
+ cat("Download content!\n", file = file)
+ }
+ )
+
+ output$download_button_csv <- downloadHandler(
+ filename = function() {
+ "download-button.csv"
+ },
+ content = function(file) {
+ write.csv(head(cars, 10), file)
+ }
+ )
+ output$download_link_csv <- downloadHandler(
+ filename = function() {
+ "download-link.csv"
+ },
+ content = function(file) {
+ write.csv(tail(cars, 10), file)
+ }
+ )
+
+ output$download_button_binary <- downloadHandler(
+ filename = function() {
+ "bear.png"
+ },
+ content = function(file) {
+ file.copy(bear_img, file)
+ }
+ )
+ output$download_link_binary <- downloadHandler(
+ filename = function() {
+ "bear.png"
+ },
+ content = function(file) {
+ file.copy(bear_img, file)
+ }
+ )
+}
+
+shiny_app <- shinyApp(ui, server)
+
+
+
+test_that("download files work from link and button", {
+ app <- AppDriver$new(shiny_app, variant = NULL)
+
+ app$wait_for_js("$('#download_link_csv').attr('href') != ''")
+ app$wait_for_js("$('#download_button_csv').attr('href') != ''")
+ app$wait_for_js("$('#download_link_txt').attr('href') != ''")
+ app$wait_for_js("$('#download_button_txt').attr('href') != ''")
+ app$wait_for_js("$('#download_link_binary').attr('href') != ''")
+ app$wait_for_js("$('#download_button_binary').attr('href') != ''")
+
+ app$expect_download("download_link_txt")
+ app$expect_download("download_button_txt")
+
+ app$expect_download("download_link_csv")
+ app$expect_download("download_button_csv")
+
+ app$expect_download("download_link_binary")
+ app$expect_download("download_button_binary")
+
+ # Try custom name
+ app$expect_download("download_button_txt", name = "my/custom/name.txt")
+})
+
+
+test_that("download files can be retrieved", {
+ on.exit({
+ if (fs::file_exists("barret.test")) {
+ fs::file_delete("barret.test")
+ }
+ }, add = TRUE)
+
+ app <- AppDriver$new(shiny_app, variant = NULL)
+
+ app$wait_for_js("$('#download_link_csv').attr('href') != ''")
+ app$wait_for_js("$('#download_button_csv').attr('href') != ''")
+
+ link_file <- app$get_download("download_link_csv")
+ button_file <- app$get_download("download_button_csv", "barret.test")
+
+ expect_equal(fs::path_file(link_file), "download-link.csv")
+ expect_equal(fs::path_file(button_file), "barret.test")
+
+ expect_gt(file.info(link_file)$size, 0)
+ expect_gt(file.info(button_file)$size, 0)
+})
diff --git a/tests/testthat/test-app-export.R b/tests/testthat/test-app-export.R
new file mode 100644
index 00000000..1f173ef0
--- /dev/null
+++ b/tests/testthat/test-app-export.R
@@ -0,0 +1,142 @@
+library(shiny)
+library(ggplot2)
+
+ui <- fluidPage(
+ numericInput("n", "Number of rows", 10, 1, nrow(cars)),
+ plotOutput("plot")
+)
+server <- function(input, output) {
+ dt <- reactive({
+ head(cars, input$n)
+ })
+ plot_obj <- reactive({
+ ggplot2::ggplot(dt(), ggplot2::aes_string("speed", "dist")) + ggplot2::geom_point()
+ })
+
+ output$plot <- renderPlot({
+ plot_obj()
+ })
+
+ exportTestValues(
+ dt = dt(),
+ plot_obj = plot_obj()
+ )
+}
+
+shiny_app <- shinyApp(ui = ui, server = server)
+
+
+
+test_that("`export`ed `plot_obj` is updated by `n`", {
+
+ skip_if_not_installed("vdiffr")
+
+ app <- AppDriver$new(shiny_app)
+
+ expect_n_and_plot <- function(n) {
+ # Verify `n` input equals `n`
+ n_val <- app$get_value(input = "n")
+ testthat::expect_equal(n_val, n, expected.label = n)
+ # Verify `dt()` data is first `n` lines of `cars`
+ dt <- app$get_value(export = "dt")
+ testthat::expect_equal(dt, head(cars, n), expected.label = paste0("head(cars, ", n, ")"))
+
+ # Verify `plot_obj()` data is `dt()`
+ plot_obj <- app$get_value(export = "plot_obj")
+ testthat::expect_equal(plot_obj$data, dt, info = paste0("n = ", n))
+ # Verify `plot_obj()` is consistent
+ vdiffr::expect_doppelganger(paste0("cars-points-", n), plot_obj)
+ }
+
+ expect_n_and_plot(10)
+
+ app$set_inputs(n = 20)
+ expect_n_and_plot(20)
+})
+
+
+test_that("`export`ed `plot_obj` is updated by `n`", {
+ skip_if_not_installed("vdiffr")
+
+ app <- AppDriver$new(shiny_app)
+
+ # Verify `dt()` uses first 10 lines of `cars`
+ n10 <- app$get_value(input = "n")
+ expect_equal(n10, 10)
+ # Verify `dt10()` data is first 10 lines of `cars`
+ dt10 <- app$get_value(export = "dt")
+ expect_equal(dt10, head(cars, n10))
+
+ # Verify `plot_obj()` data is `dt()`
+ plot_obj_10 <- app$get_value(export = "plot_obj")
+ expect_equal(plot_obj_10$data, dt10)
+ # Verify `plot_obj()` is consistent
+ vdiffr::expect_doppelganger("cars-points-10", plot_obj_10)
+
+ ## Update `n` to 20
+ app$set_inputs(n = 20)
+
+ # Verify `n` was updated
+ n20 <- app$get_value(input = "n")
+ expect_equal(n20, 20)
+ # Verify `dt()` uses first 20 lines of `cars`
+ dt20 <- app$get_value(export = "dt")
+ expect_equal(dt20, head(cars, n20))
+
+ # Verify `plot_obj()` data is `dt()`
+ plot_obj_20 <- app$get_value(export = "plot_obj")
+ expect_equal(plot_obj_20$data, dt20)
+ vdiffr::expect_doppelganger("cars-points-20", plot_obj_20)
+})
+
+
+test_that("Exported values", {
+ shiny_app <-
+ shinyApp(
+ ui = basicPage(
+ h4("Snapshot URL: "),
+ uiOutput("url"),
+ h4("Current values:"),
+ verbatimTextOutput("values"),
+ actionButton("inc", "Increment x")
+ ),
+
+ server = function(input, output, session) {
+ vals <- reactiveValues(x = 1)
+ y <- reactive({
+ vals$x + 1
+ })
+
+ observeEvent(input$inc, {
+ vals$x <<- vals$x + 1
+ })
+
+ exportTestValues(
+ x = vals$x,
+ y = y()
+ )
+
+ output$url <- renderUI({
+ url <- session$getTestSnapshotUrl(format = "json")
+ a(href = url, url)
+ })
+
+ output$values <- renderText({
+ paste0("vals$x: ", vals$x, "\ny: ", y())
+ })
+ }
+ )
+
+ app <- AppDriver$new(shiny_app)
+
+ x <- app$get_values()
+ expect_identical(x$export$x, 1)
+ expect_identical(x$export$y, 2)
+
+ app$set_inputs(inc = "click")
+ app$set_inputs(inc = "click")
+
+ x <- app$get_values()
+ expect_identical(x$export$x, 3)
+ expect_identical(x$export$y, 4)
+})
diff --git a/tests/testthat/test-app-files.R b/tests/testthat/test-app-files.R
new file mode 100644
index 00000000..f6a93f57
--- /dev/null
+++ b/tests/testthat/test-app-files.R
@@ -0,0 +1,28 @@
+test_that("{shinytest2} recording: kgs", {
+ app <- AppDriver$new(
+ test_path("apps/files-server-ui"),
+ name = "kgs",
+ height = 1321,
+ width = 1221
+ )
+ app$set_inputs(kg = 100)
+ app$expect_values()
+})
+
+
+test_that("server.R and app.R are not compatible", {
+ expect_error(
+ AppDriver$new(test_path("apps/files-app-server"))$stop(),
+ "Unintented behavior may occur",
+ fixed = TRUE
+ )
+})
+
+
+test_that("rmarkdown and app.R are not compatible", {
+ expect_error(
+ AppDriver$new(test_path("apps/files-app-rmd")),
+ "`app_dir` must be a directory containing",
+ fixed = TRUE
+ )
+})
diff --git a/tests/testthat/apps/hello/tests/testthat/test-app-click.R b/tests/testthat/test-app-hello-click.R
similarity index 94%
rename from tests/testthat/apps/hello/tests/testthat/test-app-click.R
rename to tests/testthat/test-app-hello-click.R
index 2a4a7e83..01ca6263 100644
--- a/tests/testthat/apps/hello/tests/testthat/test-app-click.R
+++ b/tests/testthat/test-app-hello-click.R
@@ -1,5 +1,5 @@
test_that("basic website example works", {
- app <- AppDriver$new(variant = NULL)
+ app <- AppDriver$new(test_path("apps/hello"), variant = NULL)
app$set_inputs(name = "Hadley")
app$set_inputs(greet = "click")
diff --git a/tests/testthat/apps/hello/tests/testthat/test-execute-js.R b/tests/testthat/test-app-hello-execute-js.R
similarity index 61%
rename from tests/testthat/apps/hello/tests/testthat/test-execute-js.R
rename to tests/testthat/test-app-hello-execute-js.R
index 3463cd5c..3748b0f0 100644
--- a/tests/testthat/apps/hello/tests/testthat/test-execute-js.R
+++ b/tests/testthat/test-app-hello-execute-js.R
@@ -1,5 +1,5 @@
test_that("JS can take a file or script", {
- app <- AppDriver$new()
+ app <- AppDriver$new(test_path("apps/hello"))
app$set_inputs(name = "Hadley")
app$run_js("window.testVal = 'testLocal';")
@@ -8,20 +8,20 @@ test_that("JS can take a file or script", {
"testLocal"
)
- app$run_js(file = test_path("js/execute-js.js"))
+ app$run_js(file = test_path("apps/hello/js/execute-js.js"))
expect_equal(
app$get_js("window.testVal;"),
"testFile"
)
expect_equal(
- app$get_js(file = test_path("js/expect-js.js")),
+ app$get_js(file = test_path("apps/hello/js/expect-js.js")),
"testExpectJs"
)
- app$expect_js(file = test_path("js/expect-js.js"))
+ app$expect_js(file = test_path("apps/hello/js/expect-js.js"))
expect_warning(
- app$get_js("1 + 1", file = test_path("js/one-plus-one.js")),
+ app$get_js("1 + 1", file = test_path("apps/hello/js/one-plus-one.js")),
"Both `file` and `script` are specified", fixed = TRUE
)
diff --git a/tests/testthat/apps/hello/tests/testthat/test-app-init-args.R b/tests/testthat/test-app-hello-init-args.R
similarity index 91%
rename from tests/testthat/apps/hello/tests/testthat/test-app-init-args.R
rename to tests/testthat/test-app-hello-init-args.R
index 506e0936..a6bb0e51 100644
--- a/tests/testthat/apps/hello/tests/testthat/test-app-init-args.R
+++ b/tests/testthat/test-app-hello-init-args.R
@@ -1,6 +1,6 @@
test_that("name arg works", {
app <- AppDriver$new(
- test_path("../../."),
+ test_path("apps/hello"),
name = "test",
variant = NULL
)
diff --git a/tests/testthat/apps/hello/tests/testthat/test-app-variant.R b/tests/testthat/test-app-hello-variant.R
similarity index 90%
rename from tests/testthat/apps/hello/tests/testthat/test-app-variant.R
rename to tests/testthat/test-app-hello-variant.R
index adbf8783..fd356cb6 100644
--- a/tests/testthat/apps/hello/tests/testthat/test-app-variant.R
+++ b/tests/testthat/test-app-hello-variant.R
@@ -1,6 +1,6 @@
# shinytest2 code using `app$**()`:
test_that("screenshots need a variant", {
- app <- AppDriver$new()
+ app <- AppDriver$new(test_path("apps/hello"))
app$set_inputs(name = "Hadley")
app$set_inputs(greet = "click")
diff --git a/tests/testthat/apps/hello/tests/testthat/test-app.R b/tests/testthat/test-app-hello.R
similarity index 89%
rename from tests/testthat/apps/hello/tests/testthat/test-app.R
rename to tests/testthat/test-app-hello.R
index 2d22fbad..d48bfd86 100644
--- a/tests/testthat/apps/hello/tests/testthat/test-app.R
+++ b/tests/testthat/test-app-hello.R
@@ -11,7 +11,7 @@
# shinytest2 code using `app$**()`:
test_that("basic website example works using shinytest", {
- app <- AppDriver$new(variant = platform_variant())
+ app <- AppDriver$new(test_path("apps/hello"), variant = platform_variant())
app$set_inputs(name = "Hadley")
app$set_inputs(greet = "click")
@@ -30,7 +30,7 @@ test_that("basic website example works using shinytest", {
# shinytest2 code using `app$**()`:
test_that("basic website example works using testthat", {
- app <- AppDriver$new(variant = platform_variant(), name = "manual")
+ app <- AppDriver$new(test_path("apps/hello"), variant = platform_variant(), name = "manual")
app$set_inputs(name = "Hadley")
app$set_inputs(greet = "click")
diff --git a/tests/testthat/apps/text_html/tests/testthat/test-expect-snapshot-js.R b/tests/testthat/test-app-html-text.R
similarity index 62%
rename from tests/testthat/apps/text_html/tests/testthat/test-expect-snapshot-js.R
rename to tests/testthat/test-app-html-text.R
index f0e77dd5..64ec9e35 100644
--- a/tests/testthat/apps/text_html/tests/testthat/test-expect-snapshot-js.R
+++ b/tests/testthat/test-app-html-text.R
@@ -1,5 +1,25 @@
+library(shiny)
+
+ui <- fluidPage(
+ textInput("val", "UI Output", "Insert HTML here
"),
+ uiOutput("html"),
+ verbatimTextOutput("text")
+)
+server <- function(input, output, session) {
+ output$html <- renderText({
+ shiny::req(input$val)
+ shiny::HTML(input$val)
+ })
+ output$text <- renderText({
+ shiny::req(input$val)
+ input$val
+ })
+}
+shiny_app <- shinyApp(ui, server)
+
+
test_that("basic text and dom outputs are expected", {
- app <- AppDriver$new(variant = NULL)
+ app <- AppDriver$new(shiny_app, variant = NULL)
app$set_inputs(val = "
My Custom Output
My Custom Output