ropensci-archive / roweb2

:no_entry: ARCHIVED :no_entry:
https://github.com/ropensci/roweb3
25 stars 72 forks source link

Open random pages to check stuff #678

Closed maelle closed 4 years ago

maelle commented 4 years ago

Not really monkey-testing, opening 10 random pages.

library("magrittr")

pr <- 672 # or NULL

if (is.null(pr)) {
  destdir <- "public"

  p <- processx::process$new(
    "hugo", 
    args = c("server", "--destination", destdir), 
    echo = TRUE
  )
  Sys.sleep(120)
  dest <- "http://localhost:1313/"
} else {
  dest <- glue::glue("https://deploy-preview-{pr}--ropensci.netlify.app/")
}

paste0(dest, "/sitemap.xml") %>%
  xml2::read_xml() %>%
  xml2::xml_ns_strip() %>%
  xml2::xml_find_all("//loc") %>%
  xml2::xml_text() %>%stringr::str_remove("\\/$") -> links

purrr::walk(sample(links, 10),
            browseURL)

# p$kill()