File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ Suggests:
34
34
tidyr,
35
35
later,
36
36
withr,
37
- shinytest
37
+ shinytest,
38
+ chromote
38
39
Config/Needs/website: tidyverse/tidytemplate
39
40
URL: https://github.com/rstudio/shinycoreci
40
41
BugReports: https://github.com/rstudio/shinycoreci/issues
Original file line number Diff line number Diff line change @@ -355,3 +355,42 @@ verify_no_untracked_files <- function(repo_dir, apps_folder) {
355
355
stop(" Make sure there are no untracked files. Please remove the files or commit the changes." )
356
356
}
357
357
}
358
+
359
+
360
+ inform_latest_results <- function () {
361
+ if (! requireNamespace(" chromote" , quietly = TRUE )) {
362
+ stop(" Please install `chromote` to use this function" )
363
+ }
364
+
365
+ url <- " https://rstudio.github.io/shinycoreci/results/"
366
+
367
+ b <- chromote :: ChromoteSession $ new()
368
+ withr :: defer(b $ close())
369
+
370
+ p <- b $ Page $ loadEventFired(wait_ = FALSE )
371
+ b $ Page $ navigate(url = url , wait_ = FALSE )
372
+ b $ wait_for(p )
373
+
374
+ # Wait for the page to follow the redirect
375
+ Sys.sleep(1 )
376
+
377
+ failed <- b $ Runtime $ evaluate(
378
+ " [...document.querySelectorAll('#app_summary h3')].map(el => el.innerText)" ,
379
+ returnByValue = TRUE
380
+ )$ result $ value
381
+ failed <- unlist(failed )
382
+
383
+ history <- b $ Page $ getNavigationHistory()
384
+ current_url <- history $ entries [[history $ currentIndex + 1 ]]
385
+ cli :: cli_inform(" {.url {current_url$url}}" )
386
+
387
+ if (length(failed ) == 0 ) {
388
+ cli :: cli_alert_success(" All tests passed!" )
389
+ return (invisible ())
390
+ }
391
+
392
+ cli :: cli_alert_danger(" {length(failed)} test{?s} failed:" )
393
+ cli :: cli_verbatim(sprintf(" - `%s`" , failed ))
394
+
395
+ invisible (unlist(failed ))
396
+ }
You can’t perform that action at this time.
0 commit comments