@itmetsam/samurai-framework 0.19.0 → 0.20.0
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/capabilities.d.ts +2 -0
- package/dist/capabilities.js +2 -0
- package/dist/flows/run/index.d.ts +1 -0
- package/dist/flows/run/index.js +1 -0
- package/dist/flows/run/node-folder.d.ts +5 -0
- package/dist/flows/run/node-folder.js +8 -0
- package/dist/flows/run/project.js +2 -2
- package/package.json +1 -1
package/dist/capabilities.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare const CAPABILITIES: {
|
|
|
33
33
|
readonly outputDir: true;
|
|
34
34
|
/** `runFlowInProject`'s `outputDir` gives each node its own folder, `nodes/<node id>/`. */
|
|
35
35
|
readonly flowNodeFolders: true;
|
|
36
|
+
/** `nodeFolder(nodeId)` from `./flows/run`: a flow node's folder under `outputDir`, so an app need not rebuild it. */
|
|
37
|
+
readonly nodeFolder: true;
|
|
36
38
|
/** Assertion matchers version 2: `toBeHidden`, `toBeEnabled`, `toBeChecked`, `toHaveClass` and `toHaveCSS`, in the framework and the step codec. */
|
|
37
39
|
readonly assertionMatchers: 2;
|
|
38
40
|
/** `expect(page).toHaveURL` and `toHaveTitle`, and the `expectPage` step in the step codec. */
|
package/dist/capabilities.js
CHANGED
|
@@ -33,6 +33,8 @@ export const CAPABILITIES = {
|
|
|
33
33
|
outputDir: true,
|
|
34
34
|
/** `runFlowInProject`'s `outputDir` gives each node its own folder, `nodes/<node id>/`. */
|
|
35
35
|
flowNodeFolders: true,
|
|
36
|
+
/** `nodeFolder(nodeId)` from `./flows/run`: a flow node's folder under `outputDir`, so an app need not rebuild it. */
|
|
37
|
+
nodeFolder: true,
|
|
36
38
|
/** Assertion matchers version 2: `toBeHidden`, `toBeEnabled`, `toBeChecked`, `toHaveClass` and `toHaveCSS`, in the framework and the step codec. */
|
|
37
39
|
assertionMatchers: 2,
|
|
38
40
|
/** `expect(page).toHaveURL` and `toHaveTitle`, and the `expectPage` step in the step codec. */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from "./events.js";
|
|
3
3
|
export { HANDLERS } from "./handlers/index.js";
|
|
4
4
|
export type { Handler, HandlerRun, Outcome } from "./handlers/index.js";
|
|
5
|
+
export { nodeFolder } from "./node-folder.js";
|
|
5
6
|
export { runFlow, type RunFlowOptions } from "./run.js";
|
|
6
7
|
export { FLOW_SUFFIX, flowsDir, listFlows, readFlow, readFlowPath, readFlows, } from "./files.js";
|
|
7
8
|
export * from "./report.js";
|
package/dist/flows/run/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Running flows: handlers, the walker, a project's flow files. Node only; see `flows/core` for the pure half. */
|
|
2
2
|
export * from "./events.js";
|
|
3
3
|
export { HANDLERS } from "./handlers/index.js";
|
|
4
|
+
export { nodeFolder } from "./node-folder.js";
|
|
4
5
|
export { runFlow } from "./run.js";
|
|
5
6
|
export { FLOW_SUFFIX, flowsDir, listFlows, readFlow, readFlowPath, readFlows, } from "./files.js";
|
|
6
7
|
export * from "./report.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The folder a flow node's screenshots go in, relative to `runFlowInProject`'s `outputDir`, with `/` separators:
|
|
3
|
+
* `nodes/` and the node id cleaned for a file name. A node's screenshot paths are relative to this folder.
|
|
4
|
+
*/
|
|
5
|
+
export declare function nodeFolder(nodeId: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { cleanName } from "../../browser/evidence.js";
|
|
2
|
+
/**
|
|
3
|
+
* The folder a flow node's screenshots go in, relative to `runFlowInProject`'s `outputDir`, with `/` separators:
|
|
4
|
+
* `nodes/` and the node id cleaned for a file name. A node's screenshot paths are relative to this folder.
|
|
5
|
+
*/
|
|
6
|
+
export function nodeFolder(nodeId) {
|
|
7
|
+
return `nodes/${cleanName(nodeId)}`;
|
|
8
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { cleanName } from "../../browser/evidence.js";
|
|
3
2
|
import { DEFAULT_SRC_DIR } from "../../config/defaults.js";
|
|
4
3
|
import { projectConfig } from "../../config/config.js";
|
|
5
4
|
import { checkFlow, withKeys, } from "../core/index.js";
|
|
@@ -15,6 +14,7 @@ import TestRunner from "../../runner/test-runner.js";
|
|
|
15
14
|
import { WorkerPool } from "../../runner/worker-pool.js";
|
|
16
15
|
import { processWorkerFactory } from "../../runner/worker-process.js";
|
|
17
16
|
import { readFlow } from "./files.js";
|
|
17
|
+
import { nodeFolder } from "./node-folder.js";
|
|
18
18
|
import { itemsOf, runOnPool } from "./node-pool.js";
|
|
19
19
|
import { FlowCheckError, } from "./project-options.js";
|
|
20
20
|
import { projectSteps } from "../steps/set.js";
|
|
@@ -198,7 +198,7 @@ async function walkFlowInProject(options) {
|
|
|
198
198
|
runTests: async ({ nodeId, tests, onEvent, signal, browsers }) => {
|
|
199
199
|
// Each node gets a folder of its own: the same test in two nodes would overwrite its screenshots
|
|
200
200
|
const outputDir = options.outputDir !== undefined
|
|
201
|
-
? path.join(options.outputDir,
|
|
201
|
+
? path.join(options.outputDir, ...nodeFolder(nodeId).split("/"))
|
|
202
202
|
: undefined;
|
|
203
203
|
if (pool)
|
|
204
204
|
return runOnPool(pool, itemsOf(tests, browsers ?? browsersFor({ project: config.browsers }), outputDir), onEvent, signal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itmetsam/samurai-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Browser test framework over WebDriver BiDi: auto-waiting locators, environments and secrets, a recorder, and a command line.",
|
|
5
5
|
"main": "dist/api.js",
|
|
6
6
|
"exports": {
|