@applitools/eyes-playwright 1.38.1 → 1.38.2

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,39 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.38.2](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.38.1...js/eyes-playwright@1.38.2) (2025-07-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * blob reporter results saving ([#3108](https://github.com/Applitools-Dev/sdk/issues/3108)) ([d542241](https://github.com/Applitools-Dev/sdk/commit/d542241a971f03c4a42f55a54ae159ef807186e0))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/nml-client bumped to 1.10.0
14
+ #### Features
15
+
16
+ * android multi target | AD-9868 ([#2943](https://github.com/Applitools-Dev/sdk/issues/2943)) ([808aa21](https://github.com/Applitools-Dev/sdk/commit/808aa21e489c3562b93006e2e26ff7ffbb743dd6))
17
+
18
+
19
+
20
+ * @applitools/core-base bumped to 1.26.0
21
+ #### Features
22
+
23
+ * batch properties limit | FLD-3174 ([#3080](https://github.com/Applitools-Dev/sdk/issues/3080)) ([feb9e79](https://github.com/Applitools-Dev/sdk/commit/feb9e79d79f5eab3c58eac2b4ef3c15a562f079c))
24
+ * @applitools/core bumped to 4.43.0
25
+ #### Features
26
+
27
+ * android multi target | AD-9868 ([#2943](https://github.com/Applitools-Dev/sdk/issues/2943)) ([808aa21](https://github.com/Applitools-Dev/sdk/commit/808aa21e489c3562b93006e2e26ff7ffbb743dd6))
28
+ * batch properties limit | FLD-3174 ([#3080](https://github.com/Applitools-Dev/sdk/issues/3080)) ([feb9e79](https://github.com/Applitools-Dev/sdk/commit/feb9e79d79f5eab3c58eac2b4ef3c15a562f079c))
29
+
30
+
31
+
32
+ * @applitools/ec-client bumped to 1.11.1
33
+
34
+ * @applitools/eyes bumped to 1.35.3
35
+
36
+
3
37
  ## [1.38.1](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.38.0...js/eyes-playwright@1.38.1) (2025-07-15)
4
38
 
5
39
 
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.InternalData = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
+ const os = __importStar(require("os"));
29
30
  const playwrightPath = require.resolve('playwright');
30
31
  const HtmlReporter = require(path.join(path.dirname(playwrightPath), '/lib/reporters/html')).default;
31
32
  const pluginsFile = require.resolve('../../dist/fixture/reportRenderer.js');
@@ -45,8 +46,13 @@ const createInjectedScript = (testResultsMap) => `
45
46
  class EyesReporter extends HtmlReporter {
46
47
  constructor(options) {
47
48
  super(options);
49
+ this.stdoutData = '';
48
50
  this.applitoolsIdentifiersAndFolders = [];
49
51
  }
52
+ onStdOut(chunk) {
53
+ // Capture stdout data for blob reporter scenarios
54
+ this.stdoutData += chunk.toString();
55
+ }
50
56
  onTestEnd(test, result) {
51
57
  var _a;
52
58
  (_a = super.onTestEnd) === null || _a === void 0 ? void 0 : _a.call(this, test, result);
@@ -74,7 +80,7 @@ class EyesReporter extends HtmlReporter {
74
80
  await super.onEnd(result);
75
81
  const testResultsMap = {};
76
82
  for (const applitoolsIdentifierAndFolder of this.applitoolsIdentifiersAndFolders) {
77
- const content = await exports.InternalData.consume(applitoolsIdentifierAndFolder);
83
+ const content = await exports.InternalData.consume(applitoolsIdentifierAndFolder, this.stdoutData);
78
84
  if (content) {
79
85
  testResultsMap[content.key] = content.data;
80
86
  }
@@ -90,7 +96,17 @@ class EyesReporter extends HtmlReporter {
90
96
  }
91
97
  }
92
98
  exports.default = EyesReporter;
99
+ const defaultDataDirectory = path.join(os.tmpdir(), 'eyes-playwright-data');
93
100
  exports.InternalData = {
101
+ determineDirectory(testInfo) {
102
+ var _a;
103
+ const blobReporter = testInfo.config.reporter.find(r => r[0].includes('blob'));
104
+ const customOutputDir = (_a = blobReporter === null || blobReporter === void 0 ? void 0 : blobReporter[1]) === null || _a === void 0 ? void 0 : _a.outputDir;
105
+ return customOutputDir ? path.join(customOutputDir, 'eyes-report-files') : defaultDataDirectory;
106
+ },
107
+ hasBlobReporter(testInfo) {
108
+ return testInfo.config.reporter.some(r => r[0].includes('blob'));
109
+ },
94
110
  async write({ testInfo, data }) {
95
111
  const [applitoolsIdentifier, folder] = testInfo.attachments
96
112
  .find(a => a.name === 'applitoolsIdentifier')
@@ -99,29 +115,66 @@ exports.InternalData = {
99
115
  .map(s => s.trim())
100
116
  .filter(Boolean); // if the directory is not specified, it will be empty
101
117
  const key = `${testInfo.testId}--${testInfo.retry}`;
102
- this.ensureFolder(folder);
103
- await fs.promises.writeFile(this.getPathForInternalId(applitoolsIdentifier, folder), JSON.stringify({ key, data }));
118
+ if (this.hasBlobReporter(testInfo)) {
119
+ // Use stdout approach for blob reporter scenarios
120
+ // eslint-disable-next-line no-console
121
+ console.log(`EYES_DATA:${applitoolsIdentifier}:${JSON.stringify({ key, data })}`);
122
+ }
123
+ else {
124
+ // Use file approach for direct reporter scenarios
125
+ const targetFolder = folder || this.determineDirectory(testInfo);
126
+ this.ensureFolder(targetFolder);
127
+ await fs.promises.writeFile(this.getPathForInternalId(applitoolsIdentifier, targetFolder), JSON.stringify({ key, data }));
128
+ }
104
129
  },
105
- async consume(applitoolsIdentifierAndFolder) {
130
+ async consume(applitoolsIdentifierAndFolder, stdoutData) {
106
131
  const [name, folder] = applitoolsIdentifierAndFolder
107
132
  .split('|')
108
133
  .map(s => s.trim())
109
134
  .filter(Boolean); // if the directory is not specified, it will be empty
110
- const filepath = this.getPathForInternalId(name, folder);
111
- try {
112
- const content = await fs.promises.readFile(filepath, 'utf-8').then(JSON.parse);
113
- return content;
135
+ // Try stdout data first (for blob reporter scenarios), then fall back to files
136
+ if (stdoutData) {
137
+ // Parse from stdout for blob reporter scenarios
138
+ const results = this.parseStdoutLine(name, stdoutData);
139
+ // Return the last result if multiple exist, or undefined if none
140
+ return results.length > 0 ? results[results.length - 1] : undefined;
141
+ }
142
+ else {
143
+ // Read from file for direct reporter scenarios
144
+ const targetFolder = folder || defaultDataDirectory;
145
+ const filepath = this.getPathForInternalId(name, targetFolder);
146
+ try {
147
+ const content = await fs.promises.readFile(filepath, 'utf-8').then(JSON.parse);
148
+ return content;
149
+ }
150
+ catch (err) {
151
+ // TODO no eyes results for test - this is ok, could be that no visual tests occurred for this playwright test
152
+ }
114
153
  }
115
- catch (err) {
116
- // TODO no eyes results for test - this is ok, could be that no visual tests occurred for this playwright test
154
+ },
155
+ parseStdoutLine(identifier, stdoutData) {
156
+ const lines = stdoutData.split('\n');
157
+ const eyesLines = lines.filter(line => line.startsWith(`EYES_DATA:${identifier}:`));
158
+ const results = [];
159
+ for (const eyesLine of eyesLines) {
160
+ const jsonPart = eyesLine.replace(`EYES_DATA:${identifier}:`, '');
161
+ try {
162
+ const parsed = JSON.parse(jsonPart);
163
+ results.push(parsed);
164
+ }
165
+ catch (err) {
166
+ // Skip invalid JSON lines
167
+ continue;
168
+ }
117
169
  }
170
+ return results;
118
171
  },
119
- ensureFolder(folderPath = path.join('blob-report', 'eyes-report-files')) {
172
+ ensureFolder(folderPath = defaultDataDirectory) {
120
173
  if (!fs.existsSync(folderPath)) {
121
174
  fs.mkdirSync(folderPath, { recursive: true });
122
175
  }
123
176
  },
124
- getPathForInternalId(applitoolsIdentifier, folderPath = path.join('blob-report', 'eyes-report-files')) {
177
+ getPathForInternalId(applitoolsIdentifier, folderPath = defaultDataDirectory) {
125
178
  return path.join(folderPath, applitoolsIdentifier);
126
179
  },
127
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-playwright",
3
- "version": "1.38.1",
3
+ "version": "1.38.2",
4
4
  "description": "Applitools Eyes SDK for Playwright",
5
5
  "keywords": [
6
6
  "eyes-playwright",
@@ -59,7 +59,7 @@
59
59
  "up:framework": "echo \"$(jq '.devDependencies.playwright = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
60
60
  },
61
61
  "dependencies": {
62
- "@applitools/eyes": "1.35.2",
62
+ "@applitools/eyes": "1.35.3",
63
63
  "@applitools/spec-driver-playwright": "1.6.1",
64
64
  "@applitools/utils": "1.9.0",
65
65
  "@inquirer/prompts": "7.0.1",