Installation
Dependencies
Node.js
Check if you already have Node installed by opening a terminal or command prompt instance and executing
node -v
. You should see a version number in the return.If you do not have Node already installed, go to Node.js and select the version associated with your operating system.
Foundry
Check if you already have Anvil installed through Foundry by opening a terminal or command prompt instance and executing anvil -V
. You should see a version number in the return. If you do not, follow one of the guides below.
Mac, Linux, and Windows
Docker
GuardianTest
You can install GuardianTest using either npm or yarn:
NOTE: You should remove any installations of base Playwright from your repo. Otherwise you may encounter an error around "requiring @playwright/test
a second time".
NPM
Yarn
Playwright Browsers
You will need to have the latest Playwright browser drivers installed.
Configuring the Framework
Playwright Config
At your repo's top-level directory create a file called playwright.config.ts
.
If you already are using Playwright and already have a playwright.config.ts:
Add
/.*gui\.(js|ts|mjs)/
to thetestMatch
entry to make sure Playwright recognizes our testsIf you do not have a
testMatch
entry in the config, add one like shown in the example belowIf you have existing Playwright tests that are either named with the
testName.spec.ts
ortestName.test.ts
naming conventions make the following yourtestMatch
entry:[/.*gui\.(js|ts|mjs)/, /.*(spec|test)\.(js|ts|mjs)/]
Set
fullyParallel
tofalse
Set
workers
to1
env
At your repo's top-level directory create another file called .env
or if you already have one add the following to your existing .env
. Comment out whichever line you do not use with a #
at the start.
package.json
To be able to run tests, add the following to your app's package.json
scripts section:
To run tests headless, use the following for your app's package.json
scripts section instead:
Tests Folder
Create a folder called tests
to house your GuardianTest tests within.
Last updated