@checksum-ai/runtime 1.1.16 → 1.1.18

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/README.md CHANGED
@@ -113,6 +113,41 @@ Alongside standard test run configurations found in `playwright.config.ts`, use
113
113
  }
114
114
  }
115
115
  ```
116
+ ## Playwright Configuration
117
+
118
+ A Playwright configuration file `playwright.config.ts` should be available to the Playwright tests runner in order to provide project configuration.
119
+ For your convenience we extended the configuration to allow the addition of the `playwright-extra-plugins` packages.
120
+ Available plugins can be found at https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra
121
+
122
+ To add a plugin:
123
+
124
+ - Install it using your package manager (yarn, npm, pnpm)
125
+ - Import the plugin in your `playwright.config.ts` file
126
+ - In the `projects` definition under `use`, add it to the playwrightExtra array
127
+ - Make sure to initialize the plugin before or during the addition to the array
128
+
129
+ Example `playwright.config.ts` with the `puppeteer-extra-plugin-stealth` plugin:
130
+
131
+ ```js
132
+ import { PuppeteerExtraPlugin } from "puppeteer-extra-plugin";
133
+ import StealthPlugin from "puppeteer-extra-plugin-stealth"; // <--- Added import line
134
+
135
+ export default defineConfig<{ playwrightExtra?: PuppeteerExtraPlugin[] }>({
136
+ // ....
137
+ projects: [
138
+ {
139
+ name: "chromium",
140
+ testMatch: /checksum.spec/,
141
+ use: {
142
+ ...devices["Desktop Chrome"],
143
+ playwrightExtra: [StealthPlugin()], // <--- Initialized and added to the playwrightExtra array
144
+ },
145
+ },
146
+ ],
147
+ });
148
+ ```
149
+
150
+ **See more detailed instructions inside the `checksum-root/playwright.config.ts` file**
116
151
 
117
152
  ## Checksum Helpers API
118
153
  Helpers are deconstructed from the result of the initial call to the imported @checksum-ai/runtime `init` method, as following:
@@ -191,6 +226,23 @@ interface ChecksumPage extends Page {
191
226
 
192
227
  ```
193
228
 
229
+ ## ChecksumLocator API
230
+
231
+ ChecksumLocator extends the existing Playwright Locator, adding the following functionality:
232
+
233
+ ```js
234
+ interface ChecksumLocator extends Locator {
235
+ /*
236
+ * Click on certain text within the canvas element the locator chain points to.
237
+ * When more than one element with the same text exists, uses the rectSizeIndex
238
+ * to resolve the target element by its bounding box size, 0 being the largest.
239
+ * Example:
240
+ * await page.locator('canvas').canvasClick('graph-point-1', 1); // clicking on the 2nd largest
241
+ */
242
+ canvasClick: (canvasText: string, rectSizeIndex?: number) => Promise<void>;
243
+ }
244
+ ```
245
+
194
246
 
195
247
  ## CLI Commands
196
248
 
package/checksumlib.js CHANGED
@@ -9861,7 +9861,8 @@
9861
9861
  "[type=button]",
9862
9862
  "[aria-disabled=false]",
9863
9863
  '[id^="react-select"]',
9864
- "label[for]"
9864
+ "label[for]",
9865
+ "canvas"
9865
9866
  ];
9866
9867
  var InteractableCursorValues = [
9867
9868
  "pointer",