@empiricalrun/playwright-utils 0.9.1 → 0.9.3-reporter-revert.1

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +4 -3
  4. package/dist/reporter/custom.d.ts +2 -1
  5. package/dist/reporter/custom.d.ts.map +1 -1
  6. package/dist/reporter/custom.js +36 -25
  7. package/dist/reporter/types/htmlReporter.d.ts +106 -0
  8. package/dist/reporter/types/htmlReporter.d.ts.map +1 -0
  9. package/dist/reporter/types/htmlReporter.js +17 -0
  10. package/dist/reporter/types/index.d.ts +2 -0
  11. package/dist/reporter/types/index.d.ts.map +1 -0
  12. package/dist/reporter/types/index.js +2 -0
  13. package/dist/reporter/upload.d.ts +11 -0
  14. package/dist/reporter/upload.d.ts.map +1 -0
  15. package/dist/reporter/upload.js +135 -0
  16. package/dist/test/scripts/pw-locator-patch/expect.d.ts +5 -0
  17. package/dist/test/scripts/pw-locator-patch/expect.d.ts.map +1 -0
  18. package/dist/test/scripts/pw-locator-patch/expect.js +36 -0
  19. package/dist/test/scripts/pw-locator-patch/hover.d.ts +5 -0
  20. package/dist/test/scripts/pw-locator-patch/hover.d.ts.map +1 -0
  21. package/dist/test/scripts/pw-locator-patch/hover.js +31 -0
  22. package/dist/test/scripts/pw-locator-patch/inner-text.d.ts +5 -0
  23. package/dist/test/scripts/pw-locator-patch/inner-text.d.ts.map +1 -0
  24. package/dist/test/scripts/pw-locator-patch/inner-text.js +32 -0
  25. package/dist/test/scripts/pw-locator-patch/input-value.d.ts +5 -0
  26. package/dist/test/scripts/pw-locator-patch/input-value.d.ts.map +1 -0
  27. package/dist/test/scripts/pw-locator-patch/input-value.js +32 -0
  28. package/dist/test/scripts/pw-locator-patch/is-checked.d.ts +5 -0
  29. package/dist/test/scripts/pw-locator-patch/is-checked.d.ts.map +1 -0
  30. package/dist/test/scripts/pw-locator-patch/is-checked.js +32 -0
  31. package/dist/test/scripts/pw-locator-patch/is-disabled.d.ts +5 -0
  32. package/dist/test/scripts/pw-locator-patch/is-disabled.d.ts.map +1 -0
  33. package/dist/test/scripts/pw-locator-patch/is-disabled.js +32 -0
  34. package/dist/test/scripts/pw-locator-patch/is-editable.d.ts +5 -0
  35. package/dist/test/scripts/pw-locator-patch/is-editable.d.ts.map +1 -0
  36. package/dist/test/scripts/pw-locator-patch/is-editable.js +32 -0
  37. package/dist/test/scripts/pw-locator-patch/text-content.d.ts +5 -0
  38. package/dist/test/scripts/pw-locator-patch/text-content.d.ts.map +1 -0
  39. package/dist/test/scripts/pw-locator-patch/text-content.js +32 -0
  40. package/dist/third_party/html-reporter-types.d.ts +107 -0
  41. package/dist/third_party/html-reporter-types.d.ts.map +1 -0
  42. package/dist/third_party/html-reporter-types.js +18 -0
  43. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - df506e6: fix: add logs for error in reporter
