@applitools/eyes-playwright 1.37.3 → 1.38.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,125 @@
1
1
  # Changelog
2
2
 
3
+ ## [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
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * example visual check for search box in system theme | AD-10586 ([#3089](https://github.com/Applitools-Dev/sdk/issues/3089)) ([0a50c8d](https://github.com/Applitools-Dev/sdk/commit/0a50c8d689f8acf236c01df105b96904141f5ad7))
9
+ * eyes playwright types ([c63ae80](https://github.com/Applitools-Dev/sdk/commit/c63ae80292ef363b022eb933d1bb6fbf2dd57e3d))
10
+
11
+
12
+ ### Performance Improvements
13
+
14
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
15
+
16
+
17
+ ### Dependencies
18
+
19
+ * @applitools/dom-snapshot bumped to 4.12.1
20
+ #### Performance Improvements
21
+
22
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
23
+
24
+
25
+
26
+ * @applitools/req bumped to 1.7.15
27
+ #### Performance Improvements
28
+
29
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
30
+ * @applitools/driver bumped to 1.22.1
31
+ #### Performance Improvements
32
+
33
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
34
+ * @applitools/spec-driver-selenium bumped to 1.6.1
35
+
36
+ * @applitools/spec-driver-playwright bumped to 1.6.1
37
+
38
+ * @applitools/screenshoter bumped to 3.11.7
39
+ #### Performance Improvements
40
+
41
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
42
+
43
+
44
+
45
+ * @applitools/nml-client bumped to 1.9.7
46
+ #### Performance Improvements
47
+
48
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
49
+
50
+
51
+
52
+ * @applitools/tunnel-client bumped to 1.9.0
53
+ #### Features
54
+
55
+ * enable EC healthchecks | AD-10040 ([#3017](https://github.com/Applitools-Dev/sdk/issues/3017)) ([c01c300](https://github.com/Applitools-Dev/sdk/commit/c01c300259427ddae53147a64d30b152960503d9))
56
+
57
+
58
+
59
+ * @applitools/ufg-client bumped to 1.16.14
60
+ #### Performance Improvements
61
+
62
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
63
+
64
+
65
+
66
+ * @applitools/core-base bumped to 1.25.6
67
+ #### Performance Improvements
68
+
69
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
70
+
71
+
72
+
73
+ * @applitools/ec-client bumped to 1.11.0
74
+ #### Features
75
+
76
+ * enable EC healthchecks | AD-10040 ([#3017](https://github.com/Applitools-Dev/sdk/issues/3017)) ([c01c300](https://github.com/Applitools-Dev/sdk/commit/c01c300259427ddae53147a64d30b152960503d9))
77
+
78
+
79
+ #### Performance Improvements
80
+
81
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
82
+
83
+
84
+
85
+ * @applitools/core bumped to 4.42.0
86
+ #### Features
87
+
88
+ * enable EC healthchecks | AD-10040 ([#3017](https://github.com/Applitools-Dev/sdk/issues/3017)) ([c01c300](https://github.com/Applitools-Dev/sdk/commit/c01c300259427ddae53147a64d30b152960503d9))
89
+
90
+
91
+ #### Performance Improvements
92
+
93
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
94
+
95
+
96
+
97
+ * @applitools/spec-driver-webdriver bumped to 1.3.1
98
+
99
+ * @applitools/spec-driver-puppeteer bumped to 1.5.1
100
+
101
+ * @applitools/eyes bumped to 1.35.2
102
+ #### Performance Improvements
103
+
104
+ * yarn dedup packages ([#3061](https://github.com/Applitools-Dev/sdk/issues/3061)) ([2fd8951](https://github.com/Applitools-Dev/sdk/commit/2fd8951d6ce9c18a5dbdb648adaa2c454eae9b4e))
105
+
106
+
107
+
108
+
109
+ ## [1.38.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.37.3...js/eyes-playwright@1.38.0) (2025-07-09)
110
+
111
+
112
+ ### Features
113
+
114
+ * canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
115
+ * support sharding for the eyes-playwright fixture | FLD-3026 ([#3056](https://github.com/Applitools-Dev/sdk/issues/3056)) ([96191bc](https://github.com/Applitools-Dev/sdk/commit/96191bcf8f13b5360ae5e50e13f20a6b198ff78e))
116
+
117
+
118
+ ### Bug Fixes
119
+
120
+ * export type Eyes from the PW fixture ([fd3a9f0](https://github.com/Applitools-Dev/sdk/commit/fd3a9f025da6023f6d500cebd2bf65d26acb5f3e))
121
+ * playwright worker configuration | FLD-2837 ([#3029](https://github.com/Applitools-Dev/sdk/issues/3029)) ([07014ec](https://github.com/Applitools-Dev/sdk/commit/07014ec5f3a16ed620c6ac243523cee05f02a7fd))
122
+
3
123
  ## [1.37.3](https://github.com/Applitools-Dev/sdk/compare/js/eyes-playwright@1.37.2...js/eyes-playwright@1.37.3) (2025-06-15)
4
124
 
5
125
 
@@ -9,9 +9,13 @@ test('Playwright website', async ({ page, eyes }) => {
9
9
  const searchBox = page.getByLabel('Search')
10
10
 
11
11
  /* Region visual check - "Search" component in light theme */
12
+ await eyes.check('Search box in system theme', { region: searchBox })
13
+
14
+ await page.getByLabel('Switch between dark and light').click(); // Switch to light theme
15
+
12
16
  await eyes.check('Search box in light theme', {region: searchBox})
13
17
 
14
- await page.getByLabel('Switch between dark and light').click();
18
+ await page.getByLabel('Switch between dark and light').click(); // Switch to dark theme
15
19
 
16
20
  /* Region visual check - "Search" component in dark theme */
17
21
  await eyes.check('Search box in dark theme', {region: searchBox})
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.test = exports.expect = void 0;
27
30
  /* eslint-disable no-console */
@@ -33,6 +36,7 @@ Object.defineProperty(exports, "expect", { enumerable: true, get: function () {
33
36
  const utils = __importStar(require("@applitools/utils"));
34
37
  const reporter_1 = require("./reporter");
35
38
  const url_1 = require("url");
39
+ const path_1 = __importDefault(require("path"));
36
40
  exports.test = test_1.test.extend({
37
41
  eyesConfig: [{}, { option: true }],
38
42
  eyesRunner: [
@@ -85,10 +89,20 @@ exports.test = test_1.test.extend({
85
89
  ],
86
90
  closeEyesIfNeeded: [
87
91
  async ({ page, eyesConfig, eyesRunner: runner }, use, testInfo) => {
88
- const isUsingEyesReporter = testInfo.config.reporter.some(r => r[0].includes('eyes-playwright'));
92
+ var _a, _b, _c, _d, _e, _f;
93
+ const isUsingEyesReporter = testInfo.config.reporter.some(
94
+ // typeof testInfo.config.reporter is [string, ReporterOptions][], that's why [0] is the reporter name
95
+ r => r[0].includes('eyes-playwright') || r[0].includes('blob'));
96
+ const blobSettings = (_b = (_a = testInfo.config.reporter.find(r => r[0].includes('blob'))) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : {};
97
+ const blobFolder = (_d = (_c = blobSettings.outputDir) !== null && _c !== void 0 ? _c : process.env.PLAYWRIGHT_BLOB_OUTPUT_DIR) !== null && _d !== void 0 ? _d : (((_e = process.env.PLAYWRIGHT_BLOB_OUTPUT_FILE) !== null && _e !== void 0 ? _e : blobSettings.outputFile)
98
+ ? path_1.default.basename((_f = process.env.PLAYWRIGHT_BLOB_OUTPUT_FILE) !== null && _f !== void 0 ? _f : blobSettings.outputFile)
99
+ : '');
89
100
  if (isUsingEyesReporter) {
90
- const internalId = utils.general.guid();
91
- await testInfo.attach('internalId', { body: internalId });
101
+ const applitoolsIdentifier = utils.general.guid();
102
+ // Create an identifier that will be collected by the html or reporter
103
+ await testInfo.attach('applitoolsIdentifier', {
104
+ body: `${applitoolsIdentifier}|${blobFolder}`,
105
+ });
92
106
  }
93
107
  await use();
94
108
  const eyes = page.__eyes;
@@ -132,14 +146,16 @@ function writeResultsWhenReady({ eyes, runner, testInfo }) {
132
146
  }));
133
147
  }
134
148
  async function getEyesConfigForWorker(workerInfo) {
135
- var _a, _b, _c;
149
+ var _a, _b, _c, _d;
136
150
  const { configFile } = workerInfo.config;
137
- const playwrightConfig = (_b = (_a = ((configFile ? await import((0, url_1.pathToFileURL)(configFile).href) : {}))) === null || _a === void 0 ? void 0 : _a.use) === null || _b === void 0 ? void 0 : _b.eyesConfig;
151
+ const playwrightConfigModule = configFile ? await import((0, url_1.pathToFileURL)(configFile).href) : {};
152
+ const playwrightConfig = ((_a = playwrightConfigModule === null || playwrightConfigModule === void 0 ? void 0 : playwrightConfigModule.use) === null || _a === void 0 ? void 0 : _a.eyesConfig) ||
153
+ ((_c = (_b = playwrightConfigModule === null || playwrightConfigModule === void 0 ? void 0 : playwrightConfigModule.default) === null || _b === void 0 ? void 0 : _b.use) === null || _c === void 0 ? void 0 : _c.eyesConfig);
138
154
  const projectConfig = workerInfo.project.use.eyesConfig;
139
155
  const eyesConfig = {
140
156
  ...playwrightConfig,
141
157
  ...projectConfig,
142
158
  };
143
- (_c = eyesConfig.failTestsOnDiff) !== null && _c !== void 0 ? _c : (eyesConfig.failTestsOnDiff = process.env.CI ? 'afterAll' : 'afterEach');
159
+ (_d = eyesConfig.failTestsOnDiff) !== null && _d !== void 0 ? _d : (eyesConfig.failTestsOnDiff = process.env.CI ? 'afterAll' : 'afterEach');
144
160
  return eyesConfig;
145
161
  }
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.InternalData = void 0;
27
- const os = __importStar(require("os"));
28
27
  const fs = __importStar(require("fs"));
29
28
  const path = __importStar(require("path"));
30
29
  const playwrightPath = require.resolve('playwright');
@@ -46,30 +45,36 @@ const createInjectedScript = (testResultsMap) => `
46
45
  class EyesReporter extends HtmlReporter {
47
46
  constructor(options) {
48
47
  super(options);
49
- this.internalIds = [];
48
+ this.applitoolsIdentifiersAndFolders = [];
50
49
  }
51
50
  onTestEnd(test, result) {
52
51
  var _a;
53
52
  (_a = super.onTestEnd) === null || _a === void 0 ? void 0 : _a.call(this, test, result);
54
- const index = result.attachments.findIndex(a => a.name === 'internalId');
53
+ const index = result.attachments.findIndex(a => a.name === 'applitoolsIdentifier');
55
54
  if (index > -1) {
56
- const internalId = result.attachments[index].body.toString();
57
- this.internalIds.push(internalId);
55
+ const applitoolsIdentifierAndFolder = result.attachments[index].body.toString();
56
+ this.applitoolsIdentifiersAndFolders.push(applitoolsIdentifierAndFolder);
58
57
  this.removeInternalIdAttachment(result);
59
58
  }
60
59
  }
60
+ // TODO: let's remove this method! Removing the internal id from the test result is wrong,
61
+ // it should be hidden in the HTML report and the test result should be read-only.
61
62
  removeInternalIdAttachment(result) {
62
- var _a;
63
- const index = result.attachments ? result.attachments.findIndex(a => a.name === 'internalId') : -1;
63
+ var _a, _b, _c;
64
+ const index = result.attachments ? result.attachments.findIndex(a => (a === null || a === void 0 ? void 0 : a.name) === 'applitoolsIdentifier') : -1;
64
65
  if (index > -1)
65
66
  (_a = result.attachments) === null || _a === void 0 ? void 0 : _a.splice(index, 1);
66
- result.steps.forEach(step => this.removeInternalIdAttachment(step));
67
+ const index2 = result.attachments ? result.attachments.findIndex(a => !a) : -1;
68
+ if (index2 > -1)
69
+ (_c = (_b = result._endPayload) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.splice(index2, 1);
70
+ if (result.steps)
71
+ result.steps.forEach(step => this.removeInternalIdAttachment(step));
67
72
  }
68
73
  async onEnd(result) {
69
74
  await super.onEnd(result);
70
75
  const testResultsMap = {};
71
- for (const internalId of this.internalIds) {
72
- const content = await exports.InternalData.consume(internalId);
76
+ for (const applitoolsIdentifierAndFolder of this.applitoolsIdentifiersAndFolders) {
77
+ const content = await exports.InternalData.consume(applitoolsIdentifierAndFolder);
73
78
  if (content) {
74
79
  testResultsMap[content.key] = content.data;
75
80
  }
@@ -87,29 +92,36 @@ class EyesReporter extends HtmlReporter {
87
92
  exports.default = EyesReporter;
88
93
  exports.InternalData = {
89
94
  async write({ testInfo, data }) {
90
- const internalId = testInfo.attachments.find(a => a.name === 'internalId').body.toString();
95
+ const [applitoolsIdentifier, folder] = testInfo.attachments
96
+ .find(a => a.name === 'applitoolsIdentifier')
97
+ .body.toString()
98
+ .split('|')
99
+ .map(s => s.trim())
100
+ .filter(Boolean); // if the directory is not specified, it will be empty
91
101
  const key = `${testInfo.testId}--${testInfo.retry}`;
92
- this.ensureFolder();
93
- await fs.promises.writeFile(this.getPathForInternalId(internalId), JSON.stringify({ key, data }));
102
+ this.ensureFolder(folder);
103
+ await fs.promises.writeFile(this.getPathForInternalId(applitoolsIdentifier, folder), JSON.stringify({ key, data }));
94
104
  },
95
- async consume(internalId) {
96
- const filepath = this.getPathForInternalId(internalId);
105
+ async consume(applitoolsIdentifierAndFolder) {
106
+ const [name, folder] = applitoolsIdentifierAndFolder
107
+ .split('|')
108
+ .map(s => s.trim())
109
+ .filter(Boolean); // if the directory is not specified, it will be empty
110
+ const filepath = this.getPathForInternalId(name, folder);
97
111
  try {
98
112
  const content = await fs.promises.readFile(filepath, 'utf-8').then(JSON.parse);
99
- await fs.promises.unlink(filepath);
100
113
  return content;
101
114
  }
102
115
  catch (err) {
103
116
  // TODO no eyes results for test - this is ok, could be that no visual tests occurred for this playwright test
104
117
  }
105
118
  },
106
- ensureFolder() {
107
- const folderPath = path.join(os.tmpdir(), 'eyes-report-files');
119
+ ensureFolder(folderPath = path.join('blob-report', 'eyes-report-files')) {
108
120
  if (!fs.existsSync(folderPath)) {
109
- fs.mkdirSync(folderPath);
121
+ fs.mkdirSync(folderPath, { recursive: true });
110
122
  }
111
123
  },
112
- getPathForInternalId(internalId) {
113
- return path.join(os.tmpdir(), 'eyes-report-files', internalId);
124
+ getPathForInternalId(applitoolsIdentifier, folderPath = path.join('blob-report', 'eyes-report-files')) {
125
+ return path.join(folderPath, applitoolsIdentifier);
114
126
  },
115
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-playwright",
3
- "version": "1.37.3",
3
+ "version": "1.38.1",
4
4
  "description": "Applitools Eyes SDK for Playwright",
5
5
  "keywords": [
6
6
  "eyes-playwright",
@@ -54,14 +54,14 @@
54
54
  "test": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Tests: eyes-playwright' APPLITOOLS_BATCH_ID=$(uuidgen) run --top-level mocha './test/*.spec.{js,ts}' --exit",
55
55
  "test:coverage": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-playwright' APPLITOOLS_BATCH_ID=$(uuidgen) MOCHA_GROUP=coverage run --top-level mocha './test/generated-coverage/*.spec.js' --parallel --jobs ${MOCHA_JOBS:-8} --exit",
56
56
  "test:fixture": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(npx uuid).log\" APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-playwright-fixture' APPLITOOLS_BATCH_ID=$(npx uuid) run playwright test",
57
- "setup": "run playwright:setup",
57
+ "setup": "run playwright:setup && run --top-level xvfb:setup",
58
58
  "playwright:setup": "yarn playwright install --with-deps chromium firefox webkit",
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.1",
63
- "@applitools/spec-driver-playwright": "1.5.13",
64
- "@applitools/utils": "1.8.2",
62
+ "@applitools/eyes": "1.35.2",
63
+ "@applitools/spec-driver-playwright": "1.6.1",
64
+ "@applitools/utils": "1.9.0",
65
65
  "@inquirer/prompts": "7.0.1",
66
66
  "chalk": "4.1.2",
67
67
  "yargs": "17.7.2"
@@ -35,7 +35,7 @@ export type EyesConfig = Omit<
35
35
  afterAll?: (results: Array<TestResultContainer>) => Promise<void>
36
36
  }
37
37
 
38
- type Eyes = Pick<BaseEyes, 'locate' | 'extractText' | 'extractTextRegions'> & {
38
+ export type Eyes = Pick<BaseEyes, 'locate' | 'extractText' | 'extractTextRegions'> & {
39
39
  check(name?: string, checkSettings?: CheckSettingsAutomationPlain): Promise<MatchResult>
40
40
  }
41
41