openspec-playwright 0.1.16
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/.claude/commands/opsx/e2e.md +8 -0
- package/.claude/skills/openspec-e2e/SKILL.md +138 -0
- package/.github/workflows/release.yml +41 -0
- package/README.md +133 -0
- package/README.zh-CN.md +118 -0
- package/bin/openspec-pw +4 -0
- package/bin/openspec-pw.js +2 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +110 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +174 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +5 -0
- package/dist/commands/run.js +135 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.js +91 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/docs/plans/2026-03-26-openspec-playwright-design.md +180 -0
- package/package.json +39 -0
- package/schemas/playwright-e2e/schema.yaml +56 -0
- package/schemas/playwright-e2e/templates/e2e-test.ts +55 -0
- package/schemas/playwright-e2e/templates/playwright.config.ts +52 -0
- package/schemas/playwright-e2e/templates/report.md +27 -0
- package/schemas/playwright-e2e/templates/test-plan.md +24 -0
- package/src/commands/doctor.ts +114 -0
- package/src/commands/init.ts +209 -0
- package/src/commands/run.ts +172 -0
- package/src/commands/update.ts +130 -0
- package/src/index.ts +47 -0
- package/templates/auth.setup.ts +77 -0
- package/templates/credentials.yaml +33 -0
- package/templates/seed.spec.ts +63 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Seed test for Playwright Test Agents
|
|
2
|
+
// Copy this to tests/playwright/seed.spec.ts after running openspec-pw init
|
|
3
|
+
// Customize the page object and base URL for your application
|
|
4
|
+
|
|
5
|
+
import { test, expect, Page } from '@playwright/test';
|
|
6
|
+
|
|
7
|
+
// Customize these for your application
|
|
8
|
+
const BASE_URL = process.env.BASE_URL || 'http://localhost:3000';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Page Object Pattern - customize these selectors for your app
|
|
12
|
+
*/
|
|
13
|
+
class AppPage {
|
|
14
|
+
constructor(private page: Page) {}
|
|
15
|
+
|
|
16
|
+
async goto(path: string = '/') {
|
|
17
|
+
await this.page.goto(`${BASE_URL}${path}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Add your app's common selectors here
|
|
21
|
+
// Example:
|
|
22
|
+
// async getLoginButton() {
|
|
23
|
+
// return this.page.locator('button[data-testid="login"]');
|
|
24
|
+
// }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Helper to create a new page object
|
|
29
|
+
*/
|
|
30
|
+
function createPage(page: Page): AppPage {
|
|
31
|
+
return new AppPage(page);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ──────────────────────────────────────────────
|
|
35
|
+
// Below are example tests - customize for your app
|
|
36
|
+
// ──────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
test.describe('Application smoke tests', () => {
|
|
39
|
+
test.beforeEach(async ({ page }) => {
|
|
40
|
+
const app = createPage(page);
|
|
41
|
+
await app.goto('/');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('page loads successfully', async ({ page }) => {
|
|
45
|
+
// Verify the page loads without errors
|
|
46
|
+
await expect(page).not.toHaveURL(/.*error.*/);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('no console errors', async ({ page }) => {
|
|
50
|
+
const errors: string[] = [];
|
|
51
|
+
page.on('console', (msg) => {
|
|
52
|
+
if (msg.type() === 'error') {
|
|
53
|
+
errors.push(msg.text());
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
await page.reload();
|
|
57
|
+
// Filter out known non-critical errors
|
|
58
|
+
const criticalErrors = errors.filter(
|
|
59
|
+
(e) => !e.includes('favicon') && !e.includes('404')
|
|
60
|
+
);
|
|
61
|
+
expect(criticalErrors).toHaveLength(0);
|
|
62
|
+
});
|
|
63
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"types": ["node"]
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*"],
|
|
17
|
+
"exclude": ["node_modules", "dist", "templates", ".claude"]
|
|
18
|
+
}
|