Skip to content

Commit

Permalink
Merge pull request #844 from pharmaR/jt-repair_and_improve_shinytest2…
Browse files Browse the repository at this point in the history
…_tests

Use `setup_shinytest2.R`
  • Loading branch information
jthompson-arcus authored Feb 14, 2025
2 parents 189f10d + d61de0b commit c03f7d8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: riskassessment
Title: A web app designed to interface with the `riskmetric` package
Version: 3.1.2.9000
Version: 3.1.2.9001
Authors@R: c(
person("Aaron", "Clark", role = c("aut", "cre"), email = "clark.aaronchris@gmail.com"),
person("Jeff", "Thompson", role = c("aut"), email = "jeff.thompson51317@gmail.com", comment = "Co-Lead"),
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# riskassessment (development version)

### For Devs
* Moved `shinytest2` setup options to `setup_shinytest2.R` for more seamless integration in test development.

# riskassessment 3.1.2

Mostly minor changes here!
Expand Down
36 changes: 18 additions & 18 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@
"Maintainer": "Gábor Csárdi <csardi.gabor@gmail.com>",
"Repository": "RSPM",
"Date/Publication": "2023-12-10 10:50:07 UTC",
"Built": "R 4.3.3; x86_64-pc-linux-gnu; 2025-01-16 19:54:53 UTC; unix"
"Built": "R 4.3.3; x86_64-pc-linux-gnu; 2025-02-14 15:15:42 UTC; unix"
}
},
"broom": {
Expand Down Expand Up @@ -947,7 +947,7 @@
"RoxygenNote": "7.3.0",
"Author": "Sebastien Rochette [aut, cre] (<https://orcid.org/0000-0002-1565-9313>),\n Vincent Guyader [aut] (<https://orcid.org/0000-0003-0671-9270>),\n Arthur Bréant [aut] (<https://orcid.org/0000-0003-1668-0963>),\n Murielle Delmotte [aut] (<https://orcid.org/0000-0002-1339-2424>),\n ThinkR [cph]",
"Maintainer": "Sebastien Rochette <sebastien@thinkr.fr>",
"Built": "R 4.3.3; ; 2025-01-16 19:55:43 UTC; unix",
"Built": "R 4.3.3; ; 2025-02-14 15:16:32 UTC; unix",
"RemoteType": "github",
"RemoteUsername": "thinkr-open",
"RemoteRepo": "checkhelper",
Expand Down Expand Up @@ -1310,7 +1310,7 @@
"Imports": "callr,\ncranlike (>= 1.0.2),\ncurl,\ndesc (>= 1.1.0),\ndigest,\nparsedate,\nrappdirs,\nrematch2,\ntools,\nutils,\nwithr",
"Suggests": "covr,\npingr,\ntestthat,\nzip",
"Encoding": "UTF-8",
"Built": "R 4.3.3; ; 2025-01-16 19:55:53 UTC; unix",
"Built": "R 4.3.3; ; 2025-02-14 15:16:43 UTC; unix",
"RemoteType": "github",
"RemoteHost": "api.github.com",
"RemoteUsername": "r-lib",
Expand Down Expand Up @@ -1346,7 +1346,7 @@
"Packaged": "2018-11-26 09:54:46 UTC; gaborcsardi",
"Repository": "RSPM",
"Date/Publication": "2018-11-26 10:10:03 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:55:50 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:16:40 UTC; unix"
}
},
"cranlogs": {
Expand Down Expand Up @@ -1482,7 +1482,7 @@
"Maintainer": "Scott Chamberlain <myrmecocystus@gmail.com>",
"Repository": "RSPM",
"Date/Publication": "2023-05-17 07:30:02 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:55:58 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:16:48 UTC; unix"
}
},
"curl": {
Expand Down Expand Up @@ -1596,7 +1596,7 @@
"Packaged": "2017-10-22 09:14:23 UTC; gaborcsardi",
"Repository": "RSPM",
"Date/Publication": "2017-10-22 14:18:09 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:55:49 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:16:39 UTC; unix"
}
},
"desc": {
Expand Down Expand Up @@ -2330,7 +2330,7 @@
"Maintainer": "Thomas Lin Pedersen <thomas.pedersen@posit.co>",
"Repository": "RSPM",
"Date/Publication": "2024-02-23 09:30:02 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:54:36 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:15:25 UTC; unix"
}
},
"gh": {
Expand Down Expand Up @@ -2593,7 +2593,7 @@
"Maintainer": "Thomas Lin Pedersen <thomas.pedersen@posit.co>",
"Repository": "RSPM",
"Date/Publication": "2023-08-21 11:20:02 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:54:30 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:15:19 UTC; unix"
}
},
"haven": {
Expand Down Expand Up @@ -3790,7 +3790,7 @@
"Maintainer": "Hadley Wickham <hadley@rstudio.com>",
"Repository": "RSPM",
"Date/Publication": "2022-12-14 11:40:06 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:55:04 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:15:53 UTC; unix"
}
},
"pkgload": {
Expand Down Expand Up @@ -4374,7 +4374,7 @@
"Maintainer": "Kevin Ushey <kevin@rstudio.com>",
"Repository": "RSPM",
"Date/Publication": "2024-02-29 01:10:07 UTC",
"Built": "R 4.3.3; ; 2025-01-27 04:47:42 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:12:00 UTC; unix"
}
},
"reprex": {
Expand Down Expand Up @@ -4432,7 +4432,7 @@
"RoxygenNote": "7.2.3",
"Author": "Gábor Csárdi [cre, aut, cph],\n Hadley Wickham [aut],\n RConsortium [cph],\n RStudio [cph, fnd]",
"Maintainer": "Gábor Csárdi <csardi.gabor@gmail.com>",
"Built": "R 4.3.3; ; 2025-01-16 19:56:28 UTC; unix",
"Built": "R 4.3.3; ; 2025-02-14 15:17:18 UTC; unix",
"RemoteType": "github",
"RemoteUsername": "r-lib",
"RemoteRepo": "revdepcheck",
Expand Down Expand Up @@ -4498,7 +4498,7 @@
"Maintainer": "Gábor Csárdi <csardi.gabor@gmail.com>",
"Repository": "RSPM",
"Date/Publication": "2022-08-31 13:00:11 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:56:33 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:17:22 UTC; unix"
}
},
"rintrojs": {
Expand Down Expand Up @@ -4550,7 +4550,7 @@
"Config/testthat/edition": "3",
"Author": "R Validation Hub [aut],\n Doug Kelkhoff [aut],\n Marly Gotti [aut],\n Eli Miller [cre, aut],\n Kevin K [aut],\n Yilong Zhang [aut],\n Eric Milliman [aut],\n Juliane Manitz [aut],\n Mark Padgham [ctb],\n PSI special interest group Application and Implementation of\n Methodologies in Statistics [cph]",
"Maintainer": "Eli Miller <eli.miller@atorusresearch.com>",
"Built": "R 4.3.3; ; 2025-01-23 17:14:14 UTC; unix",
"Built": "R 4.3.3; ; 2025-02-14 15:17:26 UTC; unix",
"RemoteType": "github",
"RemoteHost": "api.github.com",
"RemoteRepo": "riskmetric",
Expand Down Expand Up @@ -5038,7 +5038,7 @@
"Maintainer": "Victor Perrier <victor.perrier@dreamrs.fr>",
"Repository": "RSPM",
"Date/Publication": "2024-04-04 17:40:02 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:57:06 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:17:56 UTC; unix"
}
},
"shinyjs": {
Expand Down Expand Up @@ -5379,7 +5379,7 @@
"Maintainer": "Hadley Wickham <hadley@posit.co>",
"Repository": "RSPM",
"Date/Publication": "2023-12-02 11:50:05 UTC",
"Built": "R 4.3.3; x86_64-pc-linux-gnu; 2025-01-16 19:55:14 UTC; unix"
"Built": "R 4.3.3; x86_64-pc-linux-gnu; 2025-02-14 15:16:03 UTC; unix"
}
},
"textshaping": {
Expand Down Expand Up @@ -6088,7 +6088,7 @@
"Maintainer": "Gábor Csárdi <csardi.gabor@gmail.com>",
"Repository": "RSPM",
"Date/Publication": "2018-09-17 13:10:03 UTC",
"Built": "R 4.3.3; ; 2025-01-16 19:55:09 UTC; unix"
"Built": "R 4.3.3; ; 2025-02-14 15:15:58 UTC; unix"
}
},
"xtable": {
Expand Down Expand Up @@ -6227,7 +6227,7 @@
"checksum": "99c5575cb81828e20a7fe1d205551316"
},
"DESCRIPTION": {
"checksum": "2cc9cb76a0952395d0c5699eca46b372"
"checksum": "26cf9ed341c0db986309fc43d9289b80"
},
"inst/app/www/css/community_metrics.css": {
"checksum": "f08eb25c2ee48ac22ed63b0d18994a04"
Expand Down Expand Up @@ -6470,7 +6470,7 @@
"checksum": "97d1232340e04c53088bc8f814133dcd"
},
"NEWS.md": {
"checksum": "b6195b38a38523dac7db505937d94f49"
"checksum": "68d14866f1ea2f5d007b2e5fe1b3bd21"
},
"R/app_config.R": {
"checksum": "c2b61f270b86b6833f0ee39c44a1a440"
Expand Down
15 changes: 0 additions & 15 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,5 @@ library(shiny)
library(riskassessment)
# Load application support files into testing environment
library(shinytest2)
options(shinytest2.load_timeout = 45*1000)
options(shinytest2.timeout = 45*1000)

chromote::set_chrome_args(
c(
chromote::default_chrome_args(),
"--no-sandbox"
)
)

tmpt <- Sys.time()
while (!chromote::has_default_chromote_object() && Sys.time() - tmpt < 1) {
try(chromote::set_default_chromote_object(chromote::Chromote$new()), silent = TRUE)
}

test_check("riskassessment")
# test_file("tests/testthat/test-downloadHandler.R")
16 changes: 16 additions & 0 deletions tests/testthat/setup_shinytest2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Set options for tests to run properly
options(shinytest2.load_timeout = 45*1000)
options(shinytest2.timeout = 45*1000)
options(chromote.headless = "new")

chromote::set_chrome_args(
c(
chromote::default_chrome_args(),
"--no-sandbox"
)
)

tmpt <- Sys.time()
while (!chromote::has_default_chromote_object() && Sys.time() - tmpt < 1) {
try(chromote::set_default_chromote_object(chromote::Chromote$new()), silent = TRUE)
}

0 comments on commit c03f7d8

Please sign in to comment.