|
1 | | -# Example NodeJS/React Consumer - Cypress (BYO Adapter) |
| 1 | +# Example NodeJS/React Consumer - playwright (BYO Adapter) |
2 | 2 |
|
3 | | -[](https://github.com/pactflow/example-bi-directional-consumer-cypress/actions/workflows/build.yml) |
| 3 | +[](https://github.com/pactflow/example-bi-directional-consumer-playwright/actions/workflows/build.yml) |
4 | 4 |
|
5 | | -[](https://testdemo.pactflow.io/pacticipants/pactflow-example-bi-directional-consumer-cypress/branches/main/latest-version/can-i-deploy/to-environment/production/badge) |
| 5 | +[](https://testdemo.pactflow.io/pacticipants/pactflow-example-bi-directional-consumer-playwright/branches/main/latest-version/can-i-deploy/to-environment/production/badge) |
6 | 6 |
|
7 | | -- [Example NodeJS/React Consumer - Cypress (BYO Adapter)](#example-nodejsreact-consumer---cypress-byo-adapter) |
| 7 | +- [Example NodeJS/React Consumer - playwright (BYO Adapter)](#example-nodejsreact-consumer---playwright-byo-adapter) |
8 | 8 | - [Overview of Example](#overview-of-example) |
9 | | - - [Key points with Cypress](#key-points-with-cypress) |
| 9 | + - [Key points with playwright](#key-points-with-playwright) |
10 | 10 | - [Overview of Part of Bi-Directional Contract Testing Flow](#overview-of-part-of-bi-directional-contract-testing-flow) |
11 | 11 | - [Compatibile with Providers](#compatibile-with-providers) |
12 | 12 | - [Pre-requisites](#pre-requisites) |
|
23 | 23 |
|
24 | 24 | <!-- Consumer Overview --> |
25 | 25 |
|
26 | | -This is an example of a React "Product" API consumer that uses Cypress, [pact-cypress-adapter](https://www.npmjs.com/package/@pactflow/pact-cypress-adapter), [Pactflow](https://pactflow.io) and GitHub Actions to generate and publish Pact consumer contracts. |
| 26 | +This is an example of a React "Product" API consumer that uses playwright, [pact-playwright-adapter](https://www.npmjs.com/package/@pactflow/pact-playwright-adapter), [Pactflow](https://pactflow.io) and GitHub Actions to generate and publish Pact consumer contracts. |
27 | 27 |
|
28 | 28 | It performs pre-deployment cross-compatibility checks to ensure that it is compatible with specified providers using the Bi-Directional contract capability of Pactflow. |
29 | 29 |
|
30 | 30 | <!-- General --> |
31 | 31 |
|
32 | 32 | See the full [Pactflow Bi-Directional Workshop](https://docs.pactflow.io/docs/workshops/bi-directional-contract-testing) for which this can be substituted in as the "consumer". |
33 | 33 |
|
34 | | -### Key points with Cypress |
| 34 | +### Key points with playwright |
35 | 35 |
|
36 | 36 | It: |
37 | 37 |
|
38 | 38 | - It a React app implementing a "Product" website created with Create React App |
39 | | -- It utilises Cypress to functionally test the website |
40 | | -- It utilises [pact-cypress-adapter](https://www.npmjs.com/package/@pactflow/pact-cypress-adapter) to transform cypress mocks into Pact consumer contracts. |
| 39 | +- It utilises playwright to functionally test the website |
| 40 | +- It utilises [pact-playwright-adapter](https://www.npmjs.com/package/@pactflow/pact-playwright-adapter) to transform playwright mocks into Pact consumer contracts. |
41 | 41 |
|
42 | 42 | ## Overview of Part of Bi-Directional Contract Testing Flow |
43 | 43 |
|
@@ -102,7 +102,7 @@ Set `PACT_PROVIDER` to one of the following |
102 | 102 |
|
103 | 103 | ### Steps |
104 | 104 |
|
105 | | -NOTE: Cypress tests are located in `./cypress/integration`. See below for how to start cypress test, generate consumer contract and publish contract to pactflow. |
| 105 | +NOTE: playwright tests are located in `./playwright/integration`. See below for how to start playwright test, generate consumer contract and publish contract to pactflow. |
106 | 106 |
|
107 | 107 | - `make install` - install project dependencies |
108 | 108 |
|
@@ -133,13 +133,13 @@ Using alternate pact CLI tools. |
133 | 133 | - `PACT_TOOL=ruby_standalone make ci` - run the CI process, using the pact standalone CLI tool |
134 | 134 | - `PACT_TOOL=ruby_cli make ci` - run the CI process, using the pact ruby CLI tool |
135 | 135 |
|
136 | | -_How to use Cypress_ |
| 136 | +\_How to use Playwright |
137 | 137 |
|
138 | 138 | - Spin up the ui project by running `npm run start` |
139 | | -- Define your pact provider and consumer name at `cypress.json` as cypress environment variables |
| 139 | +- Define your pact provider and consumer name at `playwright.json` as playwright environment variables |
140 | 140 | - You can stub your network request and response with `cy.intercept`, and record network call to a consumer driven contract with `cy.usePactWait`. Each request you want to add to the contract must call this method. |
141 | | -- `npm run cypress:headless:chrome` - this will run cypress e2e test in headless mode, and write stubbed network calls a pact file |
142 | | -- `npm run cypress:run` - this will run cypress e2e test with browser ui |
| 141 | +- `npm run playwright:headless:chrome` - this will run playwright e2e test in headless mode, and write stubbed network calls a pact file |
| 142 | +- `npm run playwright:run` - this will run playwright e2e test with browser ui |
143 | 143 |
|
144 | 144 | ## OS/Platform specific considerations |
145 | 145 |
|
|
0 commit comments