Skip to content

Commit 9060019

Browse files
Merge pull request #6 from ramjangatisetty/feature/githubworkflowwithdocker
Updated README.md file with Debugging instructions from VS Code debug…
2 parents 893fa36 + 4df69bc commit 9060019

File tree

1 file changed

+64
-27
lines changed

1 file changed

+64
-27
lines changed

README.md

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,61 @@ Supports cross-browser testing, rich reporting with **Allure**, Dockerized execu
3030
- ✅ GitHub Pages publishing for Allure reports
3131

3232
---
33+
🐞 Debugging Playwright Tests in VS Code
34+
You can debug your Playwright tests using VS Code's built-in debugger and the provided launch.json configuration.
35+
36+
Example launch.json configuration:
37+
38+
{
39+
"type": "node",
40+
"request": "launch",
41+
"name": "Debug Playwright Test",
42+
"program": "${workspaceFolder}/node_modules/@playwright/test/cli.js",
43+
"args": [
44+
"test",
45+
"--headed",
46+
"--project=chromium"
47+
],
48+
"env": {
49+
"TAG": "@smoke",
50+
"BROWSER": "chromium",
51+
"WORKERS": "1",
52+
"RETRIES": "1",
53+
"TEST_ENV": "qa1"
54+
},
55+
"console": "integratedTerminal",
56+
"internalConsoleOptions": "openOnSessionStart"
57+
}
58+
How to Use
59+
Open your project in VS Code.
60+
Set breakpoints in your test or page files.
61+
Go to the Run & Debug panel (left sidebar).
62+
Select Debug Playwright Test from the dropdown.
63+
Click the green play button (▶️) to start debugging.
64+
The browser will open in headed mode, and you can step through your code, inspect variables, and use all VS Code debugging features.
65+
66+
You can customize the environment variables and arguments as needed for your test run.
67+
For more details, see VS Code Debugging Documentation.
68+
69+
🐞 Debugging Tests with Playwright Debugger
70+
You can debug your Playwright tests using the built-in Playwright Inspector or VS Code debugger. The project provides a convenient script for running tests in debug mode with environment variables pre-set.
71+
72+
Using the Debug Script
73+
To run tests in debug mode with your environment settings, use:
74+
npm run test:env:debug -- [test-file-or-pattern] --debug
75+
test:env:debug is the script defined under package.json file
76+
This command sets the following variables:
77+
TAG='@smoke' BROWSER='chromium' WORKERS=2 RETRIES=1 TEST_ENV='qa1'
78+
The --debug flag opens the Playwright Inspector for interactive debugging.
79+
Example
80+
npm run test:env:debug -- tests/login.spec.ts --debug
81+
What Happens
82+
The script runs Playwright tests with your specified environment.
83+
The Playwright Inspector UI will open, allowing you to step through your tests, inspect selectors, and interact with the browser.
84+
Tips
85+
You can pass any test file or pattern after -- to target specific tests.
86+
Use breakpoints in your test code or add await page.pause() to pause execution at a specific point.
87+
Add this section to your README.md to help contributors debug tests using your custom script and Playwright’s debugging tools. Let me know if you want this inserted automatically!
3388

3489
## 🧪 Running Tests Locally
3590

@@ -85,33 +140,18 @@ docker run --rm -v $(pwd)/allure-report:/app/allure-report my-playwright-runner
85140

86141
## 📂 Project Structure
87142

88-
```
89143
e2e-playwright-framework/
90-
├── tests/ # Test specs
91-
├── pages/ # Page Object Models
92-
├── utils/ # Custom utilities
93-
├── storage/ # Session files
94-
├── allure-results/ # Allure raw data
95-
├── allure-report/ # Allure HTML reports
96-
├── playwright.config.ts # Playwright test config
144+
├── tests/ # Test specs
145+
├── pages/ # Page Object Models
146+
├── utils/ # Custom utilities
147+
├── storage/ # Session files
148+
├── allure-results/ # Allure raw data
149+
├── allure-report/ # Allure HTML reports
150+
├── playwright.config.ts # Playwright test config
97151
├── DockerFile.playwright # Dockerfile for CI/CD
98-
├── .github/workflows/ # GitHub Actions workflows
99-
```
100-
## 🌐 Overriding baseURL
101-
102-
- By default, `baseURL` is loaded from your environment file (e.g., `env/.env.dev1`).
103-
- To override for a specific run, set the `BASE_URL` variable:
104-
105-
```sh
106-
BASE_URL=https://another-url.com npm test
107-
```
152+
├── .github/workflows/ # GitHub Actions workflows
108153

109-
- Or use a different environment:
110154

111-
```sh
112-
TEST_ENV=dev1 npm test
113-
```
114-
---
115155

116156
## ✅ GitHub Actions CI/CD
117157

@@ -125,7 +165,6 @@ This project uses **GitHub Actions** to automate test execution and reporting.
125165

126166
### 📁 Workflow Location
127167

128-
```
129168
.github/workflows/playwright.yml
130169
```
131170
@@ -164,8 +203,6 @@ This project uses **GitHub Actions** to automate test execution and reporting.
164203
165204
TEST_ENV=qa1 npx playwright test
166205
167-
168-
169206
## 📄 License
170207
171-
MIT © 2025 Ramakrishna Jangatisetty
208+
MIT © 2025 Ramakrishna Jangatisetty

0 commit comments

Comments
 (0)