@empiricalrun/playwright-utils 0.27.9 → 0.27.11

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.27.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 5fe035e: feat: add R2 cred check in empirical reporter
8
+ - Updated dependencies [c0c1a9a]
9
+ - Updated dependencies [d67ca35]
10
+ - Updated dependencies [9a923e2]
11
+ - @empiricalrun/test-gen@0.69.6
12
+ - @empiricalrun/llm@0.19.2
13
+
14
+ ## 0.27.10
15
+
16
+ ### Patch Changes
17
+
18
+ - 385cf7d: fix: ora needs dynamic import for nodejs 20
19
+ - Updated dependencies [385cf7d]
20
+ - @empiricalrun/test-gen@0.69.5
21
+
3
22
  ## 0.27.9
4
23
 
5
24
  ### Patch Changes
@@ -177,7 +177,7 @@ class HtmlReporter {
177
177
  this.config = config;
178
178
  }
179
179
  onBegin(suite) {
180
- console.log("Using @empiricalrun/playwright-utils custom reporter");
180
+ logger_1.logger.debug("Using @empiricalrun/playwright-utils custom reporter");
181
181
  const { outputFolder, open, attachmentsBaseURL, host, port } = this._resolveOptions();
182
182
  this._outputFolder = outputFolder;
183
183
  this._open = open;
@@ -3,6 +3,8 @@ declare class EmpiricalReporter implements Reporter {
3
3
  private _destinationDir;
4
4
  private _uploadBucket;
5
5
  private _currentWorkingDir;
6
+ private _willUploadArtifacts;
7
+ private checkR2Creds;
6
8
  constructor();
7
9
  private processTestAttachment;
8
10
  onTestEnd(test: TestCase, result: TestResult): void;
@@ -1 +1 @@
1
- {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAgBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;;IAcnD,OAAO,CAAC,qBAAqB,CA0B3B;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAsEtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA4F/B;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAgBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAE9C,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,qBAAqB,CA0B3B;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAyEtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA+F/B;AAED,eAAe,iBAAiB,CAAC"}
@@ -14,6 +14,16 @@ class EmpiricalReporter {
14
14
  _destinationDir;
15
15
  _uploadBucket = "test-report";
16
16
  _currentWorkingDir = process.cwd();
17
+ _willUploadArtifacts = false;
18
+ checkR2Creds() {
19
+ if (!process.env.R2_ACCOUNT_ID ||
20
+ !process.env.R2_ACCESS_KEY_ID ||
21
+ !process.env.R2_SECRET_ACCESS_KEY) {
22
+ logger_1.logger.debug("R2 credentials not found, skipping artifact upload");
23
+ return false;
24
+ }
25
+ return true;
26
+ }
17
27
  constructor() {
18
28
  if (!process.env.PROJECT_NAME || !process.env.TEST_RUN_GITHUB_ACTION_ID) {
19
29
  logger_1.logger.debug("PROJECT_NAME and TEST_RUN_GITHUB_ACTION_ID must be set");
@@ -21,6 +31,7 @@ class EmpiricalReporter {
21
31
  return;
22
32
  }
23
33
  this._destinationDir = path_1.default.join(process.env.PROJECT_NAME, process.env.TEST_RUN_GITHUB_ACTION_ID);
34
+ this._willUploadArtifacts = this.checkR2Creds();
24
35
  }
25
36
  processTestAttachment = async (attachment) => {
26
37
  if (!attachment.path)
@@ -43,6 +54,9 @@ class EmpiricalReporter {
43
54
  return (0, queue_1.sendTaskToQueue)(uploadTask);
44
55
  };
45
56
  onTestEnd(test, result) {
57
+ if (!this._willUploadArtifacts) {
58
+ return;
59
+ }
46
60
  if (!process.env.TEST_RUN_GITHUB_ACTION_ID) {
47
61
  logger_1.logger.debug("[Empirical Reporter] TEST_RUN_GITHUB_ACTION_ID is not set");
48
62
  return;
@@ -100,6 +114,9 @@ class EmpiricalReporter {
100
114
  }
101
115
  }
102
116
  async onEnd(result) {
117
+ if (!this._willUploadArtifacts) {
118
+ return;
119
+ }
103
120
  logger_1.logger.debug(`[Empirical Reporter] Test run completed with status: ${result.status}`);
104
121
  const startTime = new Date().getTime();
105
122
  logger_1.logger.debug("[Empirical Reporter] Starting final report upload at: ", new Intl.DateTimeFormat("en-US", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.27.9",
3
+ "version": "0.27.11",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -32,7 +32,7 @@
32
32
  "@types/adm-zip": "^0.5.7",
33
33
  "playwright-core": "1.53.0",
34
34
  "serve-handler": "^6.1.6",
35
- "@empiricalrun/shared-types": "0.6.0"
35
+ "@empiricalrun/shared-types": "0.6.1"
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/code-frame": "^7.24.7",
@@ -43,9 +43,9 @@
43
43
  "mailosaur": "^8.6.1",
44
44
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
45
45
  "rimraf": "^6.0.1",
46
- "@empiricalrun/llm": "^0.19.1",
46
+ "@empiricalrun/llm": "^0.19.2",
47
47
  "@empiricalrun/r2-uploader": "^0.3.9",
48
- "@empiricalrun/test-gen": "^0.69.4"
48
+ "@empiricalrun/test-gen": "^0.69.6"
49
49
  },
50
50
  "scripts": {
51
51
  "dev": "tsc --build --watch",