playwright-smart-test 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -10
- package/dist/cli/index.js +3 -3
- package/dist/config/index.js +2 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -76,31 +76,50 @@ Static AST import analyzers often fail in E2E environments because:
|
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
-
## 📦 Installation
|
|
79
|
+
## 📦 Installation & Quick Start
|
|
80
80
|
|
|
81
|
-
Install as a
|
|
81
|
+
### 1. Install as a dev dependency
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
+
# npm
|
|
84
85
|
npm install --save-dev playwright-smart-test
|
|
86
|
+
|
|
87
|
+
# pnpm
|
|
88
|
+
pnpm add -D playwright-smart-test
|
|
89
|
+
|
|
90
|
+
# yarn
|
|
91
|
+
yarn add -D playwright-smart-test
|
|
85
92
|
```
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
### 2. Configure Gemini API Key
|
|
95
|
+
Obtain a free API key from [Google AI Studio](https://aistudio.google.com/). Set it in your environment or in a `.env` file in your project root:
|
|
88
96
|
|
|
89
97
|
```bash
|
|
90
|
-
|
|
98
|
+
export GEMINI_API_KEY="your-gemini-api-key"
|
|
91
99
|
```
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
### 3. Initialize Configuration
|
|
102
|
+
Generate `playwright-smart-test.config.json` in your repository root:
|
|
94
103
|
|
|
95
|
-
|
|
104
|
+
```bash
|
|
105
|
+
npx playwright-smart-test init
|
|
106
|
+
```
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
### 4. Run Analysis or Execute Tests
|
|
98
109
|
|
|
99
110
|
```bash
|
|
100
|
-
|
|
111
|
+
# Analyze PR diff against main branch (preview selection)
|
|
112
|
+
npx playwright-smart-test analyze --base origin/main
|
|
113
|
+
|
|
114
|
+
# Run only the impacted Playwright tests
|
|
115
|
+
npx playwright-smart-test run --base origin/main
|
|
101
116
|
```
|
|
102
117
|
|
|
103
|
-
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## ⚙️ Configuration (`playwright-smart-test.config.json`)
|
|
121
|
+
|
|
122
|
+
Generate a starter configuration with `npx playwright-smart-test init` or create `playwright-smart-test.config.json` manually:
|
|
104
123
|
|
|
105
124
|
```json
|
|
106
125
|
{
|
|
@@ -157,7 +176,7 @@ Or create `smart-regression.config.json` in your repository root:
|
|
|
157
176
|
| `playwright-smart-test analyze` | Analyzes Git diff and outputs terminal impact table without executing tests. |
|
|
158
177
|
| `playwright-smart-test run` | Analyzes Git diff and executes **only** the impacted Playwright specs. |
|
|
159
178
|
| `playwright-smart-test comment` | Analyzes diff, generates GitHub Flavored Markdown, and outputs PR report. |
|
|
160
|
-
| `playwright-smart-test init` | Generates a starter `smart-
|
|
179
|
+
| `playwright-smart-test init` | Generates a starter `playwright-smart-test.config.json` configuration file. |
|
|
161
180
|
|
|
162
181
|
### CLI Options
|
|
163
182
|
* `-b, --base <ref>`: Target Git branch or commit to diff against (e.g. `origin/main` or `HEAD~1`).
|
package/dist/cli/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const program = new Command();
|
|
|
14
14
|
program
|
|
15
15
|
.name('playwright-smart-test')
|
|
16
16
|
.description('AI-Powered Smart Regression Test Selection Agent for Playwright')
|
|
17
|
-
.version('1.0.
|
|
17
|
+
.version('1.0.2');
|
|
18
18
|
async function executeAnalysis(options) {
|
|
19
19
|
const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd();
|
|
20
20
|
const config = loadConfig(cwd, options.config);
|
|
@@ -114,11 +114,11 @@ program
|
|
|
114
114
|
});
|
|
115
115
|
program
|
|
116
116
|
.command('init')
|
|
117
|
-
.description('Create a sample smart-
|
|
117
|
+
.description('Create a sample playwright-smart-test.config.json file')
|
|
118
118
|
.option('--cwd <dir>', 'Target directory', process.cwd())
|
|
119
119
|
.action((options) => {
|
|
120
120
|
const targetDir = options.cwd ? path.resolve(options.cwd) : process.cwd();
|
|
121
|
-
const filePath = path.join(targetDir, 'smart-
|
|
121
|
+
const filePath = path.join(targetDir, 'playwright-smart-test.config.json');
|
|
122
122
|
const sample = {
|
|
123
123
|
testDir: 'tests',
|
|
124
124
|
testMatch: ['**/*.spec.ts'],
|
package/dist/config/index.js
CHANGED
|
@@ -9,6 +9,8 @@ export function loadConfig(cwd = process.cwd(), customConfigPath) {
|
|
|
9
9
|
const possiblePaths = customConfigPath
|
|
10
10
|
? [path.resolve(cwd, customConfigPath)]
|
|
11
11
|
: [
|
|
12
|
+
path.resolve(cwd, 'playwright-smart-test.config.json'),
|
|
13
|
+
path.resolve(cwd, '.playwright-smart-testrc.json'),
|
|
12
14
|
path.resolve(cwd, 'smart-regression.config.json'),
|
|
13
15
|
path.resolve(cwd, '.smart-regressionrc.json'),
|
|
14
16
|
path.resolve(cwd, 'smart-regression.json'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-smart-test",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI-Powered Smart Regression Test Selection Agent for Playwright",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/Ujjwal-S-S/playwright-smart-test.git"
|
|
22
22
|
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22.0.0"
|
|
25
|
+
},
|
|
23
26
|
"scripts": {
|
|
24
27
|
"build": "tsc",
|
|
25
28
|
"test": "vitest run",
|
|
@@ -65,4 +68,4 @@
|
|
|
65
68
|
"overrides": {
|
|
66
69
|
"minimatch": "^11.0.3"
|
|
67
70
|
}
|
|
68
|
-
}
|
|
71
|
+
}
|