| Title: | Test your 'golem' Apps with 'Playwright' |
|---|---|
| Description: | Test your 'golem' Apps with 'Playwright'. |
| Authors: | Colin Fay [aut, cre] (ORCID: <https://orcid.org/0000-0001-7343-1846>) |
| Maintainer: | Colin Fay <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9019 |
| Built: | 2026-09-30 19:37:06 UTC |
| Source: | https://github.com/ThinkR-open/pw |
Check if 'npx' is available in the system PATH
npx_is_available() stop_if_npx_not_available()npx_is_available() stop_if_npx_not_available()
TRUE if 'npx' is available, FALSE otherwise
npx_is_available()npx_is_available()
This function runs the Playwright code generator.
pw_codegen(where = golem::get_golem_wd(), R_path = NULL, ...)pw_codegen(where = golem::get_golem_wd(), R_path = NULL, ...)
where |
The root directory of your golem project |
R_path |
The path to the R executable |
... |
args passed to npx playwright codegen |
This function initializes a Playwright project in the tests folder.
pw_init( where = golem::get_golem_wd(), create_playwright_version = "1.17.138", create_playwright_args = c("--no-examples", "--quiet") )pw_init( where = golem::get_golem_wd(), create_playwright_version = "1.17.138", create_playwright_args = c("--no-examples", "--quiet") )
where |
The path to the package |
create_playwright_version |
Version of create-playwright to use |
create_playwright_args |
Additional arguments to pass to npx create-playwright |
## Not run: pw_init() ## End(Not run)## Not run: pw_init() ## End(Not run)
This function runs playwright init in a project
that has been previously initiated with {pw}
pw_install(where = golem::get_golem_wd())pw_install(where = golem::get_golem_wd())
where |
The path to the package |
Show the Playwright report
pw_show_report(where = golem::get_golem_wd(), ...)pw_show_report(where = golem::get_golem_wd(), ...)
where |
The path to the package |
... |
Additional arguments to pass to |
Run Playwright tests
pw_test(where = golem::get_golem_wd(), ...)pw_test(where = golem::get_golem_wd(), ...)
where |
The path to the package |
... |
Additional arguments to pass to |
Add the Gihub Action YAML for Playwright
pw_use_github_action()pw_use_github_action()
Used for side effect
if (FALSE){ pw_use_github_action() }if (FALSE){ pw_use_github_action() }
This function adds a new Playwright test file to the tests/playwright/tests directory.
pw_use_test(name, where = golem::get_golem_wd())pw_use_test(name, where = golem::get_golem_wd())
name |
The name of the test to add (without .test.ts extension) |
where |
The path to the package |
This function adds a data-testid attribute to a shiny tag. This is useful for testing with getByTestId in Playwright.
with_test_id(tag, test_id)with_test_id(tag, test_id)
tag |
A shiny tag |
test_id |
A string to use as the value of the data-testid attribute |
A shiny tag with the data-testid attribute added