@camunda/e2e-test-suite 0.0.1065 → 0.0.1067
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/test-setup.js +29 -15
- package/package.json +1 -1
package/dist/test-setup.js
CHANGED
|
@@ -9,6 +9,16 @@ const crypto_1 = require("crypto");
|
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
const constants_1 = require("./utils/constants");
|
|
11
11
|
async function captureScreenshot(page, testInfo) {
|
|
12
|
+
// Skip on passed/skipped: this ran for every test regardless of outcome,
|
|
13
|
+
// and since it's uploaded to TestRail via the testrail_attachment
|
|
14
|
+
// annotation below, a passing-test screenshot has negligible debugging
|
|
15
|
+
// value but was a dominant driver of excess TestRail attachment storage.
|
|
16
|
+
// Skip explicitly on passed/skipped rather than gating on
|
|
17
|
+
// `=== 'failed'`, so a timed-out or interrupted test -- exactly the
|
|
18
|
+
// cases where a screenshot is most useful -- still gets one.
|
|
19
|
+
if (testInfo.status === 'passed' || testInfo.status === 'skipped') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
12
22
|
const screenshotPath = `test-results/screenshots/screenshot-${(0, crypto_1.randomUUID)()}.png`;
|
|
13
23
|
try {
|
|
14
24
|
await page.screenshot({
|
|
@@ -40,21 +50,25 @@ async function captureScreenshot(page, testInfo) {
|
|
|
40
50
|
}
|
|
41
51
|
exports.captureScreenshot = captureScreenshot;
|
|
42
52
|
async function captureFailureVideo(page, testInfo) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
53
|
+
// Same policy as captureScreenshot above: skip on passed/skipped rather
|
|
54
|
+
// than requiring literally 'failed', so timed-out/interrupted tests keep
|
|
55
|
+
// getting a video too, and the two attachment types stay in sync.
|
|
56
|
+
if (testInfo.status === 'passed' || testInfo.status === 'skipped') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const videoPath = `test-results/videos/video-${testInfo.title}-chromium.webm`;
|
|
60
|
+
const video = await page.video();
|
|
61
|
+
if (video) {
|
|
62
|
+
await page.close(); // Close explicitly to unblock saveAs
|
|
63
|
+
await video.saveAs(videoPath);
|
|
64
|
+
await testInfo.attach('video', {
|
|
65
|
+
path: videoPath,
|
|
66
|
+
contentType: 'video/webm',
|
|
67
|
+
});
|
|
68
|
+
testInfo.annotations.push({
|
|
69
|
+
type: 'testrail_attachment',
|
|
70
|
+
description: videoPath,
|
|
71
|
+
});
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
exports.captureFailureVideo = captureFailureVideo;
|