|
| 1 | +# PLAYWRIGHT vs. SELENIUM COMPARISON |
| 2 | + |
| 3 | +This is a simple project utilising 2 UI test automation tools - Playwright and Selenium 4. |
| 4 | + |
| 5 | +The purpose of the project is to compare both tools in implementation and execution of exactly the same tests. Tests are using BE response mocking mechanism. |
| 6 | + |
| 7 | +As SUT, project utilises my Angular UI application called [Spec Lead Notes UI](https://github.com/devpuppet/spec-lead-notes-ui) deployed on Firebase which uses [Spec Lead Notes BE](https://github.com/devpuppet/spec-lead-notes-be) deployed on Render. |
| 8 | + |
| 9 | +## Project Structure |
| 10 | + |
| 11 | +The project is organized into following packages: |
| 12 | + |
| 13 | +- [common](common): Common utility files. |
| 14 | +- [mocks](mocks): Objects used in mocking the responses in teh tests. |
| 15 | +- [model](model): Model classes. |
| 16 | +- [playwright](playwright): Page components, BE response mocking mechanism Page Objects and test fixture implemented using Playwright. |
| 17 | +- [selenium](selenium): Page components, BE response mocking mechanism and Page Objects implemented using Selenium 4. |
| 18 | +- [tests](tests): Automation tests implemented using Playwright and Selenium. For both tools, tests logic is exactly the same. |
| 19 | +- [Jenkinsfile](Jenkinsfile): Jenkins configuration used when tests were run on local instance of Jenkins. |
| 20 | + |
| 21 | +## Installation |
| 22 | + |
| 23 | +1. Run `npm install` to install the dependencies. |
| 24 | +2. Run `npm run pw:install` to install Playwright browser executables. |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +**Important note** - Backend of SUT is hosted on [Render](https://render.com/). Hosting is free and is has the disadvantage that when deployed service is not used for a specified amount of time, it is turned off and turned on only when pinged again. |
| 29 | +For below test execution, it means that first test runs will fail but they will trigger BE service to come up. Subsequent test runs should be successful. |
| 30 | + |
| 31 | +1. Run `npm run test:selenium` to execute Selenium tests. |
| 32 | +2. Open Selenium test execution report - [report.html](selenium-report/report.html). |
| 33 | +2. Run `npm run test:pw:headed` to execute Playwright tests in headed mode. |
| 34 | +3. Run `npm run pw:report` to see test execution report generated for Playwright tests. |
| 35 | + |
| 36 | +## Example Useful Project Commands |
| 37 | +- `pw:install`: Install Playwright browser executable. Might be needed after Playwright version update. |
| 38 | +- `compile:watch`: runs Typescript compiler in watch mode meaning you don't have to manually run `tsc` everytime you change a file. |
| 39 | +- `test:pw:ui`: Run Playwright in UI mode. |
0 commit comments