@zibby/core 0.3.7 → 0.3.8

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/core",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,7 +28,18 @@ export const generateScriptNode = {
28
28
  const recorded = loadRecordedActions(state.sessionPath);
29
29
  const setupHint = formatSetupHint(detectLoginPattern(recorded));
30
30
 
31
- return `Generate and verify Playwright test at ${state.outputPath}
31
+ // `state.outputPath` is computed from `state.specPath` by the
32
+ // framework. For `zibby test <spec>` runs it's set. For
33
+ // `workflow trigger` runs there's no spec file on disk, so
34
+ // outputPath comes back undefined and the prompt rendered
35
+ // "Generate and verify Playwright test at undefined" — which
36
+ // caused the LLM to literally write to a file named `undefined`.
37
+ // Fall back to a path under the session dir so the test always
38
+ // lands somewhere sensible.
39
+ const outputPath = state.outputPath
40
+ || (state.sessionPath ? `${state.sessionPath}/generate_script/generated-test.spec.js` : 'tests/generated-test.spec.js');
41
+
42
+ return `Generate and verify Playwright test at ${outputPath}
32
43
 
33
44
  Test Spec:
34
45
  ${state.testSpec}
@@ -85,9 +96,9 @@ RULES:
85
96
 
86
97
  WORKFLOW:
87
98
  1. Study the codebase FIRST — search tests/ for existing helpers, fixtures, and shared setup files. Read them. Reuse what exists. Do NOT create files that duplicate existing ones.
88
- 2. Write test to ${state.outputPath} (after the run, a copy is mirrored under ${state.sessionPath}/generate_script/ for Studio — you may also write directly there if you prefer)
99
+ 2. Write test to ${outputPath} (after the run, a copy is mirrored under ${state.sessionPath}/generate_script/ for Studio — you may also write directly there if you prefer)
89
100
  3. Verify syntax: run node --check on the file. If it fails, fix and re-check before proceeding.
90
- 4. Run: PLAYWRIGHT_HEADLESS=1 npx playwright test ${state.outputPath} --reporter=line --timeout=60000
101
+ 4. Run: PLAYWRIGHT_HEADLESS=1 npx playwright test ${outputPath} --reporter=line --timeout=60000
91
102
  5. If fails: try selectors in order — (a) getByRole (b) getByText (c) getByTestId (d) add waitForSelector. Never retry the same selector twice.
92
103
  6. MAX 2 ATTEMPTS then STOP
93
104
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/core",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,7 +28,18 @@ export const generateScriptNode = {
28
28
  const recorded = loadRecordedActions(state.sessionPath);
29
29
  const setupHint = formatSetupHint(detectLoginPattern(recorded));
30
30
 
31
- return `Generate and verify Playwright test at ${state.outputPath}
31
+ // `state.outputPath` is computed from `state.specPath` by the
32
+ // framework. For `zibby test <spec>` runs it's set. For
33
+ // `workflow trigger` runs there's no spec file on disk, so
34
+ // outputPath comes back undefined and the prompt rendered
35
+ // "Generate and verify Playwright test at undefined" — which
36
+ // caused the LLM to literally write to a file named `undefined`.
37
+ // Fall back to a path under the session dir so the test always
38
+ // lands somewhere sensible.
39
+ const outputPath = state.outputPath
40
+ || (state.sessionPath ? `${state.sessionPath}/generate_script/generated-test.spec.js` : 'tests/generated-test.spec.js');
41
+
42
+ return `Generate and verify Playwright test at ${outputPath}
32
43
 
33
44
  Test Spec:
34
45
  ${state.testSpec}
@@ -85,9 +96,9 @@ RULES:
85
96
 
86
97
  WORKFLOW:
87
98
  1. Study the codebase FIRST — search tests/ for existing helpers, fixtures, and shared setup files. Read them. Reuse what exists. Do NOT create files that duplicate existing ones.
88
- 2. Write test to ${state.outputPath} (after the run, a copy is mirrored under ${state.sessionPath}/generate_script/ for Studio — you may also write directly there if you prefer)
99
+ 2. Write test to ${outputPath} (after the run, a copy is mirrored under ${state.sessionPath}/generate_script/ for Studio — you may also write directly there if you prefer)
89
100
  3. Verify syntax: run node --check on the file. If it fails, fix and re-check before proceeding.
90
- 4. Run: PLAYWRIGHT_HEADLESS=1 npx playwright test ${state.outputPath} --reporter=line --timeout=60000
101
+ 4. Run: PLAYWRIGHT_HEADLESS=1 npx playwright test ${outputPath} --reporter=line --timeout=60000
91
102
  5. If fails: try selectors in order — (a) getByRole (b) getByText (c) getByTestId (d) add waitForSelector. Never retry the same selector twice.
92
103
  6. MAX 2 ATTEMPTS then STOP
93
104