8
+
9
+ ## 0.9.2
10
+
11
+ ### Patch Changes
12
+
13
+ - aa28f47: chore: add logs for test start
14
+
3
15
  ## 0.9.1
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAa7D,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AAED,eAAO,MAAM,UAAU,EAAE,oBAwBxB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAa7D,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AAED,eAAO,MAAM,UAAU,EAAE,oBAyBxB,CAAC"}
package/dist/config.js CHANGED
@@ -33,15 +33,16 @@ function chromeStablePath() {
33
33
  exports.chromeStablePath = chromeStablePath;
34
34
  exports.baseConfig = {
35
35
  testDir: "./tests",
36
- outputDir: "./playwright-report/data", // to store default playwright artifacts (during and post test run)
36
+ // outputDir: "./playwright-report/data", // to store default playwright artifacts (during and post test run)
37
37
  fullyParallel: true,
38
38
  forbidOnly: false,
39
39
  retries: process.env.CI ? 2 : 0,
40
40
  workers: undefined,
41
41
  reporter: [
42
42
  ["list"], // For real-time reporting on CI terminal (vs. the default "dot" reporter)
43
- ["json", { outputFile: "playwright-report/summary.json" }],
44
- ["./node_modules/@empiricalrun/playwright-utils/dist/reporter/custom.js"],
43
+ ["json", { outputFile: "test-results/summary.json" }],
44
+ ["html"],
45
+ // ["./node_modules/@empiricalrun/playwright-utils/dist/reporter/custom.js"],
45
46
  ],
46
47
  use: {
47
48
  trace: "on",
@@ -39,6 +39,7 @@ declare class HtmlReporter implements ReporterV2 {
39
39
  private _open;
40
40
  private _port;
41
41
  private _host;
42
+ private _testCount;
42
43
  private _buildResult;
43
44
  private _topLevelErrors;
44
45
  constructor(options: HtmlReporterOptions);
@@ -48,7 +49,7 @@ declare class HtmlReporter implements ReporterV2 {
48
49
  onStepBegin(): void;
49
50
  onStepEnd(): void;
50
51
  version(): "v2";
51
- onTestBegin(): void;
52
+ onTestBegin(test: TestCasePublic): void;
52
53
  onTestEnd(test: TestCasePublic, result: TestResultPublic): void;
53
54
  onConfigure(config: FullConfig): void;
54
55
  onBegin(suite: Suite): void;
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/reporter/custom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAEV,KAAK,EACL,QAAQ,IAAI,cAAc,EAC1B,SAAS,EACT,UAAU,IAAI,gBAAgB,EAE/B,MAAM,2BAA2B,CAA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wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,GAAE,MAAoB,EAC1B,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,iBAqBhB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsBhE;AAqiBD,eAAe,YAAY,CAAC"}
@@ -46,6 +46,7 @@ class HtmlReporter {
46
46
  _open;
47
47
  _port;
48
48
  _host;
49
+ _testCount = 1;
49
50
  _buildResult;
50
51
  _topLevelErrors = [];
51
52
  constructor(options) {
@@ -61,34 +62,44 @@ class HtmlReporter {
61
62
  version() {
62
63
  return "v2";
63
64
  }
64
- onTestBegin() { }
65
+ onTestBegin(test) {
66
+ const [, projectName, ...titles] = test.titlePath();
67
+ console.log(`\n\n > ${this._testCount} [${projectName}] ${titles.join(" › ")} \n\n\n`);
68
+ this._testCount += 1;
69
+ }
65
70
  onTestEnd(test, result) {
66
71
  // upload folder to R2
67
72
  // iterate over attachments
68
- result.attachments.forEach(async (attachment) => {
69
- if (!attachment.path)
70
- return;
71
- const folder = path_1.default.relative(this._outputFolder + "/data", attachment.path);
72
- const folderName = folder.split("/")[0];
73
- // on test gen run, we don't have PROJECT_NAME or TEST_RUN_GITHUB_ACTION_ID so we skip uploading since we anyways handle uploads for that, this is a stopgap
74
- if (!process.env.PROJECT_NAME || !process.env.TEST_RUN_GITHUB_ACTION_ID) {
75
- return;
76
- }
77
- try {
78
- await (0, r2_uploader_1.uploadDirectory)({
79
- sourceDir: this._outputFolder + "/data/" + folderName,
80
- destinationDir: process.env.PROJECT_NAME +
81
- "/" +
82
- process.env.TEST_RUN_GITHUB_ACTION_ID +
83
- "/data/" +
84
- folderName,
85
- uploadBucket: "test-report",
86
- });
87
- }
88
- catch (e) {
89
- // tests shouldn't stop no matter whatever error we get
90
- }
91
- });
73
+ try {
74
+ result.attachments.forEach(async (attachment) => {
75
+ if (!attachment.path)
76
+ return;
77
+ const folder = path_1.default.relative(this._outputFolder + "/data", attachment.path);
78
+ const folderName = folder.split("/")[0];
79
+ // on test gen run, we don't have PROJECT_NAME or TEST_RUN_GITHUB_ACTION_ID so we skip uploading since we anyways handle uploads for that, this is a stopgap
80
+ if (!process.env.PROJECT_NAME ||
81
+ !process.env.TEST_RUN_GITHUB_ACTION_ID) {
82
+ return;
83
+ }
84
+ try {
85
+ await (0, r2_uploader_1.uploadDirectory)({
86
+ sourceDir: this._outputFolder + "/data/" + folderName,
87
+ destinationDir: process.env.PROJECT_NAME +
88
+ "/" +
89
+ process.env.TEST_RUN_GITHUB_ACTION_ID +
90
+ "/data/" +
91
+ folderName,
92
+ uploadBucket: "test-report",
93
+ });
94
+ }
95
+ catch (e) {
96
+ // tests shouldn't stop no matter whatever error we get
97
+ }
98
+ });
99
+ }
100
+ catch (e) {
101
+ console.error("Error while processing attachments for test", e);
102
+ }
92
103
  }
93
104
  onConfigure(config) {
94
105
  this.config = config;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Metadata } from "@playwright/test";
17
+ export type Stats = {
18
+ total: number;
19
+ expected: number;
20
+ unexpected: number;
21
+ flaky: number;
22
+ skipped: number;
23
+ ok: boolean;
24
+ };
25
+ export type FilteredStats = {
26
+ total: number;
27
+ duration: number;
28
+ };
29
+ export type Location = {
30
+ file: string;
31
+ line: number;
32
+ column: number;
33
+ };
34
+ export type HTMLReport = {
35
+ metadata: Metadata;
36
+ files: TestFileSummary[];
37
+ stats: Stats;
38
+ projectNames: string[];
39
+ startTime: number;
40
+ duration: number;
41
+ errors: string[];
42
+ };
43
+ export type TestFile = {
44
+ fileId: string;
45
+ fileName: string;
46
+ tests: TestCase[];
47
+ };
48
+ export type TestFileSummary = {
49
+ fileId: string;
50
+ fileName: string;
51
+ tests: TestCaseSummary[];
52
+ stats: Stats;
53
+ };
54
+ export type TestCaseAnnotation = {
55
+ type: string;
56
+ description?: string;
57
+ };
58
+ export type TestCaseSummary = {
59
+ testId: string;
60
+ title: string;
61
+ path: string[];
62
+ projectName: string;
63
+ location: Location;
64
+ annotations: TestCaseAnnotation[];
65
+ tags: string[];
66
+ outcome: "skipped" | "expected" | "unexpected" | "flaky";
67
+ duration: number;
68
+ ok: boolean;
69
+ results: TestResultSummary[];
70
+ };
71
+ export type TestResultSummary = {
72
+ attachments: {
73
+ name: string;
74
+ contentType: string;
75
+ path?: string;
76
+ }[];
77
+ };
78
+ export type TestCase = Omit<TestCaseSummary, "results"> & {
79
+ results: TestResult[];
80
+ };
81
+ export type TestAttachment = {
82
+ name: string;
83
+ body?: string;
84
+ path?: string;
85
+ contentType: string;
86
+ };
87
+ export type TestResult = {
88
+ retry: number;
89
+ startTime: string;
90
+ duration: number;
91
+ steps: TestStep[];
92
+ errors: string[];
93
+ attachments: TestAttachment[];
94
+ status: "passed" | "failed" | "timedOut" | "skipped" | "interrupted";
95
+ };
96
+ export type TestStep = {
97
+ title: string;
98
+ startTime: string;
99
+ duration: number;
100
+ location?: Location;
101
+ snippet?: string;
102
+ error?: string;
103
+ steps: TestStep[];
104
+ count: number;
105
+ };
106
+ //# sourceMappingURL=htmlReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htmlReporter.d.ts","sourceRoot":"","sources":["../../../src/reporter/types/htmlReporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,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B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export type RawStack = string[];
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reporter/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ interface FileMap {
2
+ [file: string]: string;
3
+ }
4
+ export declare function uploadDirectory({ sourceDir, fileList, destinationDir, uploadBucket, }: {
5
+ sourceDir: string;
6
+ fileList?: string[];
7
+ destinationDir: string;
8
+ uploadBucket: string;
9
+ }): Promise<FileMap>;
10
+ export {};
11
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/reporter/upload.ts"],"names":[],"mappings":"AAsBA,UAAU,OAAO;IACf,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AA+GD,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnB"}
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.uploadDirectory = void 0;
30
+ const client_s3_1 = require("@aws-sdk/client-s3");
31
+ const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
32
+ const fs = __importStar(require("fs"));
33
+ const md5_1 = __importDefault(require("md5"));
34
+ const path_1 = __importDefault(require("path"));
35
+ const getFileList = (dir) => {
36
+ let files = [];
37
+ const items = fs.readdirSync(dir, {
38
+ withFileTypes: true,
39
+ });
40
+ for (const item of items) {
41
+ const isDir = item.isDirectory();
42
+ const absolutePath = `${dir}/${item.name}`;
43
+ if (isDir) {
44
+ files = [...files, ...getFileList(absolutePath)];
45
+ }
46
+ else {
47
+ files.push(absolutePath);
48
+ }
49
+ }
50
+ return files;
51
+ };
52
+ const run = async (config) => {
53
+ const map = new Map();
54
+ const urls = {};
55
+ const S3 = new client_s3_1.S3Client({
56
+ region: "auto",
57
+ endpoint: `https://${config.accountId}.r2.cloudflarestorage.com`,
58
+ credentials: {
59
+ accessKeyId: config.accessKeyId,
60
+ secretAccessKey: config.secretAccessKey,
61
+ },
62
+ });
63
+ let files;
64
+ if (config.fileList) {
65
+ files = config.fileList;
66
+ }
67
+ else {
68
+ files = getFileList(config.sourceDir);
69
+ }
70
+ await Promise.all(files.map(async (file) => {
71
+ const fileStream = fs.readFileSync(file);
72
+ const fileName = file.replace(config.sourceDir, "");
73
+ const fileKey = path_1.default.join(config.destinationDir !== "" ? config.destinationDir : config.sourceDir, fileName);
74
+ if (fileKey.includes(".gitkeep"))
75
+ return;
76
+ // console.log(fileKey);
77
+ let mimeType = "application/octet-stream";
78
+ try {
79
+ const mime = (await import("mime")).default;
80
+ mimeType = mime.getType(file) || "application/octet-stream";
81
+ }
82
+ catch (err) {
83
+ console.warn("Failed to get mime type for file", file, err);
84
+ }
85
+ const uploadParams = {
86
+ Bucket: config.bucket,
87
+ Key: fileKey,
88
+ Body: fileStream,
89
+ ContentLength: fs.statSync(file).size,
90
+ ContentType: mimeType ?? "application/octet-stream",
91
+ };
92
+ const cmd = new client_s3_1.PutObjectCommand(uploadParams);
93
+ const digest = (0, md5_1.default)(fileStream);
94
+ cmd.middlewareStack.add((next) => async (args) => {
95
+ args.request.headers["if-none-match"] = `"${digest}"`;
96
+ return await next(args);
97
+ }, {
98
+ step: "build",
99
+ name: "addETag",
100
+ });
101
+ try {
102
+ const data = await S3.send(cmd);
103
+ // console.log(`R2 Success - ${file}`);
104
+ map.set(file, data);
105
+ const fileUrl = await (0, s3_request_presigner_1.getSignedUrl)(S3, cmd);
106
+ urls[file] = fileUrl;
107
+ }
108
+ catch (err) {
109
+ const error = err;
110
+ if (error["$metadata"]) {
111
+ if (error.$metadata.httpStatusCode !== 412) {
112
+ console.log(`R2 Error - ${file} ${config.sourceDir} ${config.destinationDir} \nError: ${error}`);
113
+ console.log("Upload response", error.$response, "with status", error.$metadata.httpStatusCode);
114
+ throw error;
115
+ }
116
+ }
117
+ }
118
+ return;
119
+ }));
120
+ return urls;
121
+ };
122
+ async function uploadDirectory({ sourceDir, fileList, destinationDir, uploadBucket, }) {
123
+ let config = {
124
+ accountId: process.env.R2_ACCOUNT_ID,
125
+ accessKeyId: process.env.R2_ACCESS_KEY_ID,
126
+ secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
127
+ bucket: uploadBucket,
128
+ sourceDir,
129
+ destinationDir,
130
+ fileList,
131
+ };
132
+ const uploadedFiles = await run(config);
133
+ return uploadedFiles;
134
+ }
135
+ exports.uploadDirectory = uploadDirectory;
@@ -0,0 +1,5 @@
1
+ import type { Locator } from "@playwright/test";
2
+ export declare function patchExpect(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,WAAW,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAmC/D"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchExpect = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchExpect(LocatorClass) {
6
+ //@ts-ignore _expect returnsPromise<{ matches: boolean, received?: any, log?: string[], timedOut?: boolean }>
7
+ const originalExpect = LocatorClass.prototype._expect;
8
+ // @ts-ignore _expect is a private method in playwright
9
+ // https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L352
10
+ LocatorClass.prototype._expect = async function (expression, options) {
11
+ const result = await originalExpect.apply(this, [expression, options]);
12
+ if (result.matches) {
13
+ try {
14
+ await this.evaluate((node) => {
15
+ if (node.scrollIntoViewIfNeeded) {
16
+ node.scrollIntoViewIfNeeded();
17
+ }
18
+ else {
19
+ node.scrollIntoView();
20
+ }
21
+ node.classList.add("empirical-element-grab-highlight");
22
+ setTimeout(() => {
23
+ if (node && node.isConnected && node.classList) {
24
+ node.classList.remove("empirical-element-grab-highlight");
25
+ }
26
+ }, 2000);
27
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
28
+ }
29
+ catch (e) {
30
+ console.warn("Failed to add highlight for locator method: _expect");
31
+ }
32
+ }
33
+ return result;
34
+ };
35
+ }
36
+ exports.patchExpect = patchExpect;
@@ -0,0 +1,5 @@
1
+ import { Locator } from "@playwright/test";
2
+ export declare function patchHover(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,UAAU,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA2B9D"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchHover = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchHover(LocatorClass) {
6
+ const originalHover = LocatorClass.prototype.hover;
7
+ LocatorClass.prototype.hover = async function (options) {
8
+ // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L243
9
+ await originalHover.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: hover");
28
+ }
29
+ };
30
+ }
31
+ exports.patchHover = patchHover;
@@ -0,0 +1,5 @@
1
+ import type { Locator } from "@playwright/test";
2
+ export declare function patchInnerText(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=inner-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inner-text.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/inner-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchInnerText = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchInnerText(LocatorClass) {
6
+ const originalInputValue = LocatorClass.prototype.innerText;
7
+ //ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L251
8
+ LocatorClass.prototype.innerText = async function (options) {
9
+ const result = await originalInputValue.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: innerText");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchInnerText = patchInnerText;
@@ -0,0 +1,5 @@
1
+ import type { Locator } from "@playwright/test";
2
+ export declare function patchInputValue(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=input-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-value.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/input-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchInputValue = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchInputValue(LocatorClass) {
6
+ const originalInputValue = LocatorClass.prototype.inputValue;
7
+ //ref: github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L255
8
+ LocatorClass.prototype.inputValue = async function (options) {
9
+ const result = await originalInputValue.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: inputValue");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchInputValue = patchInputValue;
@@ -0,0 +1,5 @@
1
+ import { Locator } from "@playwright/test";
2
+ export declare function patchIsChecked(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=is-checked.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-checked.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/is-checked.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,cAAc,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BlE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchIsChecked = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchIsChecked(LocatorClass) {
6
+ const originalIsChecked = LocatorClass.prototype.isChecked;
7
+ LocatorClass.prototype.isChecked = async function (options) {
8
+ // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L259
9
+ const result = await originalIsChecked.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: isChecked");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchIsChecked = patchIsChecked;
@@ -0,0 +1,5 @@
1
+ import { Locator } from "@playwright/test";
2
+ export declare function patchIsDisabled(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=is-disabled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-disabled.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/is-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchIsDisabled = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchIsDisabled(LocatorClass) {
6
+ const originalIsDisabled = LocatorClass.prototype.isDisabled;
7
+ LocatorClass.prototype.isDisabled = async function (options) {
8
+ // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L263
9
+ const result = await originalIsDisabled.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: isDisabled");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchIsDisabled = patchIsDisabled;
@@ -0,0 +1,5 @@
1
+ import { Locator } from "@playwright/test";
2
+ export declare function patchIsEditable(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=is-editable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-editable.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/is-editable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,wBAAgB,eAAe,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BnE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchIsEditable = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchIsEditable(LocatorClass) {
6
+ const originalIsEditable = LocatorClass.prototype.isEditable;
7
+ LocatorClass.prototype.isEditable = async function (options) {
8
+ // ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L267
9
+ const result = await originalIsEditable.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: isEditable");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchIsEditable = patchIsEditable;
@@ -0,0 +1,5 @@
1
+ import type { Locator } from "@playwright/test";
2
+ export declare function patchTextContent(LocatorClass: {
3
+ prototype: Locator;
4
+ }): void;
5
+ //# sourceMappingURL=text-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-content.d.ts","sourceRoot":"","sources":["../../../../src/test/scripts/pw-locator-patch/text-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QA4BpE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchTextContent = void 0;
4
+ const constants_1 = require("../../constants");
5
+ function patchTextContent(LocatorClass) {
6
+ const originalTextContent = LocatorClass.prototype.textContent;
7
+ //ref: https://github.com/microsoft/playwright/blob/69287f26bc514b740eac40160503d6fac8185d37/packages/playwright-core/src/client/locator.ts#L318
8
+ LocatorClass.prototype.textContent = async function (options) {
9
+ const result = await originalTextContent.apply(this, [options]);
10
+ try {
11
+ await this.evaluate((node) => {
12
+ if (node.scrollIntoViewIfNeeded) {
13
+ node.scrollIntoViewIfNeeded();
14
+ }
15
+ else {
16
+ node.scrollIntoView();
17
+ }
18
+ node.classList.add("empirical-element-grab-highlight");
19
+ setTimeout(() => {
20
+ if (node && node.isConnected && node.classList) {
21
+ node.classList.remove("empirical-element-grab-highlight");
22
+ }
23
+ }, 2000);
24
+ }, undefined, { timeout: constants_1.DEFAULT_SCRIPT_EXECUTION_TIMEOUT });
25
+ }
26
+ catch (e) {
27
+ console.warn("Failed to add highlight for locator method: textContent");
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ exports.patchTextContent = patchTextContent;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/html-reporter/src/types.ts
3
+ * Copyright (c) Microsoft Corporation.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { Metadata } from '@playwright/test';
18
+ export type Stats = {
19
+ total: number;
20
+ expected: number;
21
+ unexpected: number;
22
+ flaky: number;
23
+ skipped: number;
24
+ ok: boolean;
25
+ };
26
+ export type FilteredStats = {
27
+ total: number;
28
+ duration: number;
29
+ };
30
+ export type Location = {
31
+ file: string;
32
+ line: number;
33
+ column: number;
34
+ };
35
+ export type HTMLReport = {
36
+ metadata: Metadata;
37
+ files: TestFileSummary[];
38
+ stats: Stats;
39
+ projectNames: string[];
40
+ startTime: number;
41
+ duration: number;
42
+ errors: string[];
43
+ };
44
+ export type TestFile = {
45
+ fileId: string;
46
+ fileName: string;
47
+ tests: TestCase[];
48
+ };
49
+ export type TestFileSummary = {
50
+ fileId: string;
51
+ fileName: string;
52
+ tests: TestCaseSummary[];
53
+ stats: Stats;
54
+ };
55
+ export type TestCaseAnnotation = {
56
+ type: string;
57
+ description?: string;
58
+ };
59
+ export type TestCaseSummary = {
60
+ testId: string;
61
+ title: string;
62
+ path: string[];
63
+ projectName: string;
64
+ location: Location;
65
+ annotations: TestCaseAnnotation[];
66
+ tags: string[];
67
+ outcome: 'skipped' | 'expected' | 'unexpected' | 'flaky';
68
+ duration: number;
69
+ ok: boolean;
70
+ results: TestResultSummary[];
71
+ };
72
+ export type TestResultSummary = {
73
+ attachments: {
74
+ name: string;
75
+ contentType: string;
76
+ path?: string;
77
+ }[];
78
+ };
79
+ export type TestCase = Omit<TestCaseSummary, 'results'> & {
80
+ results: TestResult[];
81
+ };
82
+ export type TestAttachment = {
83
+ name: string;
84
+ body?: string;
85
+ path?: string;
86
+ contentType: string;
87
+ };
88
+ export type TestResult = {
89
+ retry: number;
90
+ startTime: string;
91
+ duration: number;
92
+ steps: TestStep[];
93
+ errors: string[];
94
+ attachments: TestAttachment[];
95
+ status: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted';
96
+ };
97
+ export type TestStep = {
98
+ title: string;
99
+ startTime: string;
100
+ duration: number;
101
+ location?: Location;
102
+ snippet?: string;
103
+ error?: string;
104
+ steps: TestStep[];
105
+ count: number;
106
+ };
107
+ //# sourceMappingURL=html-reporter-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-reporter-types.d.ts","sourceRoot":"","sources":["../../src/third_party/html-reporter-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,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rE,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG;IACxD,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/html-reporter/src/types.ts
4
+ * Copyright (c) Microsoft Corporation.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.9.1",
3
+ "version": "0.9.3-reporter-revert.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -21,6 +21,14 @@
21
21
  "url": "https://github.com/empirical-run/empirical.git"
22
22
  },
23
23
  "author": "Empirical Team <hey@empirical.run>",
24
+ "scripts": {
25
+ "dev": "tsc --build --watch",
26
+ "build": "tsc --build && node ./../../tools/static-env-vars.js dist",
27
+ "clean": "tsc --build --clean",
28
+ "lint": "eslint .",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest"
31
+ },
24
32
  "devDependencies": {
25
33
  "@playwright/test": "^1.44.1",
26
34
  "@types/node": "^20.14.9"
@@ -29,22 +37,14 @@
29
37
  "@aws-sdk/client-s3": "^3.614.0",
30
38
  "@aws-sdk/s3-request-presigner": "^3.614.0",
31
39
  "@babel/code-frame": "^7.24.7",
40
+ "@empiricalrun/llm": "workspace:^",
41
+ "@empiricalrun/r2-uploader": "workspace:^",
32
42
  "@types/babel__code-frame": "^7.0.6",
33
43
  "@types/md5": "^2.3.5",
34
44
  "@types/mime": "3.0.0",
35
45
  "mailosaur": "^8.6.1",
36
46
  "md5": "^2.3.0",
37
47
  "mime": "3.0.0",
38
- "playwright-core": "^1.46.1",
39
- "@empiricalrun/llm": "^0.9.1",
40
- "@empiricalrun/r2-uploader": "^0.1.1"
41
- },
42
- "scripts": {
43
- "dev": "tsc --build --watch",
44
- "build": "tsc --build && node ./../../tools/static-env-vars.js dist",
45
- "clean": "tsc --build --clean",
46
- "lint": "eslint .",
47
- "test": "vitest run",
48
- "test:watch": "vitest"
48
+ "playwright-core": "^1.46.1"
49
49
  }
50
- }
50
+ }