@zohodesk/testinglibrary 0.0.63-n20-experimental → 0.0.65-n20-experimental
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/build/core/playwright/builtInFixtures/context.js +36 -3
- package/build/core/playwright/constants/reporterConstants.js +0 -1
- package/build/core/playwright/helpers/logCollector.js +153 -0
- package/build/core/playwright/readConfigFile.js +7 -1
- package/build/core/playwright/report-generator.js +42 -0
- package/build/core/playwright/setup/custom-reporter.js +87 -1
- package/build/lib/cli.js +7 -30
- package/build/utils/commonUtils.js +0 -9
- package/npm-shrinkwrap.json +3878 -7944
- package/package.json +11 -22
- package/unit_reports/unit-report.html +277 -0
- package/build/core/playwright/reporter/PlaywrightReporter.js +0 -44
- package/build/core/playwright/reporter/UnitReporter.js +0 -27
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
7
9
|
var _readConfigFile = require("../readConfigFile");
|
|
10
|
+
var _logCollector = require("../helpers/logCollector");
|
|
8
11
|
const {
|
|
9
|
-
testSetup
|
|
12
|
+
testSetup,
|
|
13
|
+
uatDirectory,
|
|
14
|
+
runtimeLogs = {}
|
|
10
15
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
16
|
+
|
|
17
|
+
// Keep runtime logs OUTSIDE reportPath (HTML reporter wipes it on onEnd) and
|
|
18
|
+
// outside test-results (Playwright outputDir is cleaned each run).
|
|
19
|
+
const LOGS_DIR = _path.default.join(uatDirectory, 'runtime-logs');
|
|
11
20
|
async function performDefaultContextSteps({
|
|
12
21
|
context
|
|
13
22
|
}) {
|
|
@@ -20,13 +29,37 @@ async function performDefaultContextSteps({
|
|
|
20
29
|
var _default = exports.default = {
|
|
21
30
|
context: async ({
|
|
22
31
|
context
|
|
23
|
-
}, use) => {
|
|
32
|
+
}, use, testInfo) => {
|
|
24
33
|
await context.addInitScript(() =>
|
|
25
34
|
// eslint-disable-next-line no-undef
|
|
26
35
|
window.localStorage.setItem('isDnBannerHide', true));
|
|
27
36
|
await performDefaultContextSteps({
|
|
28
37
|
context
|
|
29
38
|
});
|
|
30
|
-
|
|
39
|
+
const collector = new _logCollector.LogCollector(runtimeLogs.limits);
|
|
40
|
+
collector.attachToContext(context);
|
|
41
|
+
testInfo.runtimeLogs = collector;
|
|
42
|
+
try {
|
|
43
|
+
await use(context);
|
|
44
|
+
} finally {
|
|
45
|
+
collector.detach();
|
|
46
|
+
const failureOnly = runtimeLogs.mode === 'failure-only';
|
|
47
|
+
const isFailure = testInfo.status && testInfo.status !== testInfo.expectedStatus;
|
|
48
|
+
const shouldFlush = !failureOnly || isFailure;
|
|
49
|
+
const summary = collector.toSummary();
|
|
50
|
+
let filePath = null;
|
|
51
|
+
if (shouldFlush) {
|
|
52
|
+
const base = `w${testInfo.workerIndex}-${testInfo.testId}-${testInfo.retry}`;
|
|
53
|
+
filePath = collector.flushToFile(LOGS_DIR, base);
|
|
54
|
+
}
|
|
55
|
+
await testInfo.attach('runtime-log', {
|
|
56
|
+
contentType: 'application/json',
|
|
57
|
+
body: Buffer.from(JSON.stringify({
|
|
58
|
+
schemaVersion: 1,
|
|
59
|
+
summary,
|
|
60
|
+
file: filePath
|
|
61
|
+
}))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
31
64
|
}
|
|
32
65
|
};
|
|
@@ -11,6 +11,5 @@ const stage = (0, _ConfigurationHelper.getRunStage)();
|
|
|
11
11
|
class ReporterConstants {
|
|
12
12
|
static DEFAULT_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/playwright-test-results.json`;
|
|
13
13
|
static LAST_RUN_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/.last-run.json`;
|
|
14
|
-
static DEFAULT_UNIT_TEST_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/unit-test/unit_reports/report.html`;
|
|
15
14
|
}
|
|
16
15
|
exports.default = ReporterConstants;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LogCollector = void 0;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _fileUtils = require("../../../utils/fileUtils");
|
|
10
|
+
// Per-context Playwright runtime event collector — network failures,
|
|
11
|
+
// console errors, page errors and crashes. Buffered in-memory and flushed
|
|
12
|
+
// once per test via writeFileContents.
|
|
13
|
+
|
|
14
|
+
const DEFAULT_LIMITS = {
|
|
15
|
+
maxEvents: 2000,
|
|
16
|
+
maxBodyBytes: 0,
|
|
17
|
+
captureHeaders: false,
|
|
18
|
+
ignoreUrlPatterns: [/\.(png|jpe?g|gif|svg|webp|woff2?|ttf|css|map)(\?|$)/i, /google-analytics\.com|googletagmanager\.com|sentry\.io/i]
|
|
19
|
+
};
|
|
20
|
+
class LogCollector {
|
|
21
|
+
constructor(opts = {}) {
|
|
22
|
+
this.limits = {
|
|
23
|
+
...DEFAULT_LIMITS,
|
|
24
|
+
...opts
|
|
25
|
+
};
|
|
26
|
+
this.events = [];
|
|
27
|
+
this.truncated = false;
|
|
28
|
+
this.counts = {
|
|
29
|
+
console: 0,
|
|
30
|
+
consoleError: 0,
|
|
31
|
+
pageError: 0,
|
|
32
|
+
request: 0,
|
|
33
|
+
response: 0,
|
|
34
|
+
failed: 0,
|
|
35
|
+
crash: 0
|
|
36
|
+
};
|
|
37
|
+
this._bound = [];
|
|
38
|
+
}
|
|
39
|
+
_push(evt) {
|
|
40
|
+
if (this.events.length >= this.limits.maxEvents) {
|
|
41
|
+
this.truncated = true;
|
|
42
|
+
this.events.shift();
|
|
43
|
+
}
|
|
44
|
+
this.events.push({
|
|
45
|
+
ts: Date.now(),
|
|
46
|
+
...evt
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
_shouldIgnore(url) {
|
|
50
|
+
return this.limits.ignoreUrlPatterns.some(re => re.test(url));
|
|
51
|
+
}
|
|
52
|
+
_bind(target, event, handler) {
|
|
53
|
+
target.on(event, handler);
|
|
54
|
+
this._bound.push([target, event, handler]);
|
|
55
|
+
}
|
|
56
|
+
attachToContext(context) {
|
|
57
|
+
context.pages().forEach(p => this._attachPage(p));
|
|
58
|
+
this._bind(context, 'page', p => this._attachPage(p));
|
|
59
|
+
this._bind(context, 'request', req => {
|
|
60
|
+
if (this._shouldIgnore(req.url())) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.counts.request++;
|
|
64
|
+
});
|
|
65
|
+
this._bind(context, 'response', res => {
|
|
66
|
+
const url = res.url();
|
|
67
|
+
if (this._shouldIgnore(url)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.counts.response++;
|
|
71
|
+
if (res.status() >= 400) {
|
|
72
|
+
this._push({
|
|
73
|
+
kind: 'response',
|
|
74
|
+
status: res.status(),
|
|
75
|
+
method: res.request().method(),
|
|
76
|
+
url,
|
|
77
|
+
fromCache: res.fromServiceWorker()
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this._bind(context, 'requestfailed', req => {
|
|
82
|
+
var _req$failure;
|
|
83
|
+
this.counts.failed++;
|
|
84
|
+
this._push({
|
|
85
|
+
kind: 'requestfailed',
|
|
86
|
+
method: req.method(),
|
|
87
|
+
url: req.url(),
|
|
88
|
+
failure: (_req$failure = req.failure()) === null || _req$failure === void 0 ? void 0 : _req$failure.errorText,
|
|
89
|
+
resourceType: req.resourceType()
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
_attachPage(page) {
|
|
94
|
+
this._bind(page, 'console', msg => {
|
|
95
|
+
const type = msg.type();
|
|
96
|
+
this.counts.console++;
|
|
97
|
+
if (type !== 'error') {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.counts.consoleError++;
|
|
101
|
+
this._push({
|
|
102
|
+
kind: 'console',
|
|
103
|
+
level: type,
|
|
104
|
+
text: msg.text(),
|
|
105
|
+
location: msg.location()
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
this._bind(page, 'pageerror', err => {
|
|
109
|
+
this.counts.pageError++;
|
|
110
|
+
this._push({
|
|
111
|
+
kind: 'pageerror',
|
|
112
|
+
name: err.name,
|
|
113
|
+
message: err.message,
|
|
114
|
+
stack: err.stack
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
this._bind(page, 'crash', () => {
|
|
118
|
+
this.counts.crash++;
|
|
119
|
+
this._push({
|
|
120
|
+
kind: 'crash',
|
|
121
|
+
url: page.url()
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
detach() {
|
|
126
|
+
for (const [target, event, handler] of this._bound) {
|
|
127
|
+
try {
|
|
128
|
+
target.removeListener(event, handler);
|
|
129
|
+
} catch {
|
|
130
|
+
// context may already be closed
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this._bound.length = 0;
|
|
134
|
+
}
|
|
135
|
+
toSummary() {
|
|
136
|
+
return {
|
|
137
|
+
...this.counts,
|
|
138
|
+
total: this.events.length,
|
|
139
|
+
truncated: this.truncated
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
flushToFile(dir, baseName) {
|
|
143
|
+
if (this.events.length === 0) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
const file = _path.default.join(dir, `${baseName}.jsonl`);
|
|
147
|
+
const body = this.events.map(e => JSON.stringify(e)).join('\n') + '\n';
|
|
148
|
+
(0, _fileUtils.writeFileContents)(file, body);
|
|
149
|
+
this.events.length = 0;
|
|
150
|
+
return file;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.LogCollector = LogCollector;
|
|
@@ -55,7 +55,11 @@ function getDefaultConfig() {
|
|
|
55
55
|
featureFilesFolder: 'feature-files',
|
|
56
56
|
stepDefinitionsFolder: 'steps',
|
|
57
57
|
testSetup: {},
|
|
58
|
-
editionOrder: ['Free', 'Express', 'Standard', 'Professional', 'Enterprise']
|
|
58
|
+
editionOrder: ['Free', 'Express', 'Standard', 'Professional', 'Enterprise'],
|
|
59
|
+
showCaseTimings: true,
|
|
60
|
+
runtimeLogs: {
|
|
61
|
+
mode: 'failure-only'
|
|
62
|
+
}
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
@@ -113,6 +117,8 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
113
117
|
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
114
118
|
* @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
|
|
115
119
|
* @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
|
|
120
|
+
* @property {boolean} showCaseTimings: When true, the console reporter prints per-case start/end wall-clock times (h:mm:ss AM/PM) and a case-timings.json sidecar is written to reportPath for the HTML report addon. Default: true.
|
|
121
|
+
* @property {Object} runtimeLogs: Runtime browser log capture. { mode: 'failure-only' | 'always', limits?: { maxEvents, captureHeaders, ignoreUrlPatterns } }. Default: { mode: 'failure-only' }.
|
|
116
122
|
*/
|
|
117
123
|
|
|
118
124
|
/**
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = generateReport;
|
|
8
|
+
var _child_process = require("child_process");
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _logger = require("../../utils/logger");
|
|
11
|
+
var _rootPath = require("../../utils/rootPath");
|
|
12
|
+
var _readConfigFile = require("./readConfigFile");
|
|
13
|
+
async function generateReport() {
|
|
14
|
+
// await preProcessReport()
|
|
15
|
+
const userArgs = process.argv.slice(3);
|
|
16
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
17
|
+
const command = playwrightPath;
|
|
18
|
+
const {
|
|
19
|
+
reportPath: htmlPath
|
|
20
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
21
|
+
const args = ['show-report', htmlPath].concat(userArgs);
|
|
22
|
+
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
23
|
+
stdio: 'inherit'
|
|
24
|
+
});
|
|
25
|
+
childProcess.on('error', error => {
|
|
26
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
|
|
27
|
+
});
|
|
28
|
+
childProcess.on('exit', (code, signal) => {
|
|
29
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Child Process Exited with Code ${code} and Signal ${signal}`);
|
|
30
|
+
process.exit();
|
|
31
|
+
});
|
|
32
|
+
process.on('exit', () => {
|
|
33
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Terminating Playwright Process...');
|
|
34
|
+
childProcess.kill();
|
|
35
|
+
return;
|
|
36
|
+
});
|
|
37
|
+
process.on('SIGINT', () => {
|
|
38
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Cleaning up...');
|
|
39
|
+
childProcess.kill();
|
|
40
|
+
process.exit();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -12,6 +12,22 @@ var _readConfigFile = require("../readConfigFile");
|
|
|
12
12
|
var _logger = require("../../../utils/logger");
|
|
13
13
|
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
14
14
|
var _mergeAbortedTests = _interopRequireDefault(require("../reporter/helpers/mergeAbortedTests"));
|
|
15
|
+
function formatTime(date) {
|
|
16
|
+
return date.toLocaleTimeString('en-US', {
|
|
17
|
+
hour: 'numeric',
|
|
18
|
+
minute: '2-digit',
|
|
19
|
+
second: '2-digit',
|
|
20
|
+
hour12: true
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function formatDuration(ms) {
|
|
24
|
+
if (ms < 1000) return `${ms}ms`;
|
|
25
|
+
const totalSeconds = ms / 1000;
|
|
26
|
+
if (totalSeconds < 60) return `${totalSeconds.toFixed(2)}s`;
|
|
27
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
28
|
+
const seconds = (totalSeconds - minutes * 60).toFixed(2);
|
|
29
|
+
return `${minutes}m ${seconds}s`;
|
|
30
|
+
}
|
|
15
31
|
class JSONSummaryReporter {
|
|
16
32
|
constructor() {
|
|
17
33
|
this.durationInMS = -1;
|
|
@@ -26,11 +42,22 @@ class JSONSummaryReporter {
|
|
|
26
42
|
this.failedSteps = [];
|
|
27
43
|
this.status = 'unknown';
|
|
28
44
|
this.startedAt = 0;
|
|
29
|
-
|
|
45
|
+
const config = (0, _readConfigFile.generateConfigFromFile)();
|
|
46
|
+
this._open = config.openReportOn;
|
|
47
|
+
this._showCaseTimings = config.showCaseTimings !== false;
|
|
48
|
+
this._caseTimings = [];
|
|
30
49
|
}
|
|
31
50
|
onBegin() {
|
|
32
51
|
this.startedAt = Date.now();
|
|
33
52
|
}
|
|
53
|
+
onTestBegin(test) {
|
|
54
|
+
if (!this._showCaseTimings) return;
|
|
55
|
+
const {
|
|
56
|
+
fullTitle
|
|
57
|
+
} = this.getTitle(test);
|
|
58
|
+
const startedAtLabel = formatTime(new Date());
|
|
59
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `▶ ${fullTitle} — started at ${startedAtLabel}`);
|
|
60
|
+
}
|
|
34
61
|
getTitle(test) {
|
|
35
62
|
const title = [];
|
|
36
63
|
const fileName = [];
|
|
@@ -76,6 +103,55 @@ class JSONSummaryReporter {
|
|
|
76
103
|
this[status].push(fileName);
|
|
77
104
|
}
|
|
78
105
|
this[status].push(fileName);
|
|
106
|
+
if (this._showCaseTimings && result.startTime) {
|
|
107
|
+
const startDate = new Date(result.startTime);
|
|
108
|
+
const endDate = new Date(startDate.getTime() + (result.duration || 0));
|
|
109
|
+
const startLabel = formatTime(startDate);
|
|
110
|
+
const endLabel = formatTime(endDate);
|
|
111
|
+
const durationLabel = formatDuration(result.duration || 0);
|
|
112
|
+
const statusGlyph = result.status === 'passed' ? '✓' : result.status === 'skipped' ? '○' : '✗';
|
|
113
|
+
const logType = result.status === 'passed' ? _logger.Logger.SUCCESS_TYPE : result.status === 'skipped' ? _logger.Logger.INFO_TYPE : _logger.Logger.FAILURE_TYPE;
|
|
114
|
+
_logger.Logger.log(logType, `${statusGlyph} ${fullTitle} — ended at ${endLabel} (started ${startLabel}, took ${durationLabel})`);
|
|
115
|
+
const isFailure = result.status !== 'passed' && result.status !== 'skipped';
|
|
116
|
+
if (isFailure) {
|
|
117
|
+
var _result$error;
|
|
118
|
+
const runtimeAttachment = (result.attachments || []).find(a => a.name === 'runtime-log' && a.body);
|
|
119
|
+
let runtime = null;
|
|
120
|
+
if (runtimeAttachment) {
|
|
121
|
+
try {
|
|
122
|
+
runtime = JSON.parse(runtimeAttachment.body.toString('utf8'));
|
|
123
|
+
} catch {
|
|
124
|
+
// malformed attachment; skip
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
this._caseTimings.push({
|
|
128
|
+
title: fullTitle,
|
|
129
|
+
fileName,
|
|
130
|
+
status: result.status,
|
|
131
|
+
retry: result.retry,
|
|
132
|
+
startTime: startDate.toISOString(),
|
|
133
|
+
endTime: endDate.toISOString(),
|
|
134
|
+
startTimeFormatted: startLabel,
|
|
135
|
+
endTimeFormatted: endLabel,
|
|
136
|
+
duration: result.duration || 0,
|
|
137
|
+
durationFormatted: durationLabel,
|
|
138
|
+
errorMessage: (_result$error = result.error) === null || _result$error === void 0 ? void 0 : _result$error.message,
|
|
139
|
+
failedSteps: (result.steps || []).filter(step => step.error).map(step => {
|
|
140
|
+
var _step$error;
|
|
141
|
+
return {
|
|
142
|
+
title: step.title,
|
|
143
|
+
error: (_step$error = step.error) === null || _step$error === void 0 ? void 0 : _step$error.message
|
|
144
|
+
};
|
|
145
|
+
}),
|
|
146
|
+
...(runtime ? {
|
|
147
|
+
runtime: {
|
|
148
|
+
summary: runtime.summary,
|
|
149
|
+
logFile: runtime.file
|
|
150
|
+
}
|
|
151
|
+
} : {})
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
79
155
|
}
|
|
80
156
|
onError(error) {
|
|
81
157
|
this.errored.push({
|
|
@@ -122,6 +198,16 @@ class JSONSummaryReporter {
|
|
|
122
198
|
reportPath
|
|
123
199
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
124
200
|
(0, _fileUtils.writeFileContents)(_path.default.join(reportPath, './', (0, _configFileNameProvider.getReportFileName)()), JSON.stringify(this, null, ' '));
|
|
201
|
+
if (this._showCaseTimings && this._caseTimings.length > 0) {
|
|
202
|
+
const timingsPayload = {
|
|
203
|
+
suiteStartedAt: new Date(this.startedAt).toISOString(),
|
|
204
|
+
suiteEndedAt: new Date(this.startedAt + this.durationInMS).toISOString(),
|
|
205
|
+
suiteDurationMs: this.durationInMS,
|
|
206
|
+
failedCount: this._caseTimings.length,
|
|
207
|
+
cases: this._caseTimings
|
|
208
|
+
};
|
|
209
|
+
(0, _fileUtils.writeFileContents)(_path.default.join(reportPath, 'case-timings.json'), JSON.stringify(timingsPayload, null, ' '));
|
|
210
|
+
}
|
|
125
211
|
}
|
|
126
212
|
onExit() {
|
|
127
213
|
// Update .last-run.json with aborted tests due to timing out or interruption
|
package/build/lib/cli.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _testRunner = _interopRequireDefault(require("../core/playwright/test-runner"));
|
|
5
|
-
var
|
|
6
|
-
var _PlaywrightReporter = _interopRequireDefault(require("../core/playwright/reporter/PlaywrightReporter"));
|
|
7
|
-
var _UnitReporter = _interopRequireDefault(require("../core/playwright/reporter/UnitReporter"));
|
|
5
|
+
var _reportGenerator = _interopRequireDefault(require("../core/playwright/report-generator"));
|
|
8
6
|
var _codegen = _interopRequireDefault(require("../core/playwright/codegen"));
|
|
9
7
|
var _logger = require("../utils/logger");
|
|
10
8
|
var _setupProject = _interopRequireDefault(require("../setup-folder-structure/setupProject"));
|
|
@@ -13,25 +11,15 @@ var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-cach
|
|
|
13
11
|
var _helper = _interopRequireDefault(require("../setup-folder-structure/helper"));
|
|
14
12
|
var _parseUserArgs = _interopRequireDefault(require("../core/playwright/helpers/parseUserArgs"));
|
|
15
13
|
var _validateFeature = _interopRequireDefault(require("../core/playwright/validateFeature"));
|
|
16
|
-
|
|
14
|
+
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
15
|
+
|
|
17
16
|
const [,, option, ...otherOptions] = process.argv;
|
|
18
17
|
switch (option) {
|
|
19
18
|
case 'test':
|
|
20
19
|
{
|
|
21
20
|
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Tests..');
|
|
22
21
|
(0, _testRunner.default)();
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
case 'unit-test':
|
|
26
|
-
{
|
|
27
|
-
const testFile = process.argv[3];
|
|
28
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Unit Tests..');
|
|
29
|
-
const options = {};
|
|
30
|
-
if (testFile) {
|
|
31
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Filtering tests with pattern: ${testFile}`);
|
|
32
|
-
options.testPathPattern = testFile;
|
|
33
|
-
}
|
|
34
|
-
(0, _unitTestingFramework.createJestRunner)(options);
|
|
22
|
+
//createJestRunner();
|
|
35
23
|
break;
|
|
36
24
|
}
|
|
37
25
|
case 'validate':
|
|
@@ -52,14 +40,9 @@ switch (option) {
|
|
|
52
40
|
}
|
|
53
41
|
case 'report':
|
|
54
42
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
case 'ut-report':
|
|
60
|
-
{
|
|
61
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Generating Unit Test Reports...');
|
|
62
|
-
_UnitReporter.default.generate();
|
|
43
|
+
// console.log('\x1b[36mGenerating Reports...\x1b[0m');
|
|
44
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Generating Reports...');
|
|
45
|
+
(0, _reportGenerator.default)();
|
|
63
46
|
break;
|
|
64
47
|
}
|
|
65
48
|
case 'codegen':
|
|
@@ -86,12 +69,6 @@ switch (option) {
|
|
|
86
69
|
(0, _clearCaches.default)();
|
|
87
70
|
break;
|
|
88
71
|
}
|
|
89
|
-
case 'stepsGenerator':
|
|
90
|
-
{
|
|
91
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Created agents and prompts md files under .github folder...');
|
|
92
|
-
(0, _commonUtils.copyGithubFolder)();
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
72
|
case 'help':
|
|
96
73
|
default:
|
|
97
74
|
{
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.copyCommonSpecs = copyCommonSpecs;
|
|
8
|
-
exports.copyGithubFolder = copyGithubFolder;
|
|
9
8
|
var _fileUtils = require("./fileUtils");
|
|
10
9
|
var _path = _interopRequireDefault(require("path"));
|
|
11
10
|
var _configConstants = _interopRequireDefault(require("../core/playwright/constants/configConstants"));
|
|
@@ -18,12 +17,4 @@ function copyCommonSpecs() {
|
|
|
18
17
|
const destDirectory = _path.default.resolve(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'modules', '.testingLib-common');
|
|
19
18
|
(0, _fileUtils.deleteFolder)(destDirectory);
|
|
20
19
|
(0, _fileUtils.copyDirectory)(commonSpecPath, destDirectory);
|
|
21
|
-
}
|
|
22
|
-
function copyGithubFolder() {
|
|
23
|
-
const libraryPath = require.resolve("@zohodesk/testinglibrary");
|
|
24
|
-
// libraryPath will be build/index.js, go two levels up to reach the package root where .github lives
|
|
25
|
-
const githubSrcPath = _path.default.resolve(libraryPath, '../../', '.github');
|
|
26
|
-
const destDirectory = _path.default.resolve(process.cwd(), '../../', '.github');
|
|
27
|
-
(0, _fileUtils.deleteFolder)(destDirectory);
|
|
28
|
-
(0, _fileUtils.copyDirectory)(githubSrcPath, destDirectory);
|
|
29
20
|
}
|