Skip to content

Commit

Permalink
updated to latest version of playwright and allure. Added UI Mode sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
VinayKumarBM committed Aug 13, 2023
1 parent 679f0df commit b9ac5e7
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 98 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ For Demo purpose UI test cases are created on [advantageonlineshopping.com](http
- Generates Playwright's HTML Report, Allure Report & JUnit Report in HTML format for each exaction.
- Allure & Playwright report including snapshots and video in case of test failure.
- Test execution logs are captured in the log file.
- You Can execute local tests in Playwright's UI Mode, that comes with a built-in watch mode. Which helps in running and debuging of tests.
- All the playwright related config is controlled by playwright config file.
- Environment variables can be modified at runtime and its controlled by .env file.
- Easy and simple integration to CI/CD tools like Jenkins.
Expand Down Expand Up @@ -63,6 +64,12 @@ set TEST_NAME=<TestFileName> && npm run local:test
```
**Note:** Using set command we are setting the local TestFileName.

To run individual test locally in [UI Mode](https://playwright.dev/docs/test-ui-mode) use below command.
```sh
set TEST_NAME=<TestFileName> && npm run local:test:ui
```
**Note:** Using set command we are setting the local TestFileName.

To change any environment configuration in .env file at run time use set command.
Eg: To change browser to MS Edge use below command
```sh
Expand Down
159 changes: 70 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
"report": "allure serve",
"create:suite": "cd ./src/framework/manager & npx ts-node SuiteManager.ts",
"test": "playwright test --project=suite",
"local:test": "playwright test --project=local"
"local:test": "playwright test --project=local",
"local:test:ui": "playwright test --project=local --ui"
},
"keywords": [],
"author": "Vinay Kumar B M",
"license": "ISC",
"devDependencies": {
"@playwright/test": "1.27.1",
"@playwright/test": "1.37.0",
"@types/easy-soap-request": "4.1.1",
"@types/express": "^4.17.13",
"@types/ibm_db": "2.0.10",
Expand All @@ -30,7 +31,7 @@
"@types/xmldom": "^0.1.31",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"allure-playwright": "2.0.0-beta.19",
"allure-playwright": "2.5.0",
"dotenv": "16.0.0",
"easy-soap-request": "^4.6.0",
"eslint": "^8.12.0",
Expand All @@ -42,7 +43,6 @@
"mssql": "^7.2.1",
"oracledb": "5.3.0",
"pdf-parse": "1.1.1",
"playwright": "1.27.1",
"randomstring": "1.2.2",
"string-format": "2.0.0",
"ts-node": "^10.4.0",
Expand Down
10 changes: 9 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const config: PlaywrightTestConfig = {
acceptDownloads: true,
actionTimeout: Number.parseInt(process.env.ACTION_TIMEOUT, 10) * timeInMin,
navigationTimeout: Number.parseInt(process.env.NAVIGATION_TIMEOUT, 10) * timeInMin,
screenshot: "only-on-failure",
screenshot: {
mode: "only-on-failure",
fullPage: true,
},
video: "retain-on-failure",
},
testDir: "./src/tests",
Expand All @@ -37,6 +40,11 @@ const config: PlaywrightTestConfig = {
["allure-playwright", {
detail: false,
suiteTitle: false,
environmentInfo: {
OS: process.platform.toUpperCase(),
BROWSER: process.env.BROWSER.toUpperCase(),
BASE_URL: process.env.BASE_URL,
},
}],
['html', { open: 'never', outputFolder: "./test-results/report" }],
["junit", { outputFile: "./test-results/results/results.xml" }],
Expand Down
5 changes: 1 addition & 4 deletions src/framework/reporter/Allure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ export default class Allure {
allure.description(description);
allure.owner(os.userInfo().username);
if (issue !== undefined && issue !== null && issue !== '') {
allure.link({
url: `${process.env.LINK}${issue}`,
name: issue,
});
allure.link(`${process.env.LINK}${issue}`, `ISSUE-${issue}`);
}
}
}

0 comments on commit b9ac5e7

Please sign in to comment.