End to end tests for the Fyle Integrations App
If not already present, install nvm on your mac following the instructions here
nvm install 22
nvm use 22
npm install
npx playwright install
Create a .env file in the root folder of the repo, and ping @Viswas for its contents.
You absolutely should run Playwright using the VS Code extension. It will make your life 10x easier.
Follow the steps in this article
Switch to using node v22 in the terminal.
nvm use 22
node --version # confirm that it is version 22
Do this if you want to see what the test does visually
npx playwright test --headed
If you want to see detailed traces while test is executing visually
npx playwright test --ui
If you want to run tests in headless mode
npx playwright test
This is boring - you dont see magical stuff happening. This would be useful in a CI/CD situation
- Read Playwright best practices doc
- Test independence
- Ideally, each test case should be independent
- However, setup can be expensive
- Group tests in groups and make each test group independent
- Setup an org from scratch for every test group
- When “locating” elements, use only visual cues
- If you tweak DOM structure, test shouldn’t fail
- Use Page Object Model sparingly
- With POM, you can’t generate code from recording slowing down test writing
- Only if you have a solid reason, such as a particular block of code being reused across tests/files, should you consider POM
- POM files are located in the
common/pom/folder
- Don’t use sleep