Skip to content

Commit

Permalink
fix playwright package.json syntax error (#388)
Browse files Browse the repository at this point in the history
* fix playwright package.json syntax error

* add playwright testing steps in readme
  • Loading branch information
KrupaPammi authored Apr 5, 2023
1 parent 91f1c8e commit a5502e6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,27 @@ The domains for giftaid are as follows
- [giftaid-staging.comicrelief.com](https://giftaid-staging.comicrelief.com)
- [giftaid-staging.sportrelief.com](https://giftaid-staging.sportrelief.com)
- [giftaid-staging.rednoseday.com](https://giftaid-staging.rednoseday.com)

## Testing

In order to run Playwright end-to-end tests locally you need to change directory to playwright folder `cd playwright` and export the following environment variables to your terminal:`BASE_URL, BROWSERSTACK_ACCESS_KEY, BROWSERSTACK_USERNAME`
Browserstack credentials can be found in https://github.com/comicrelief/serverless-giftaid/blob/master/concourse/private.yml
```bash
export BASE_URL='https://donation-staging.spa.comicrelief.com/' or PR env 'https://donation-pr.spa.comicrelief.com/'
export BROWSERSTACK_USERNAME='<INSERT_USERNAME>'
export BROWSERSTACK_ACCESS_KEY='<INSERT_ACCESS_KEY>'
```
### Running tests

To run sanity or nightly-tests, check the commands in playwright/package.json

To run a single test, add `only` annotation

eg: test.only('submit form with valid inputs', async ({ page }) => {
});

Check serverless-giftaid in order to get the right values and then you can run the test executing:

```bash
yarn test:sanity
```
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"build": "node scripts/build.js",
"lint": "eslint --color src tests",
"test:sanity": "playwright test --grep '@sanity'",
"sanity-test": "export NODE_ENV=development; node_modules/.bin/nightwatch --tag sanity -e chrome --retries 2",
"cy:run": "export NODE_ENV=development; cypress run",
"cy:open": "export NODE_ENV=development; cypress open",
"test": "run-p --race start cy:run",
Expand Down
2 changes: 1 addition & 1 deletion playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"uuid": "8.3.2"
},
"scripts": {
"test:sanity": "playwright test --grep '@sanity'",
"test:sanity": "playwright test --grep '@sanity'"
}
}

0 comments on commit a5502e6

Please sign in to comment.