Skip to content

Commit d680a1a

Browse files
committed
Playwright Configuration
1 parent 7f10b3a commit d680a1a

7 files changed

+3998
-3
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
test-results/
3+
allure-results/
4+
allure-report/
5+
Downloads/

.eslintrc.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
es2021: true,
5+
},
6+
extends: [`eslint-recommended`, `plugin:@typescript-eslint/recommended`],
7+
parser: `@typescript-eslint/parser`,
8+
plugins: [`@typescript-eslint`],
9+
rules: {
10+
quotes: [`error`, `backtick`],
11+
semi: [`error`, `always`],
12+
},
13+
};

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
test-results/
3+
allure-results/
4+
allure-report/
5+
Downloads/

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM mcr.microsoft.com/playwright:next
2+
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
7+
RUN npm ci
8+
9+
COPY . .
10+
11+
RUN npx playwright install chrome
12+
13+
CMD ["npm","run","test:serial"]
14+
15+
16+
17+

package-lock.json

+3,815
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
{
2-
"name": "playwright-ts",
2+
"name": "playwright-typescipt-playwright-test",
33
"version": "1.0.0",
44
"description": "Playwright Framework with Typescript",
55
"main": "index.js",
66
"scripts": {
7-
"test": "npx playwright test"
7+
"test": "npx playwright test",
8+
"test:single":"npx playwright test GoogleSearch.test.ts --project=Chrome",
9+
"test:parallel":"npx playwright test --grep @Regression --project=Chrome",
10+
"test:serial":"npx playwright test --grep @Regression --workers=1 --project=Chrome",
11+
"test:api":"npx playwright test --grep @api --workers=1 --project=Chrome",
12+
"test:record":"npx playwright codegen",
13+
"test:visual":"npx playwright test visualComparision.test.ts --project=Chrome",
14+
"test:device":"npx playwright test Emulation.test.ts --project=Chrome",
15+
"test:report":"allure serve"
16+
817
},
918
"repository": {
1019
"type": "git",
1120
"url": "https://github.com/akshayp7/playwright-typescipt-playwright-test.git"
1221
},
1322
"author": "Akshay Pai",
14-
"license": "ISC"
23+
"license": "ISC",
24+
"dependencies": {
25+
"@playwright/test": "^1.14.1",
26+
"@types/crypto-js": "^4.0.2",
27+
"@typescript-eslint/eslint-plugin": "^4.30.0",
28+
"@typescript-eslint/parser": "^4.30.0",
29+
"crypto-js": "^4.1.1",
30+
"eslint": "^7.32.0",
31+
"eslint-plugin-import": "^2.24.2",
32+
"exceljs": "^4.3.0",
33+
"experimental-allure-playwright": "0.0.3",
34+
"pg": "^8.7.1",
35+
"playwright": "^1.14.1",
36+
"supertest": "^6.1.6",
37+
"typescript": "^4.4.2"
38+
}
1539
}

playwright.config.ts

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { devices } from 'playwright';
2+
3+
module.exports = {
4+
//sets timeout for each test case
5+
timeout: 300000,
6+
7+
//number of retries if test case fails
8+
retries: 0,
9+
10+
//Reporters
11+
reporter: [[`list`], [`experimental-allure-playwright`]],
12+
13+
projects: [
14+
{
15+
name: `Chrome`,
16+
use: {
17+
// Configure the browser to use.
18+
browserName: `chromium`,
19+
20+
//Chrome Browser Config
21+
channel: `chrome`,
22+
23+
//Browser Mode
24+
headless: `true`,
25+
26+
//Slows down execution by ms
27+
slowMo: 0,
28+
29+
//Browser height and width
30+
viewport: { width: 1500, height: 730 },
31+
ignoreHTTPSErrors: `true`,
32+
33+
//Enable File Downloads in Chrome
34+
acceptDownloads: `true`,
35+
36+
//Artifacts
37+
screenshot: `only-on-failure`,
38+
video: `retain-on-failure`,
39+
trace: `retain-on-failure`,
40+
},
41+
},
42+
{
43+
name: `Chromium`,
44+
use: {
45+
browserName: `chromium`,
46+
headless: `true`,
47+
slowMo: 0,
48+
viewport: { width: 1500, height: 730 },
49+
ignoreHTTPSErrors: `true`,
50+
acceptDownloads: `true`,
51+
screenshot: `only-on-failure`,
52+
video: `retain-on-failure`,
53+
trace: `retain-on-failure`,
54+
},
55+
},
56+
57+
{
58+
name: `Firefox`,
59+
use: {
60+
browserName: `firefox`,
61+
headless: `true`,
62+
slowMo: 0,
63+
viewport: { width: 1500, height: 730 },
64+
ignoreHTTPSErrors: `true`,
65+
acceptDownloads: `true`,
66+
screenshot: `only-on-failure`,
67+
video: `retain-on-failure`,
68+
trace: `retain-on-failure`,
69+
},
70+
},
71+
72+
{
73+
name: `Edge`,
74+
use: {
75+
browserName: `chromium`,
76+
channel: `msedge`,
77+
headless: `true`,
78+
slowMo: 0,
79+
viewport: { width: 1500, height: 730 },
80+
ignoreHTTPSErrors: `true`,
81+
acceptDownloads: `true`,
82+
screenshot: `only-on-failure`,
83+
video: `retain-on-failure`,
84+
trace: `retain-on-failure`,
85+
},
86+
},
87+
{
88+
name: `WebKit`,
89+
use: {
90+
browserName: `webkit`,
91+
headless: `true`,
92+
slowMo: 0,
93+
viewport: { width: 1500, height: 730 },
94+
ignoreHTTPSErrors: `true`,
95+
acceptDownloads: `true`,
96+
screenshot: `only-on-failure`,
97+
video: `retain-on-failure`,
98+
trace: `retain-on-failure`,
99+
},
100+
},
101+
{
102+
name: `Device`,
103+
use: {
104+
...devices[`iPhone 12 Pro Max`],
105+
browserName: `chromium`,
106+
headless: `true`,
107+
slowMo: 0,
108+
ignoreHTTPSErrors: `true`,
109+
acceptDownloads: `true`,
110+
screenshot: `only-on-failure`,
111+
video: `retain-on-failure`,
112+
trace: `retain-on-failure`,
113+
},
114+
},
115+
],
116+
};

0 commit comments

Comments
 (0)