@applitools/eyes-playwright 1.39.3 → 1.39.4

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.39.4](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.39.3...js/eyes-playwright@1.39.4) (2025-08-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * execute the playwright example with api key in env var | AD-10543 ([#3083](https://github.com/Applitools-Dev/sdk/issues/3083)) ([f842cf9](https://github.com/Applitools-Dev/sdk/commit/f842cf98bf91d23df1b17bfedeae1174883603b1))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/dom-snapshot bumped to 4.13.4
14
+ #### Bug Fixes
15
+
16
+ * canvas blob ([#3194](https://github.com/Applitools-Dev/sdk/issues/3194)) ([d90cfca](https://github.com/Applitools-Dev/sdk/commit/d90cfcaa78df93d4bd8992d77f41eb93edd56f4c))
17
+ * canvas blobs ([#3192](https://github.com/Applitools-Dev/sdk/issues/3192)) ([f15ac4e](https://github.com/Applitools-Dev/sdk/commit/f15ac4ed68cc1746ee6cef51f2258388428fd1c7))
18
+ * @applitools/core bumped to 4.44.5
19
+ #### Bug Fixes
20
+
21
+ * browser extension | FLD-3221 ([#3185](https://github.com/Applitools-Dev/sdk/issues/3185)) ([8212155](https://github.com/Applitools-Dev/sdk/commit/8212155e51ce919beb3bcecc7da1970da4a65be7))
22
+
23
+
24
+
25
+ * @applitools/eyes bumped to 1.36.3
26
+ #### Bug Fixes
27
+
28
+ * browser extension | FLD-3221 ([#3185](https://github.com/Applitools-Dev/sdk/issues/3185)) ([8212155](https://github.com/Applitools-Dev/sdk/commit/8212155e51ce919beb3bcecc7da1970da4a65be7))
29
+
30
+
31
+
32
+
3
33
  ## [1.39.3](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.39.2...js/eyes-playwright@1.39.3) (2025-08-21)
4
34
 
5
35
 
@@ -157,16 +157,17 @@ async function init(args) {
157
157
  }
158
158
  }
159
159
  async function runExample() {
160
- const playwrightTmpConfigPath = './eyes-examples/playwright.tmp.config.ts';
160
+ const playwrightTmpConfigPath = path_1.default.join(process.cwd(), 'eyes-examples', 'playwright.tmp.config.ts');
161
161
  const playwrightTmpExists = fs_1.default.existsSync(playwrightTmpConfigPath);
162
162
  await writeTmpPlaywrightConfig();
163
163
  await runPlaywrightCommand();
164
164
  await cleanupTmpPlaywrightConfig();
165
165
  async function writeTmpPlaywrightConfig() {
166
+ var _a;
166
167
  if (!playwrightTmpExists) {
167
168
  const playwrighConfig = await fs_1.promises.readFile('./playwright.config.ts', 'utf-8');
168
169
  const apikeyMatch = playwrighConfig.match(/apiKey: ([^,]+)/);
169
- const apiKey = apikeyMatch ? apikeyMatch[1] : undefined;
170
+ const apiKey = (_a = apikeyMatch === null || apikeyMatch === void 0 ? void 0 : apikeyMatch[1]) === null || _a === void 0 ? void 0 : _a.replace(/[^a-zA-Z0-9]/g, '');
170
171
  const serverUrlMatch = playwrighConfig.match(/serverUrl: ([^,]+)/);
171
172
  const serverUrl = serverUrlMatch ? serverUrlMatch[1] : undefined;
172
173
  const playwrightTmpConfig = `import { defineConfig, devices } from '@playwright/test';
@@ -177,8 +178,12 @@ export default defineConfig<EyesFixture>({
177
178
  reporter: [['@applitools/eyes-playwright/reporter', {open: 'always', outputFolder: './eyes-playwright-report'}]],
178
179
  use: {
179
180
  eyesConfig: {
180
- apiKey: ${apiKey !== null && apiKey !== void 0 ? apiKey : ''},
181
- serverUrl: ${serverUrl !== null && serverUrl !== void 0 ? serverUrl : ''}
181
+ ${apiKey
182
+ ? `apiKey: '${apiKey}'`
183
+ : "// apiKey: '' // alternatively, set this via environment variable APPLITOOLS_API_KEY"},
184
+ ${serverUrl
185
+ ? `serverUrl: ${serverUrl}`
186
+ : "// serverUrl: 'https://eyes.applitools.com' // alternatively, set this via environment variable APPLITOOLS_SERVER_URL"}
182
187
  }
183
188
  }
184
189
  })`;
@@ -191,7 +196,9 @@ export default defineConfig<EyesFixture>({
191
196
  }
192
197
  }
193
198
  async function runPlaywrightCommand() {
194
- await utils.process.sh(`npx playwright test --config ${playwrightTmpConfigPath}`, {
199
+ // Use path normalization and quotes to support Windows paths with spaces/backslashes
200
+ const quotedConfigPath = `"${playwrightTmpConfigPath}"`;
201
+ await utils.process.sh(`npx playwright test --config ${quotedConfigPath}`, {
195
202
  spawnOptions: { stdio: 'inherit' },
196
203
  });
197
204
  }
@@ -37,7 +37,31 @@ async function getEyes({ testInfo, eyesConfig, eyesRunner, page, }) {
37
37
  eyes.check = makeStep('eyes.check', eyes.check.bind(eyes));
38
38
  eyes.close = makeStep('eyes.close', eyes.close.bind(eyes));
39
39
  eyes.closeAsync = makeStep('eyes.closeAsync (without exception)', eyes.closeAsync.bind(eyes));
40
+ // INTERNAL DEBUG CALLBACKS - Execute beforeOpen callback if provided
41
+ const mergedConfig = { ...playwrightConfig, ...projectConfig, ...eyesConfig };
42
+ if (mergedConfig.beforeOpen) {
43
+ try {
44
+ await mergedConfig.beforeOpen();
45
+ }
46
+ catch (error) {
47
+ // Don't let callback failures break the main flow, just log the error
48
+ // eslint-disable-next-line no-console
49
+ console.warn('👀 beforeOpen callback failed:', error);
50
+ }
51
+ }
40
52
  await eyes.open(page, configuration.appName, configuration.testName);
53
+ // INTERNAL DEBUG CALLBACKS - Execute afterOpen callback if provided
54
+ if (mergedConfig.afterOpen) {
55
+ try {
56
+ await mergedConfig.afterOpen();
57
+ }
58
+ catch (error) {
59
+ // Don't let callback failures break the main flow, just log the error
60
+ // eslint-disable-next-line no-console
61
+ console.warn('👀 afterOpen callback failed:', error);
62
+ }
63
+ }
64
+ ;
41
65
  page.__eyes = eyes;
42
66
  eyesRunner.isUsed = true;
43
67
  return eyes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-playwright",
3
- "version": "1.39.3",
3
+ "version": "1.39.4",
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.36.2",
62
+ "@applitools/eyes": "1.36.3",
63
63
  "@applitools/req": "1.8.2",
64
64
  "@applitools/spec-driver-playwright": "1.7.3",
65
65
  "@applitools/utils": "1.11.1",