The purpose of {pw} is to streamline the use of Playwright for testing your {golem} applications.
You can install the development version of {pw} like so:
# pak::pak("thinkr-open/pw")
install.packages("pw", repos = c('https://thinkr-open.r-universe.dev', 'https://cloud.r-project.org'))
{golem} project.usethis::use_testthat() to set it up).To set up Playwright testing in your {golem} project, execute the following command:
pw::pw_init()
This function will:
npx create-playwright@latest in the tests/playwright folder.tests/playwright/playwright.config.ts (updated)tests/playwright/tests/default.test.ts (created)tests/testthat/test-playwright.R (created)After setup, run devtools::test() to confirm that everything is functioning correctly
To execute the Playwright tests, use the following command in R:
pw::pw_test()
To create or modify tests, edit the file tests/playwright/tests/default.test.ts or add new test files in the same directory to extend your Playwright test suite.
For manual execution of Playwright commands, navigate to the tests/playwright directory:
cd tests/playwright
npx playwright test
Note: The full Playwright Node.js API will not be wrapped in R. For advanced use cases, you may need to run commands directly from the terminal.