Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed May 23, 2024
1 parent fc364c1 commit 65c5dae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion inst/examples/login/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ app <- shinyApp(
server = function(input, output, session) {
loginData <- f7LoginServer(id = "login")

exportTestValues(res = loginData)
exportTestValues(
status = loginData$status(),
user = loginData$user(),
password = loginData$password()
)

output$user <- renderText({
req(loginData$user)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/f7Login/login-app-001.new.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"export": {
"password": "",
"status": true,
"user": ""
}
}
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/f7Login/login-app-002.new.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"export": {
"password": "pwd",
"status": false,
"user": "usr"
}
}
4 changes: 2 additions & 2 deletions tests/testthat/test-f7Login.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ test_that("login works", {
name = "login-app"
)

app$expect_values(input = "login", export = "res")
app$expect_values(input = "login", export = TRUE)

app$set_inputs("login-user" = "usr", "login-password" = "pwd")
app$wait_for_idle(2000)
# Wait for any animation to complete
app$click(selector = "#login-submit")
app$wait_for_idle(2000)
app$expect_values(input = "login", export = "res")
app$expect_values(input = "login", export = TRUE)
})

0 comments on commit 65c5dae

Please sign in to comment.