@empiricalrun/playwright-utils 0.39.4 → 0.39.6
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/CHANGELOG.md +15 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -5
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +6 -0
- package/dist/reporter/failing-line.d.ts +2 -0
- package/dist/reporter/failing-line.d.ts.map +1 -0
- package/dist/reporter/failing-line.js +57 -0
- package/package.json +5 -4
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.39.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4947d9a: feat: move failing line collection to reporter
|
|
8
|
+
- @empiricalrun/cua@0.2.0
|
|
9
|
+
- @empiricalrun/dashboard-client@0.2.0
|
|
10
|
+
- @empiricalrun/llm@0.25.2
|
|
11
|
+
|
|
12
|
+
## 0.39.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 9a18c3c: fix: maxFailures cannot be shard aware locally
|
|
17
|
+
|
|
3
18
|
## 0.39.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAgBzD,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AA6BD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAgBzD,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AA6BD,eAAO,MAAM,UAAU,EAAE,oBAyBxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAarB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -71,11 +71,8 @@ exports.baseConfig = {
|
|
|
71
71
|
retries: process.env.CI ? 2 : 0,
|
|
72
72
|
// Let playwright choose max workers based on size of infra
|
|
73
73
|
workers: undefined,
|
|
74
|
-
// maxFailures counts retries as individual failures, so this is equivalent to
|
|
75
|
-
|
|
76
|
-
maxFailures: process.env.CI
|
|
77
|
-
? Math.ceil(30 / (parseInt(process.env.TOTAL_SHARDS, 10) || 1))
|
|
78
|
-
: undefined,
|
|
74
|
+
// maxFailures counts retries as individual failures, so this is equivalent to 20 failed tests
|
|
75
|
+
maxFailures: process.env.CI ? 30 : undefined,
|
|
79
76
|
timeout: 15 * 60 * 1_000,
|
|
80
77
|
expect: {
|
|
81
78
|
timeout: 15_000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAoBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;;IAM1C,OAAO,CAAC,6BAA6B,CAkCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IA6FtC,KAAK,CAAC,MAAM,EAAE,UAAU;IA8G9B,OAAO,CAAC,gBAAgB;YAoBV,gBAAgB;YAOhB,iBAAiB;CAmChC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -8,6 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
9
|
const telemetry_1 = require("../telemetry");
|
|
10
10
|
const blob_utils_1 = require("./blob-utils");
|
|
11
|
+
const failing_line_1 = require("./failing-line");
|
|
11
12
|
const uploader_1 = require("./uploader");
|
|
12
13
|
const util_1 = require("./util");
|
|
13
14
|
class EmpiricalReporter {
|
|
@@ -88,6 +89,10 @@ class EmpiricalReporter {
|
|
|
88
89
|
try {
|
|
89
90
|
logger_1.logger.debug(`[Empirical Reporter] Attachments for test ${test.title} are uploaded:`, successfulAttachments);
|
|
90
91
|
const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
|
|
92
|
+
const errorLocation = result.error?.location;
|
|
93
|
+
const failingLine = errorLocation
|
|
94
|
+
? (0, failing_line_1.getFailingLineFromSource)(errorLocation.file, errorLocation.line, errorLocation.column)
|
|
95
|
+
: undefined;
|
|
91
96
|
const params = {
|
|
92
97
|
test,
|
|
93
98
|
suites,
|
|
@@ -95,6 +100,7 @@ class EmpiricalReporter {
|
|
|
95
100
|
projectName,
|
|
96
101
|
attachments: successfulAttachments,
|
|
97
102
|
runId: process.env.TEST_RUN_GITHUB_ACTION_ID,
|
|
103
|
+
failingLine,
|
|
98
104
|
};
|
|
99
105
|
return (0, util_1.sendTestCaseUpdateToDashboard)(params);
|
|
100
106
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failing-line.d.ts","sourceRoot":"","sources":["../../src/reporter/failing-line.ts"],"names":[],"mappings":"AAmDA,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getFailingLineFromSource = getFailingLineFromSource;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const ts_morph_1 = require("ts-morph");
|
|
9
|
+
const supportedSyntaxes = [
|
|
10
|
+
ts_morph_1.SyntaxKind.ExpressionStatement,
|
|
11
|
+
ts_morph_1.SyntaxKind.VariableStatement,
|
|
12
|
+
ts_morph_1.SyntaxKind.ReturnStatement,
|
|
13
|
+
ts_morph_1.SyntaxKind.IfStatement,
|
|
14
|
+
ts_morph_1.SyntaxKind.ForStatement,
|
|
15
|
+
ts_morph_1.SyntaxKind.WhileStatement,
|
|
16
|
+
ts_morph_1.SyntaxKind.DoStatement,
|
|
17
|
+
ts_morph_1.SyntaxKind.SwitchStatement,
|
|
18
|
+
ts_morph_1.SyntaxKind.TryStatement,
|
|
19
|
+
ts_morph_1.SyntaxKind.FunctionDeclaration,
|
|
20
|
+
ts_morph_1.SyntaxKind.ArrowFunction,
|
|
21
|
+
ts_morph_1.SyntaxKind.ClassDeclaration,
|
|
22
|
+
ts_morph_1.SyntaxKind.Block,
|
|
23
|
+
ts_morph_1.SyntaxKind.ThrowStatement,
|
|
24
|
+
];
|
|
25
|
+
function getTestStatementFromCode(code, line, column) {
|
|
26
|
+
const project = new ts_morph_1.Project();
|
|
27
|
+
const sourceFile = project.createSourceFile("temp-file.ts", `${code}`);
|
|
28
|
+
const position = sourceFile
|
|
29
|
+
.getFullText()
|
|
30
|
+
.split("\n")
|
|
31
|
+
.slice(0, line - 1)
|
|
32
|
+
.reduce((sum, l) => sum + l.length + 1, 0) +
|
|
33
|
+
(column - 1);
|
|
34
|
+
const nodeAtPos = sourceFile.getDescendantAtPos(position);
|
|
35
|
+
if (nodeAtPos) {
|
|
36
|
+
let statement = nodeAtPos.getFirstAncestor((ancestor) => supportedSyntaxes.includes(ancestor.getKind()));
|
|
37
|
+
if (!statement) {
|
|
38
|
+
if (supportedSyntaxes.includes(nodeAtPos.getKind())) {
|
|
39
|
+
statement = nodeAtPos;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (statement) {
|
|
43
|
+
return statement.getText();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
function getFailingLineFromSource(filePath, line, column) {
|
|
49
|
+
try {
|
|
50
|
+
const code = fs_1.default.readFileSync(filePath, "utf-8");
|
|
51
|
+
const statement = getTestStatementFromCode(code, line, column);
|
|
52
|
+
return statement || undefined;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/pg": "^8.11.6",
|
|
33
33
|
"playwright-core": "1.57.0",
|
|
34
34
|
"serve-handler": "^6.1.6",
|
|
35
|
-
"@empiricalrun/shared-types": "0.12.
|
|
35
|
+
"@empiricalrun/shared-types": "0.12.1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/code-frame": "^7.24.7",
|
|
@@ -42,10 +42,11 @@
|
|
|
42
42
|
"console-log-level": "^1.4.1",
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
|
+
"ts-morph": "^23.0.0",
|
|
45
46
|
"@empiricalrun/cua": "^0.2.0",
|
|
46
|
-
"@empiricalrun/
|
|
47
|
+
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
47
48
|
"@empiricalrun/llm": "^0.25.2",
|
|
48
|
-
"@empiricalrun/
|
|
49
|
+
"@empiricalrun/dashboard-client": "^0.2.0"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"dev": "tsc --build --watch",
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/email.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/postgres.ts","./src/telemetry.ts","./src/webhook.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/proxy.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/expect/index.ts","./src/test/expect/types.ts","./src/test/expect/visual.ts","./src/test/expect/webhook.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["./src/email.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/postgres.ts","./src/telemetry.ts","./src/webhook.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/proxy.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/failing-line.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/expect/index.ts","./src/test/expect/types.ts","./src/test/expect/visual.ts","./src/test/expect/webhook.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
|