| Production | Test |
|---|---|
install.packages(c("testthat", "RSelenium", "XML", "digest", "jsonlite"))In .Renviron file on your home directory:
# Url for the server you want to point to:
DEV_HOST=https://datatools-dev.immunespace.org
# To run tests pointing at your local instance:
# DEV_HOST=http://<yourIPaddress>:8080
# ImmuneSpace login info
[email protected]
ISR_PWD=yourImmuneSpacePasswordHere
# SauceLabs login info
SAUCE_USERNAME=yourUsername
SAUCE_ACCESS_KEY=yourAccessKey
# optional
SELENIUM_SERVER=LOCAL # if not set, it uses SauceLabs
TEST_BROWSER=firefox # if not set, default is chromeInstall Docker Community Edition (CE) following the instructions from their website:
To run chrome browser:
docker run -d -p 127.0.0.1:4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:2.53.1Or to run FireFox browser:
docker run -d -p 127.0.0.1:4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:2.53.1From the command line:
Rscript test.ROr in R:
source("test.R")In R:
testthat::test_file("tests/test-0-front.R", reporter = c("summary", "fail"))# Start selenium server
rD <- RSelenium::rsDriver(browser="firefox")
# Open browser
remDr <- rD[["client"]]
# Stop selenium server
rD[["server"]]$stop()-
Setup a VNC viewer so you can look at the output of the VNC server in the container https://www.realvnc.com/en/connect/download/viewer/
-
Background on VNCs with Selenium and Docker Here: https://qxf2.com/blog/view-docker-container-display-using-vnc-viewer/
# Run the standalone debug server
docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.141.59-zirconiumUse the viewer to check out what is going on:
- Open the viewer utility through the UI (search vncviewer)
- Connect to 'localhost:5900'
- enter the password given by Selenium - aka 'secret'
- Developing React Modules: Dev versions of a webpart will not be available in your dockerized test environment unless you map the npm dev server port (e.g. 3001) to that same port in the docker environment.
- netrc files: unlike the servers, where a separate unix user is running the R session, your local instance will have an R engine that depends on there being a viable .netrc in the home directory. If you do not want to use your credentials, you will need to replace them (e.g. with a non-admin dummy user).
Configure UITesting.yaml
- To install R and required packages
- To cache packages
- To run
test.Rscript - To communicate with
Sauce Labsafter test
See Creating encrypted secrets for an environment
Even though this is not a package, DESCRIPTION file is needed to run a builder in GitHub Actions Workflow in order to declare dependencies (using remotes::install_deps(dependencies = TRUE)).
- Front page (
test-0-front.R) - Overview page (
test-overview.R) - Data Finder page (
test-datafinder.R) - Resources page (
test-resources.R) - Modules page (
test-modules.R)- Data Explorer (
test-modules-de.R) - Gene Expression Explorer (
test-modules-gee.R) - Gene Set Enrichment Analysis (
test-modules-gsea.R) - Immune Response Predictor (
test-modules-irp.R) - Dimension Reduction (
test-modules-dr.R)
- Data Explorer (
- Reports page (
test-reports.R)- SDY144 (
test-reports-sdy144.R) - SDY180 (
test-reports-sdy180.R) - SDY207 (
test-reports-sdy207.R) - SDY269 (
test-reports-sdy269.R) - IS1 (
test-reports-is1.R)
- SDY144 (
- RStudio session (
test-rstudio.R)
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs