Skip to content

Commit 407d14a

Browse files
author
Kamil
committed
Added Readme.md, updated .gitignore, updated jest.config.ts to include html reporter for selenium tests, added package.json script to run PW tests in headed mode
1 parent a90a415 commit 407d14a

File tree

6 files changed

+135
-86
lines changed

6 files changed

+135
-86
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
/dist
33
/.vscode
44
test-results
5-
playwright-report
5+
playwright-report
6+
.idea
7+
selenium-report

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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.

jest.config.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ const config: Config = {
55
rootDir: './tests/selenium',
66
transform: {
77
"^.+\\.(ts|tsx)$": "ts-jest"
8-
}
8+
},
9+
reporters: [
10+
'default',
11+
['jest-html-reporter', {
12+
outputPath: "./selenium-report/report.html",
13+
pageTitle: "Selenium 4 Test Results",
14+
includeFailureMsg: true
15+
}]
16+
]
917
};
1018

1119
export default config;

0 commit comments

Comments
 (0)