@applitools/spec-driver-playwright 1.5.13 → 1.6.0

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.0](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-playwright@1.5.13...js/spec-driver-playwright@1.6.0) (2025-07-07)
4
+
5
+
6
+ ### Features
7
+
8
+ * 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))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/utils bumped to 1.9.0
14
+ #### Features
15
+
16
+ * support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
17
+ * @applitools/logger bumped to 2.1.5
18
+
19
+ * @applitools/driver bumped to 1.22.0
20
+ #### Features
21
+
22
+ * 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))
23
+
24
+
25
+
26
+
3
27
  ## [1.5.13](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-playwright@1.5.12...js/spec-driver-playwright@1.5.13) (2025-05-11)
4
28
 
5
29
 
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.build = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getCookies = exports.setViewportSize = exports.getViewportSize = exports.getDriverInfo = exports.childContext = exports.parentContext = exports.mainContext = exports.click = exports.hover = exports.setElementText = exports.findElements = exports.findElement = exports.executeScript = exports.extractContext = exports.toSimpleCommonSelector = exports.toSelector = exports.isStaleElementError = exports.isSelector = exports.isElement = exports.isContext = exports.isDriver = void 0;
26
+ exports.build = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getCookies = exports.setViewportSize = exports.getViewportSize = exports.getDriverInfo = exports.childContext = exports.parentContext = exports.mainContext = exports.click = exports.hover = exports.setElementText = exports.findElements = exports.findElement = exports.executeBrowserCommands = exports.executeScript = exports.extractContext = exports.toSimpleCommonSelector = exports.toSelector = exports.isStaleElementError = exports.isSelector = exports.isElement = exports.isContext = exports.isDriver = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const os = __importStar(require("os"));
29
29
  const path = __importStar(require("path"));
@@ -111,6 +111,34 @@ async function executeScript(frame, script, arg) {
111
111
  return handleToObject(result);
112
112
  }
113
113
  exports.executeScript = executeScript;
114
+ async function executeBrowserCommands(page, commands, logger) {
115
+ let lastResponse;
116
+ let native = true;
117
+ for (const currentCommand of commands) {
118
+ switch (currentCommand.command) {
119
+ case 'Page.addScriptToEvaluateOnNewDocument':
120
+ if (currentCommand.params) {
121
+ lastResponse = await page.addInitScript({
122
+ content: currentCommand.params.source,
123
+ });
124
+ }
125
+ break;
126
+ default:
127
+ native = false;
128
+ const browser = page.context().browser();
129
+ if ((browser === null || browser === void 0 ? void 0 : browser.browserType().name()) === 'chromium') {
130
+ const client = await page.context().newCDPSession(page);
131
+ lastResponse = await client.send(currentCommand.command, currentCommand.params);
132
+ }
133
+ else {
134
+ logger === null || logger === void 0 ? void 0 : logger.info('executeBrowserCommands not supported');
135
+ }
136
+ }
137
+ logger === null || logger === void 0 ? void 0 : logger.debug(`executeBrowserCommands native:${native} command:${currentCommand.command} ${JSON.stringify(currentCommand.params)} => ${JSON.stringify(lastResponse)}`);
138
+ }
139
+ return lastResponse;
140
+ }
141
+ exports.executeBrowserCommands = executeBrowserCommands;
114
142
  async function findElement(frame, selector, parent) {
115
143
  if (utils.types.instanceOf(selector, 'Locator')) {
116
144
  return selector.elementHandle();
@@ -230,8 +258,16 @@ async function build(env) {
230
258
  ignoreDefaultArgs: ['--hide-scrollbars'],
231
259
  };
232
260
  if ((browser === null || browser === void 0 ? void 0 : browser.toLowerCase()) === 'chrome') {
233
- // options.ignoreDefaultArgs.push('--disable-field-trial-config')
234
- options.args.push('--disable-gpu');
261
+ const gpuOptions = [
262
+ '--use-angle=vulkan',
263
+ '--enable-features=Vulkan',
264
+ '--disable-vulkan-surface',
265
+ '--enable-unsafe-webgpu',
266
+ '--ignore-gpu-blocklist',
267
+ '--use-gl=angle',
268
+ ];
269
+ options.args = options.args.concat(gpuOptions);
270
+ options.ignoreDefaultArgs.push('--use-gl');
235
271
  if (process.env.CHROME_PATH) {
236
272
  options.executablePath = process.env.CHROME_PATH;
237
273
  }
@@ -274,6 +310,6 @@ async function build(env) {
274
310
  context = await driver.newContext(device ? playwright.devices[device] : {});
275
311
  }
276
312
  const page = await context.newPage();
277
- return [page, () => (driver ? driver.close() : context.close())];
313
+ return [page, () => (driver ? driver.close() : context.close()), () => driver];
278
314
  }
279
315
  exports.build = build;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-playwright",
3
- "version": "1.5.13",
3
+ "version": "1.6.0",
4
4
  "keywords": [
5
5
  "playwright",
6
6
  "chrome devtools protocol",
@@ -40,8 +40,8 @@
40
40
  "up:framework": "echo \"$(jq '.devDependencies.playwright = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
41
41
  },
42
42
  "dependencies": {
43
- "@applitools/driver": "1.21.4",
44
- "@applitools/utils": "1.8.2"
43
+ "@applitools/driver": "1.22.0",
44
+ "@applitools/utils": "1.9.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@applitools/api-extractor": "^1.2.22",
package/types/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export function toSelector(selector: import('@applitools/driver').CommonSelector
9
9
  export function toSimpleCommonSelector(selector: Selector): null | import('@applitools/driver').CommonSelector;
10
10
  export function extractContext(page: Driver): Context;
11
11
  export function executeScript(frame: Context, script: string | ((arg: any) => any), arg: any): Promise<any>;
12
+ export function executeBrowserCommands(page: Driver, commands: Array<import('@applitools/driver').BrowserCommand>, logger?: any): Promise<any>;
12
13
  export function findElement(frame: Context, selector: Selector, parent?: undefined | Element<Node>): Promise<null | Element<SVGElement | HTMLElement>>;
13
14
  export function findElements(frame: Context, selector: Selector, parent?: undefined | Element<Node>): Promise<Array<Element<SVGElement | HTMLElement>>>;
14
15
  export function setElementText(frame: Context, element: Selector | Element<Node>, text: string): Promise<void>;
@@ -25,7 +26,7 @@ export function getTitle(page: Driver): Promise<string>;
25
26
  export function getUrl(page: Driver): Promise<string>;
26
27
  export function visit(page: Driver, url: string): Promise<void>;
27
28
  export function takeScreenshot(page: Driver): Promise<Uint8Array>;
28
- export function build(env: any): Promise<[Driver, () => Promise<void>]>;
29
+ export function build(env: any): Promise<[Driver, () => Promise<void>, () => import('playwright-core').Browser]>;
29
30
  export type Driver = import('playwright-core').Page & { __applitoolsBrand?: undefined; };
30
31
  export type Context = import('playwright-core').Frame & { __applitoolsBrand?: undefined; };
31
32
  export type Element<T = Node> = import('playwright-core').ElementHandle<T> & { __applitoolsBrand?: undefined; };