-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanly handle HTTP error messages, add stop_on_error
and exclude
arguments to app$snapshot
#324
base: main
Are you sure you want to change the base?
Conversation
…rom being included in the stored results.
- snapshot() now returns processed snapshot content, rather than the raw snapshot input.
…`stop_on_error` (defaulting to TRUE) to control whether an error is captured and recorded *in* the snapshot, or is raised to stop execution.
…l cause execution to be aborted and a clean error message displayed. When FALSE, the error message is captured as part of the snapshot, no error is displayed, and execution continues.
|
exclude
and stop_on_error
arguments to app$snapshot
exclude
and stop_on_error
arguments to app$snapshot stop_on_error
and exclude
arguments to app$snapshot
Do you think you could decompose this into two separate PRs? (One handling HTTP failures and the other for excluding values from the snapshot). That would make them easier to review. |
} | ||
|
||
|
||
# Remove any items specified in ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing the exclude
arguments only involves this code block and adding the omit
argument to the sd_snapshot
and app$snapshot
function definitions and handoff.
Hi Hadley, I can decompose if you wish, but the changes for handling
|
I think it's still useful because that makes the http error handling code easier for me to review (and there's a few style issues that'll need to be resolved along the way). |
Actually, there are three places where shinytest currently uses |
Includes some improvements to `$snapshotDownload()` docs which I required to understand what was going wrong. Fixes rstudio#191. Fixes rstudio#192.
Merge branch 'master' of https://github.com/rstudio/shinytest # Conflicts: # DESCRIPTION # R/snapshot.R # tests/testthat/recorded_tests/rmd-prerendered/tests/mytest-expected/001.json # tests/testthat/recorded_tests/rmd-prerendered/tests/mytest-expected/002.json
The shiny app can return at least 404 and 500, and perhaps other codes, in fact I used PR #348 to track down and fix a 500 error that only occurred when running a shinytest script. |
Aside: I think the check failures on Windows are due to |
I have a troublesome object that changes in unimportant ways from run to run, and don't want to explicitly name all of the other objects that should be included in a snapshot.
This PR provides an 'exclude' argument to app$snapshot that allows specification of object names to be excluded from the snapshot.
It also modifies app$snapshot() to return the processed JSON text, rather than the raw text received from the headless browser.
I have created a 'recorded' test that exercises the new code, and have updated the 'in-depth' vignette.
All of the tests (including the one for new code) succeed, except for one existing 'recorded' test which yields:
I suspect this is due to a subtle difference in the configurations of my system and the test system.