Skip to content
/ pw Public

Test your golem Apps with Playwright

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

ThinkR-open/pw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pw

Lifecycle: experimental R-CMD-check

The purpose of {pw} is to streamline the use of Playwright for testing your {golem} applications.

Installation

You can install the development version of {pw} like so:

pak::pak("thinkr-open/pw")

Workflow

Requirements

  • Ensure that npm (with npx) is installed on your computer.
  • You must be working within a {golem} project.
  • The default test structure should be present (if not, run usethis::use_testthat() to set it up).

Initializing Playwright Testing

To set up Playwright testing in your {golem} project, execute the following command:

pw::pw_init()

This function will:

  1. Run npx create-playwright@latest in the tests/playwright folder.
  2. Add the following files to your project:
    • 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

Running the Tests

To execute the Playwright tests, use the following command in R:

pw::pw_test()

Writing Your Own Tests

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.

Running Playwright Commands from the Terminal

For manual execution of Playwright commands, navigate to the tests/playwright directory:

cd tests/playwright
npx playwright test

Roadmap

  • Enable viewing of test reports directly.

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.

About

Test your golem Apps with Playwright

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published