-
Notifications
You must be signed in to change notification settings - Fork 341
Description
The newest release of testthat (3.3.0) leads to issues when trying to record tests for a Shiny-App with shinytest2. When trying to test an internal App for an R-Package, I receive the Error:
Error in
invokeRestart("continue_test"): no 'restart' 'continue_test' found
I was able to reproduce the error on multiple machines and with multiple versions of R and shinytest2, yet the issue occurs only with the latest version of testthat (3.3.0) and everything works fine with testthat 3.2.3. I therefore believe this is an issue with testthat 3.3.0 rather than shinytest2. If this is not the case and the updated behaviour is intended, please let me know.
Below, you find a minimal working example, the full Error message including backtrace, and some key session information.
Minimal working example:
library(testthat)
library(shiny)
library(shinytest2)
minimal_app <- function() {
shinyApp(
ui = fluidPage(
actionButton("next_btn", "Next"),
textOutput("txt")
),
server = function(input, output, session) {
counter <- reactiveVal(1)
observeEvent(input$next_btn, {
counter(counter() + 1)
})
output$txt <- renderText(counter())
}
)}
test_that("shinytest2 snapshot triggers invokeRestart error", {
app <- AppDriver$new(
app = minimal_app(),
name = "minimal_snapshot",
variant = platform_variant()
)
app$click("next_btn")
app$wait_for_idle()
app$expect_values()
})
Once I run testthat::test_file(), I receive the following Error:
Error message:
── Error (test_shiny_minimal.R:33:3): shinytest2 snapshot triggers invokeRestart error ──────────────────────────────────────────────────
Error ininvokeRestart("continue_test"): no 'restart' 'continue_test' found
Backtrace:
▆
- ├─app$expect_values() at test_shiny_minimal.R:33:3
- │ └─shinytest2:::app_expect_values(...)
- │ ├─base::withCallingHandlers(...)
- │ └─shinytest2:::app_expect_screenshot(...)
- │ └─shinytest2:::app__expect_snapshot_file(...)
- │ ├─base::withCallingHandlers(...)
- │ └─testthat::expect_snapshot_file(...)
- │ └─testthat::pass()
- │ └─testthat::expectation("success", "success")
- │ └─testthat::exp_signal(exp)
- │ ├─base::withRestarts(...)
- │ │ └─base (local) withOneRestart(expr, restarts[[1L]])
- │ │ └─base (local) doWithOneRestart(return(expr), restart)
- │ └─base::signalCondition(exp)
- └─shinytest2 (local)
<fn>(<expcttn_>)- └─base::invokeRestart("continue_test")
[ FAIL 1 | WARN 1 | SKIP 0 | PASS 0 ]
Session info:
R version 4.5.2 (2025-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)
attached packages: shiny_1.11.1, shinytest2_0.4.1, testthat_3.3.0