Skip to content

Commit

Permalink
added setup-shinytest2.R to solve test issues and modified run_tests_…
Browse files Browse the repository at this point in the history
…locally() so it works again
  • Loading branch information
jen-machin committed Feb 5, 2024
1 parent f2075c9 commit 055e994
Show file tree
Hide file tree
Showing 17 changed files with 10 additions and 15 deletions.
21 changes: 6 additions & 15 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ cat("Sourcing .Rprofile.", fill = TRUE)

source("renv/activate.R")

# Function to run tests
# Run UI tests ------------------------------------------------------------

run_tests_locally <- function() {
Sys.unsetenv("http_proxy")
Sys.unsetenv("https_proxy")
source("global.r")
# message("================================================================================")
# message("== testthat ====================================================================")
# message("")
# testthat::test_dir("tests/testthat")
# message("")
message("================================================================================")
message("== shinytest ===================================================================")
message("")
shinytest::testApp()
message("")
message("================================================================================")
library(shinytest2)
Sys.unsetenv("HTTP_PROXY")
test_app()
}


# Install commit-hooks locally
statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE)
2 changes: 2 additions & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ library(sf)
library(checkmate)
library(dfeshiny)
library(shinytest2)
library(librarian)

# Functions ---------------------------------------------------------------------------------

# Here's an example function for simplifying the code needed to commas separate numbers:
Expand Down
Binary file added tests/testthat/_snaps/UI_tests/001_.new.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 added tests/testthat/_snaps/UI_tests/002_.new.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 added tests/testthat/_snaps/UI_tests/003_.new.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 added tests/testthat/_snaps/UI_tests/004_.new.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 added tests/testthat/_snaps/UI_tests/005_.new.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 added tests/testthat/_snaps/UI_tests/006_.new.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 added tests/testthat/_snaps/UI_tests/007_.new.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 added tests/testthat/_snaps/UI_tests/008_.new.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 added tests/testthat/_snaps/UI_tests/009_.new.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 added tests/testthat/_snaps/UI_tests/010_.new.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 added tests/testthat/_snaps/UI_tests/011_.new.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 added tests/testthat/_snaps/UI_tests/012_.new.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 added tests/testthat/_snaps/UI_tests/013_.new.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 added tests/testthat/_snaps/UI_tests/014_.new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions tests/testthat/setup-shinytest2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Load application support files into testing environment
shinytest2::load_app_env()

0 comments on commit 055e994

Please sign in to comment.