@wdio/nightwatch-devtools 1.1.1 → 1.3.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/README.md +66 -1
- package/dist/bidi-OH4ZFDN5.js +215 -0
- package/dist/bidi-OH4ZFDN5.js.map +1 -0
- package/dist/chunk-DKSBYMPM.js +191 -0
- package/dist/chunk-DKSBYMPM.js.map +1 -0
- package/dist/index.d.ts +111 -16
- package/dist/index.js +6253 -770
- package/dist/index.js.map +1 -1
- package/package.json +20 -13
- package/dist/constants.d.ts +0 -55
- package/dist/constants.js +0 -95
- package/dist/constants.js.map +0 -1
- package/dist/helpers/browserProxy.d.ts +0 -46
- package/dist/helpers/browserProxy.js +0 -314
- package/dist/helpers/browserProxy.js.map +0 -1
- package/dist/helpers/capturePerformance.d.ts +0 -5
- package/dist/helpers/capturePerformance.js +0 -53
- package/dist/helpers/capturePerformance.js.map +0 -1
- package/dist/helpers/cucumberHooks.cjs +0 -54
- package/dist/helpers/cucumberHooks.cjs.map +0 -1
- package/dist/helpers/cucumberHooks.d.cts +0 -21
- package/dist/helpers/suiteManager.d.ts +0 -43
- package/dist/helpers/suiteManager.js +0 -143
- package/dist/helpers/suiteManager.js.map +0 -1
- package/dist/helpers/testManager.d.ts +0 -45
- package/dist/helpers/testManager.js +0 -143
- package/dist/helpers/testManager.js.map +0 -1
- package/dist/helpers/utils.d.ts +0 -83
- package/dist/helpers/utils.js +0 -447
- package/dist/helpers/utils.js.map +0 -1
- package/dist/reporter.d.ts +0 -44
- package/dist/reporter.js +0 -185
- package/dist/reporter.js.map +0 -1
- package/dist/session.d.ts +0 -78
- package/dist/session.js +0 -643
- package/dist/session.js.map +0 -1
- package/dist/types.d.ts +0 -190
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Cucumber support file — injected into @cucumber/cucumber's `require` list by
|
|
4
|
-
* the DevTools plugin at runtime. Because Cucumber loads this file itself
|
|
5
|
-
* (via its own require machinery), we are guaranteed to be using the SAME
|
|
6
|
-
* supportCodeLibraryBuilder singleton that the user's step definitions use.
|
|
7
|
-
*
|
|
8
|
-
* Hook ordering:
|
|
9
|
-
* Before {order:1000} → runs AFTER Nightwatch's browser-launch hook (order:0)
|
|
10
|
-
* After {order:-1} → runs AFTER Nightwatch's browser-quit/finalize hook (order:0)
|
|
11
|
-
* (Cucumber After: lower order executes LAST)
|
|
12
|
-
*
|
|
13
|
-
* The After hook MUST run after Nightwatch's own After (order:0) so that
|
|
14
|
-
* `testSuiteFinished` fully propagates assertion failures into `result.status`
|
|
15
|
-
* before we read it. Running at order:1000 (the old value) caused a race where
|
|
16
|
-
* our hook fired BEFORE Nightwatch finalised the session, reading PASSED even
|
|
17
|
-
* when assertions had actually failed.
|
|
18
|
-
*
|
|
19
|
-
* NOTE: This is intentionally a .cts file so TypeScript compiles it as CJS
|
|
20
|
-
* (required by Cucumber's loader when the surrounding package is ESM).
|
|
21
|
-
*/
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
// @cucumber/cucumber is NOT a direct dependency of this package.
|
|
24
|
-
// At runtime this require() is resolved from the user's project (via Cucumber's
|
|
25
|
-
// own loader), so it always gets the same singleton the step definitions use.
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
27
|
-
const { Before, After, BeforeStep, AfterStep } = require('@cucumber/cucumber');
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
29
|
-
const { PLUGIN_GLOBAL_KEY } = require('../constants.js');
|
|
30
|
-
Before({ order: 1000 }, async function ({ pickle }) {
|
|
31
|
-
const plugin = globalThis[PLUGIN_GLOBAL_KEY];
|
|
32
|
-
if (this.browser && plugin) {
|
|
33
|
-
await plugin.cucumberBefore(this.browser, pickle);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
After({ order: -1 }, async function ({ result, pickle }) {
|
|
37
|
-
const plugin = globalThis[PLUGIN_GLOBAL_KEY];
|
|
38
|
-
if (this.browser && plugin) {
|
|
39
|
-
await plugin.cucumberAfter(this.browser, result, pickle);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
BeforeStep({ order: 1000 }, async function ({ pickleStep, pickle }) {
|
|
43
|
-
const plugin = globalThis[PLUGIN_GLOBAL_KEY];
|
|
44
|
-
if (this.browser && plugin) {
|
|
45
|
-
await plugin.cucumberBeforeStep(this.browser, pickleStep, pickle);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
AfterStep({ order: 1000 }, async function ({ result, pickleStep, pickle }) {
|
|
49
|
-
const plugin = globalThis[PLUGIN_GLOBAL_KEY];
|
|
50
|
-
if (this.browser && plugin) {
|
|
51
|
-
await plugin.cucumberAfterStep(this.browser, result, pickleStep, pickle);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=cucumberHooks.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cucumberHooks.cjs","sourceRoot":"","sources":["../../src/helpers/cucumberHooks.cts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAaH,iEAAiE;AACjE,gFAAgF;AAChF,8EAA8E;AAC9E,8DAA8D;AAC9D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAgB,CAAA;AAE7F,8DAA8D;AAC9D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAkC,CAAA;AAUzF,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,WAAsB,EAAE,MAAM,EAAO;IAChE,MAAM,MAAM,GAAI,UAAkB,CAAC,iBAAiB,CAAqC,CAAA;IACzF,IAAI,IAAI,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC;QAC3B,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/cucumber's `require` list by
|
|
3
|
-
* the DevTools plugin at runtime. Because Cucumber loads this file itself
|
|
4
|
-
* (via its own require machinery), we are guaranteed to be using the SAME
|
|
5
|
-
* supportCodeLibraryBuilder singleton that the user's step definitions use.
|
|
6
|
-
*
|
|
7
|
-
* Hook ordering:
|
|
8
|
-
* Before {order:1000} → runs AFTER Nightwatch's browser-launch hook (order:0)
|
|
9
|
-
* After {order:-1} → runs AFTER Nightwatch's browser-quit/finalize hook (order:0)
|
|
10
|
-
* (Cucumber After: lower order executes LAST)
|
|
11
|
-
*
|
|
12
|
-
* The After hook MUST run after Nightwatch's own After (order:0) so that
|
|
13
|
-
* `testSuiteFinished` fully propagates assertion failures into `result.status`
|
|
14
|
-
* before we read it. Running at order:1000 (the old value) caused a race where
|
|
15
|
-
* our hook fired BEFORE Nightwatch finalised the session, reading PASSED even
|
|
16
|
-
* when assertions had actually failed.
|
|
17
|
-
*
|
|
18
|
-
* NOTE: This is intentionally a .cts file so TypeScript compiles it as CJS
|
|
19
|
-
* (required by Cucumber's loader when the surrounding package is ESM).
|
|
20
|
-
*/
|
|
21
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Suite Manager
|
|
3
|
-
* Handles test suite creation and management
|
|
4
|
-
*/
|
|
5
|
-
import type { SuiteStats } from '../types.js';
|
|
6
|
-
import type { TestReporter } from '../reporter.js';
|
|
7
|
-
export declare class SuiteManager {
|
|
8
|
-
private testReporter;
|
|
9
|
-
private currentSuiteByFile;
|
|
10
|
-
constructor(testReporter: TestReporter);
|
|
11
|
-
/**
|
|
12
|
-
* Clear execution data when a rerun starts.
|
|
13
|
-
* Resets all cached suites so they're recreated fresh during the new run.
|
|
14
|
-
*/
|
|
15
|
-
clearExecutionData(): void;
|
|
16
|
-
/**
|
|
17
|
-
* Get or create suite for a test file
|
|
18
|
-
*/
|
|
19
|
-
getOrCreateSuite(testFile: string, suiteTitle: string, fullPath: string | null, testNames: string[], suiteLine?: number | null, testLines?: number[]): SuiteStats;
|
|
20
|
-
/**
|
|
21
|
-
* Get suite for a test file
|
|
22
|
-
*/
|
|
23
|
-
getSuite(testFile: string): SuiteStats | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Mark suite as running.
|
|
26
|
-
* Clears `end` so that the `finalizeSuite` guard (`if (suite.end) return`)
|
|
27
|
-
* does not skip re-finalization during a rerun.
|
|
28
|
-
*/
|
|
29
|
-
markSuiteAsRunning(suite: SuiteStats): void;
|
|
30
|
-
/**
|
|
31
|
-
* Update suite state from current children without marking it as ended.
|
|
32
|
-
* Used during Cucumber runs to keep the feature-level suite state fresh.
|
|
33
|
-
*/
|
|
34
|
-
finalizeSuiteState(suite: SuiteStats): void;
|
|
35
|
-
/**
|
|
36
|
-
* Finalize suite with test results
|
|
37
|
-
*/
|
|
38
|
-
finalizeSuite(suite: SuiteStats): void;
|
|
39
|
-
/**
|
|
40
|
-
* Get all suites
|
|
41
|
-
*/
|
|
42
|
-
getAllSuites(): Map<string, SuiteStats>;
|
|
43
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Suite Manager
|
|
3
|
-
* Handles test suite creation and management
|
|
4
|
-
*/
|
|
5
|
-
import { DEFAULTS, TEST_STATE } from '../constants.js';
|
|
6
|
-
import { generateStableUid } from './utils.js';
|
|
7
|
-
export class SuiteManager {
|
|
8
|
-
testReporter;
|
|
9
|
-
currentSuiteByFile = new Map();
|
|
10
|
-
constructor(testReporter) {
|
|
11
|
-
this.testReporter = testReporter;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Clear execution data when a rerun starts.
|
|
15
|
-
* Resets all cached suites so they're recreated fresh during the new run.
|
|
16
|
-
*/
|
|
17
|
-
clearExecutionData() {
|
|
18
|
-
this.currentSuiteByFile.clear();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get or create suite for a test file
|
|
22
|
-
*/
|
|
23
|
-
getOrCreateSuite(testFile, suiteTitle, fullPath, testNames, suiteLine, testLines) {
|
|
24
|
-
if (!this.currentSuiteByFile.has(testFile)) {
|
|
25
|
-
const suiteStats = {
|
|
26
|
-
uid: '',
|
|
27
|
-
cid: DEFAULTS.CID,
|
|
28
|
-
title: suiteTitle,
|
|
29
|
-
fullTitle: suiteTitle,
|
|
30
|
-
file: fullPath || testFile,
|
|
31
|
-
type: 'suite',
|
|
32
|
-
start: new Date(),
|
|
33
|
-
state: TEST_STATE.PENDING,
|
|
34
|
-
end: null,
|
|
35
|
-
tests: [],
|
|
36
|
-
suites: [],
|
|
37
|
-
hooks: [],
|
|
38
|
-
_duration: DEFAULTS.DURATION,
|
|
39
|
-
callSource: suiteLine && fullPath ? `${fullPath}:${suiteLine}` : undefined
|
|
40
|
-
};
|
|
41
|
-
suiteStats.uid = generateStableUid(suiteStats.file, suiteStats.title);
|
|
42
|
-
// Create test entries with pending state
|
|
43
|
-
if (testNames.length > 0) {
|
|
44
|
-
for (let idx = 0; idx < testNames.length; idx++) {
|
|
45
|
-
const testName = testNames[idx];
|
|
46
|
-
const testLine = testLines?.[idx];
|
|
47
|
-
const fullTitle = `${suiteTitle} ${testName}`;
|
|
48
|
-
const testUid = generateStableUid(fullPath || testFile, fullTitle);
|
|
49
|
-
const testEntry = {
|
|
50
|
-
uid: testUid,
|
|
51
|
-
cid: DEFAULTS.CID,
|
|
52
|
-
title: testName,
|
|
53
|
-
fullTitle: fullTitle,
|
|
54
|
-
parent: suiteStats.uid,
|
|
55
|
-
state: TEST_STATE.PENDING,
|
|
56
|
-
start: new Date(),
|
|
57
|
-
end: null,
|
|
58
|
-
type: 'test',
|
|
59
|
-
file: fullPath || testFile,
|
|
60
|
-
retries: DEFAULTS.RETRIES,
|
|
61
|
-
_duration: DEFAULTS.DURATION,
|
|
62
|
-
hooks: [],
|
|
63
|
-
callSource: testLine && fullPath ? `${fullPath}:${testLine}` : undefined
|
|
64
|
-
};
|
|
65
|
-
suiteStats.tests.push(testEntry);
|
|
66
|
-
}
|
|
67
|
-
// Don't send updates here - onSuiteStart will send it
|
|
68
|
-
}
|
|
69
|
-
this.currentSuiteByFile.set(testFile, suiteStats);
|
|
70
|
-
this.testReporter.onSuiteStart(suiteStats);
|
|
71
|
-
}
|
|
72
|
-
return this.currentSuiteByFile.get(testFile);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Get suite for a test file
|
|
76
|
-
*/
|
|
77
|
-
getSuite(testFile) {
|
|
78
|
-
return this.currentSuiteByFile.get(testFile);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Mark suite as running.
|
|
82
|
-
* Clears `end` so that the `finalizeSuite` guard (`if (suite.end) return`)
|
|
83
|
-
* does not skip re-finalization during a rerun.
|
|
84
|
-
*/
|
|
85
|
-
markSuiteAsRunning(suite) {
|
|
86
|
-
suite.state = TEST_STATE.RUNNING;
|
|
87
|
-
suite.end = null;
|
|
88
|
-
this.testReporter.updateSuites();
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Update suite state from current children without marking it as ended.
|
|
92
|
-
* Used during Cucumber runs to keep the feature-level suite state fresh.
|
|
93
|
-
*/
|
|
94
|
-
finalizeSuiteState(suite) {
|
|
95
|
-
const hasFailures = suite.tests.some((t) => t.state === TEST_STATE.FAILED) ||
|
|
96
|
-
suite.suites.some((s) => s.state === TEST_STATE.FAILED);
|
|
97
|
-
const hasRunning = suite.tests.some((t) => t.state === TEST_STATE.RUNNING) ||
|
|
98
|
-
suite.suites.some((s) => s.state === TEST_STATE.RUNNING || !s.end);
|
|
99
|
-
suite.state = hasFailures
|
|
100
|
-
? TEST_STATE.FAILED
|
|
101
|
-
: hasRunning
|
|
102
|
-
? TEST_STATE.RUNNING
|
|
103
|
-
: TEST_STATE.PASSED;
|
|
104
|
-
this.testReporter.updateSuites();
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Finalize suite with test results
|
|
108
|
-
*/
|
|
109
|
-
finalizeSuite(suite) {
|
|
110
|
-
if (suite.end) {
|
|
111
|
-
return;
|
|
112
|
-
} // Already finalized
|
|
113
|
-
suite.end = new Date();
|
|
114
|
-
suite._duration = suite.end.getTime() - (suite.start?.getTime() || 0);
|
|
115
|
-
// Check direct tests
|
|
116
|
-
const hasFailures = suite.tests.some((t) => t.state === TEST_STATE.FAILED) ||
|
|
117
|
-
suite.suites.some((s) => s.state === TEST_STATE.FAILED);
|
|
118
|
-
const allPassed = suite.tests.every((t) => t.state === TEST_STATE.PASSED || t.state === TEST_STATE.SKIPPED) &&
|
|
119
|
-
suite.suites.every((s) => s.state === TEST_STATE.PASSED || s.state === TEST_STATE.SKIPPED);
|
|
120
|
-
const hasSkipped = suite.tests.some((t) => t.state === TEST_STATE.SKIPPED);
|
|
121
|
-
const hasItems = suite.tests.length > 0 || suite.suites.length > 0;
|
|
122
|
-
if (hasFailures) {
|
|
123
|
-
suite.state = TEST_STATE.FAILED;
|
|
124
|
-
}
|
|
125
|
-
else if (!hasItems || allPassed) {
|
|
126
|
-
suite.state = TEST_STATE.PASSED;
|
|
127
|
-
}
|
|
128
|
-
else if (hasSkipped) {
|
|
129
|
-
suite.state = TEST_STATE.PASSED;
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
suite.state = TEST_STATE.FAILED;
|
|
133
|
-
}
|
|
134
|
-
this.testReporter.onSuiteEnd(suite);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Get all suites
|
|
138
|
-
*/
|
|
139
|
-
getAllSuites() {
|
|
140
|
-
return this.currentSuiteByFile;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=suiteManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suiteManager.js","sourceRoot":"","sources":["../../src/helpers/suiteManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGtD,OAAO,EAA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AI,SAAS,EAAE,CAAC;YAClC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAA;QACjC,CAAC;aAAM,IAAI,UAAU,EAAE,CAAC;YACtB,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAA;QACjC,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type TestStats, type SuiteStats, type NightwatchTestCase } from '../types.js';
|
|
2
|
-
import type { TestReporter } from '../reporter.js';
|
|
3
|
-
export declare class TestManager {
|
|
4
|
-
private testReporter;
|
|
5
|
-
private processedTests;
|
|
6
|
-
private lastKnownTestName;
|
|
7
|
-
constructor(testReporter: TestReporter);
|
|
8
|
-
/**
|
|
9
|
-
* Update test state and report to UI
|
|
10
|
-
*/
|
|
11
|
-
updateTestState(test: TestStats, state: TestStats['state'], endTime?: Date, duration?: number): void;
|
|
12
|
-
/**
|
|
13
|
-
* Find test in suite by title
|
|
14
|
-
*/
|
|
15
|
-
findTestInSuite(suite: SuiteStats, testTitle: string): TestStats | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Mark test as processed to avoid duplicate reporting
|
|
18
|
-
*/
|
|
19
|
-
markTestAsProcessed(testFile: string, testTitle: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* Check if test has been processed
|
|
22
|
-
*/
|
|
23
|
-
isTestProcessed(testFile: string, testTitle: string): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Get processed tests for a file
|
|
26
|
-
*/
|
|
27
|
-
getProcessedTests(testFile: string): Set<string>;
|
|
28
|
-
/**
|
|
29
|
-
* Detect test boundary and finalize previous test if needed
|
|
30
|
-
* Returns the current test name
|
|
31
|
-
*/
|
|
32
|
-
detectTestBoundary(currentNightwatchTest: any): string;
|
|
33
|
-
/**
|
|
34
|
-
* Start a pending test if this is its first command
|
|
35
|
-
*/
|
|
36
|
-
startTestIfPending(currentTestName: string): void;
|
|
37
|
-
/**
|
|
38
|
-
* Finalize all incomplete tests in a suite
|
|
39
|
-
*/
|
|
40
|
-
finalizeSuiteTests(suite: SuiteStats, testcases: Record<string, NightwatchTestCase>): void;
|
|
41
|
-
/**
|
|
42
|
-
* Reset internal state for new test files
|
|
43
|
-
*/
|
|
44
|
-
reset(): void;
|
|
45
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { TEST_STATE, DEFAULTS } from '../constants.js';
|
|
2
|
-
import { determineTestState } from './utils.js';
|
|
3
|
-
export class TestManager {
|
|
4
|
-
testReporter;
|
|
5
|
-
processedTests = new Map();
|
|
6
|
-
lastKnownTestName = null;
|
|
7
|
-
constructor(testReporter) {
|
|
8
|
-
this.testReporter = testReporter;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Update test state and report to UI
|
|
12
|
-
*/
|
|
13
|
-
updateTestState(test, state, endTime, duration) {
|
|
14
|
-
test.state = state;
|
|
15
|
-
if (endTime) {
|
|
16
|
-
test.end = endTime;
|
|
17
|
-
}
|
|
18
|
-
if (duration !== undefined) {
|
|
19
|
-
test._duration = duration;
|
|
20
|
-
}
|
|
21
|
-
if (state === TEST_STATE.PASSED) {
|
|
22
|
-
this.testReporter.onTestEnd(test);
|
|
23
|
-
}
|
|
24
|
-
else if (state === TEST_STATE.FAILED) {
|
|
25
|
-
this.testReporter.onTestEnd(test);
|
|
26
|
-
}
|
|
27
|
-
else if (state === TEST_STATE.RUNNING) {
|
|
28
|
-
this.testReporter.onTestStart(test);
|
|
29
|
-
}
|
|
30
|
-
if (state !== TEST_STATE.RUNNING) {
|
|
31
|
-
this.testReporter.onTestEnd(test);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Find test in suite by title
|
|
36
|
-
*/
|
|
37
|
-
findTestInSuite(suite, testTitle) {
|
|
38
|
-
return suite.tests.find((t) => typeof t !== 'string' && t.title === testTitle);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Mark test as processed to avoid duplicate reporting
|
|
42
|
-
*/
|
|
43
|
-
markTestAsProcessed(testFile, testTitle) {
|
|
44
|
-
if (!this.processedTests.has(testFile)) {
|
|
45
|
-
this.processedTests.set(testFile, new Set());
|
|
46
|
-
}
|
|
47
|
-
this.processedTests.get(testFile).add(testTitle);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Check if test has been processed
|
|
51
|
-
*/
|
|
52
|
-
isTestProcessed(testFile, testTitle) {
|
|
53
|
-
return this.processedTests.get(testFile)?.has(testTitle) ?? false;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get processed tests for a file
|
|
57
|
-
*/
|
|
58
|
-
getProcessedTests(testFile) {
|
|
59
|
-
return this.processedTests.get(testFile) || new Set();
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Detect test boundary and finalize previous test if needed
|
|
63
|
-
* Returns the current test name
|
|
64
|
-
*/
|
|
65
|
-
detectTestBoundary(currentNightwatchTest) {
|
|
66
|
-
const currentTestName = currentNightwatchTest?.name || DEFAULTS.TEST_NAME;
|
|
67
|
-
// If test name changed, finalize previous test
|
|
68
|
-
if (this.lastKnownTestName &&
|
|
69
|
-
currentTestName !== this.lastKnownTestName &&
|
|
70
|
-
currentTestName !== DEFAULTS.TEST_NAME) {
|
|
71
|
-
const testFile = currentNightwatchTest.module?.split('/').pop() || DEFAULTS.FILE_NAME;
|
|
72
|
-
const currentSuite = this.testReporter.getCurrentSuite();
|
|
73
|
-
if (currentSuite) {
|
|
74
|
-
const prevTest = this.findTestInSuite(currentSuite, this.lastKnownTestName);
|
|
75
|
-
if (prevTest && prevTest.state === TEST_STATE.RUNNING) {
|
|
76
|
-
const prevTestCase = currentNightwatchTest.results?.testcases?.[this.lastKnownTestName];
|
|
77
|
-
if (prevTestCase) {
|
|
78
|
-
const testState = determineTestState(prevTestCase);
|
|
79
|
-
this.updateTestState(prevTest, testState, new Date(), parseFloat(prevTestCase.time || '0') * 1000);
|
|
80
|
-
this.markTestAsProcessed(testFile, this.lastKnownTestName);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// Update last known test name
|
|
86
|
-
if (currentTestName !== DEFAULTS.TEST_NAME) {
|
|
87
|
-
this.lastKnownTestName = currentTestName;
|
|
88
|
-
}
|
|
89
|
-
return currentTestName;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Start a pending test if this is its first command
|
|
93
|
-
*/
|
|
94
|
-
startTestIfPending(currentTestName) {
|
|
95
|
-
if (currentTestName === DEFAULTS.TEST_NAME ||
|
|
96
|
-
this.lastKnownTestName !== currentTestName) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const currentSuite = this.testReporter.getCurrentSuite();
|
|
100
|
-
if (!currentSuite) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const test = this.findTestInSuite(currentSuite, currentTestName);
|
|
104
|
-
if (test && test.state === TEST_STATE.PENDING) {
|
|
105
|
-
test.start = new Date();
|
|
106
|
-
test.end = null;
|
|
107
|
-
this.updateTestState(test, TEST_STATE.RUNNING);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Finalize all incomplete tests in a suite
|
|
112
|
-
*/
|
|
113
|
-
finalizeSuiteTests(suite, testcases) {
|
|
114
|
-
suite.tests.forEach((test) => {
|
|
115
|
-
if (test.state === TEST_STATE.RUNNING && test.start) {
|
|
116
|
-
// Test was started but never finished - assume passed
|
|
117
|
-
test.state = TEST_STATE.PASSED;
|
|
118
|
-
test.end = new Date();
|
|
119
|
-
test._duration = test.end.getTime() - (test.start?.getTime() || 0);
|
|
120
|
-
this.updateTestState(test, TEST_STATE.PASSED);
|
|
121
|
-
}
|
|
122
|
-
else if (test.state === TEST_STATE.PENDING) {
|
|
123
|
-
const testcase = testcases[test.title];
|
|
124
|
-
if (testcase) {
|
|
125
|
-
const testState = determineTestState(testcase);
|
|
126
|
-
test.start = test.start || new Date();
|
|
127
|
-
this.updateTestState(test, testState, new Date(), parseFloat(testcase.time || '0') * 1000);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
// Test never ran - mark as skipped
|
|
131
|
-
this.updateTestState(test, TEST_STATE.SKIPPED, new Date(), 0);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Reset internal state for new test files
|
|
138
|
-
*/
|
|
139
|
-
reset() {
|
|
140
|
-
this.lastKnownTestName = null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=testManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testManager.js","sourceRoot":"","sources":["../../src/helpers/testManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAMtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/C,MAAM,OAAO,WAAW;IAIF;IAHZ,cAAc,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC/C,iBAAiB,GAAkB,IAAI,CAAA;IAE/C,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAElD;;OAEG;IACH,eAAe,CACb,IAAe,EACf,KAAyB,EACzB,OAAc,EACd,QAAiB;QAEjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,GAAG,GAAG,OAAO,CAAA;QACpB,CAAC;QACD,IAAI,QAAQ,KAAK,SAA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,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;gBAClE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,MAA4B,CAAC,CAAA;YACrE,CAAC;iBAAM,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC;gBAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACtC,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,EAAE,CAAA;oBACrC,IAAI,CAAC,eAAe,CAClB,IAAI,EACJ,SAAS,EACT,IAAI,IAAI,EAAE,EACV,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,CACxC,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,mCAAmC;oBACnC,IAAI,CAAC,eAAe,CAClB,IAAI,EACJ,UAAU,CAAC,OAA6B,EACxC,IAAI,IAAI,EAAE,EACV,CAAC,CACF,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;IAC/B,CAAC;CACF"}
|
package/dist/helpers/utils.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { ConsoleLog, LogLevel, NightwatchTestCase, TestFileMetadata, StepLocation } from '../types.js';
|
|
2
|
-
export declare function determineTestState(testcase: NightwatchTestCase): 'passed' | 'failed' | 'skipped';
|
|
3
|
-
/**
|
|
4
|
-
* Generate stable UID for test/suite.
|
|
5
|
-
* Accepts either (item: SuiteStats | TestStats) or (file: string, name: string).
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateStableUid(itemOrFile: any, name?: string): string;
|
|
8
|
-
/** Reset counters at the start of each test run. */
|
|
9
|
-
export declare function resetSignatureCounters(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Compute a purely deterministic UID from arbitrary string parts.
|
|
12
|
-
* Unlike generateStableUid this NEVER uses the signature counter, so calling
|
|
13
|
-
* it multiple times with the same inputs always returns the same value.
|
|
14
|
-
* Use this wherever the same entity (e.g. a Cucumber scenario) must map to
|
|
15
|
-
* the same UID across retries.
|
|
16
|
-
*/
|
|
17
|
-
export declare function deterministicUid(...parts: string[]): string;
|
|
18
|
-
/**
|
|
19
|
-
* Find test file from stack trace.
|
|
20
|
-
* Parses call stack to find the first frame that looks like a test file.
|
|
21
|
-
*/
|
|
22
|
-
export declare function findTestFileFromStack(): string | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Extract suite and test names — and their line numbers — from a test file.
|
|
25
|
-
* Returns a TestFileMetadata object used to build `callSource` strings for
|
|
26
|
-
* the TestLens eye-icon navigation.
|
|
27
|
-
*/
|
|
28
|
-
export declare function extractTestMetadata(filePath: string): TestFileMetadata;
|
|
29
|
-
/**
|
|
30
|
-
* Get call source info from stack trace.
|
|
31
|
-
* Returns { filePath, callSource } where callSource has the filename:line format.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getCallSourceFromStack(): {
|
|
34
|
-
filePath: string | undefined;
|
|
35
|
-
callSource: string;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Find test file by searching the workspace for a matching filename.
|
|
39
|
-
* Used when the stack trace doesn't have the file yet (e.g. in beforeEach).
|
|
40
|
-
*/
|
|
41
|
-
export declare function findTestFileByName(filename: string, workspaceRoot?: string): string | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Strip ANSI escape codes from a string.
|
|
44
|
-
*/
|
|
45
|
-
export declare const stripAnsiCodes: (text: string) => string;
|
|
46
|
-
/** Infer a log level from the text content of a line. */
|
|
47
|
-
export declare function detectLogLevel(text: string): LogLevel;
|
|
48
|
-
/**
|
|
49
|
-
* Build a ConsoleLog entry.
|
|
50
|
-
*/
|
|
51
|
-
export declare function createConsoleLogEntry(type: LogLevel, args: any[], source: string): ConsoleLog;
|
|
52
|
-
/** Map a Chrome DevTools log level string to our LogLevel union. */
|
|
53
|
-
export declare function chromeLogLevelToLogLevel(level: string | {
|
|
54
|
-
value?: number;
|
|
55
|
-
name?: string;
|
|
56
|
-
}): LogLevel;
|
|
57
|
-
/** Derive a human-readable request type from URL and MIME type. */
|
|
58
|
-
export declare function getRequestType(url: string, mimeType?: string): string;
|
|
59
|
-
/**
|
|
60
|
-
* Parse a feature file for a given scenario in a single pass, returning:
|
|
61
|
-
* - `featureLine` — 1-based line of the `Feature:` declaration
|
|
62
|
-
* - `scenarioLine` — 1-based line of the matching `Scenario:` block
|
|
63
|
-
* - `stepLines` — 1-based line numbers for each step (for TestLens navigation)
|
|
64
|
-
* - `stepKeywords` — BDD keyword (Given/When/Then/And/But) for each step (for labels)
|
|
65
|
-
*/
|
|
66
|
-
export declare function parseCucumberScenario(featureContent: string, scenarioName: string, stepTexts: string[]): {
|
|
67
|
-
featureLine: number;
|
|
68
|
-
scenarioLine: number;
|
|
69
|
-
stepLines: number[];
|
|
70
|
-
stepKeywords: string[];
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Find the file and 1-based line number of the step definition that matches
|
|
74
|
-
* the given step text. Searches the provided step definition files in order.
|
|
75
|
-
* Handles both string/Cucumber-expression patterns and regex literals.
|
|
76
|
-
*/
|
|
77
|
-
export declare function findStepDefinitionLine(stepDefFiles: Array<{
|
|
78
|
-
filePath: string;
|
|
79
|
-
content: string;
|
|
80
|
-
}>, stepText: string): StepLocation | null;
|
|
81
|
-
export declare function isPortInUse(port: number, hostname: string): Promise<boolean>;
|
|
82
|
-
export declare function findFreePort(startPort: number, hostname: string): Promise<number>;
|
|
83
|
-
export declare function resolveNightwatchConfig(): string | undefined;
|