Skip to content

Commit

Permalink
Better webfakes skipping (#385)
Browse files Browse the repository at this point in the history
And move to better home for helpers

Closes #346
  • Loading branch information
hadley authored Jan 23, 2024
1 parent b3b6916 commit 74ad186
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions R/testthat.R → tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
local_test_app <- function(envir = parent.frame()) {
skip_if_not_installed("webfakes")

webfakes::local_app_process(app_request(), .local_envir = envir)
}

app_request <- function() {
req_json <- function(req, res) {
out <- list(
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-form.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ test_that("handles no buttons", {
})

test_that("can submit using three primary techniques", {
skip_if_not_installed("webfakes")
app <- webfakes::local_app_process(app_request())
app <- local_test_app()

html <- minimal_html('
<form action="/">
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-session.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test_that("can find link by position, content, css, or xpath", {
})

test_that("can submit a form", {
app <- webfakes::local_app_process(app_request())
app <- local_test_app()

html <- minimal_html('
<form action="/">
Expand Down

0 comments on commit 74ad186

Please sign in to comment.