automation_model 1.0.31 → 1.0.33

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.
@@ -182,6 +182,30 @@ class StableBrowser {
182
182
  throw e;
183
183
  }
184
184
  }
185
+ async containsText(selector, text, _params = null, options = {}) {
186
+ const info = {};
187
+ info.log = [];
188
+ info.operation = "containsText";
189
+ info.selector = selector;
190
+ info.value = text;
191
+ try {
192
+ let element = await this._locate(selector, info, _params);
193
+ await this._screenShot(options);
194
+ let foundText = await element.textContent();
195
+ if (!foundText.includes(text)) {
196
+ throw new Error("element doesn't contain text " + text);
197
+ }
198
+ //await expect(element).toContainText(text, { timeout: 10000 });
199
+ //fill(value, { timeout: 10000 });
200
+ //await element.dispatchEvent("change");
201
+ return info;
202
+ } catch (e) {
203
+ this.logger.error("verify element contains text failed " + JSON.stringify(info));
204
+ Object.assign(e, { info: info });
205
+ await this._screenShot(options);
206
+ throw e;
207
+ }
208
+ }
185
209
  async _screenShot(options = {}) {
186
210
  if (options.screenshot) {
187
211
  await this.page.screenshot({ path: options.screenshotPath });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automation_model",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "An automation infrastructure module to be use for generative AI automation projects.",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",