@testspectra/react 1.2.0 → 1.2.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/dist/index.js CHANGED
@@ -597,6 +597,48 @@ var DomDriverBridge = class {
597
597
  });
598
598
  if (!ok) throw new Error("Element not found: " + JSON.stringify(selector));
599
599
  }
600
+ async waitForElementRemoved(selector, timeoutMs = 5e3, index = null) {
601
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
602
+ return !await this.isExisting(selector, index);
603
+ }, timeoutMs);
604
+ if (!ok) throw new Error("Element still exists after timeout: " + JSON.stringify(selector));
605
+ }
606
+ async waitForUndisplayed(selector, opts, index = null) {
607
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
608
+ return !await this.isDisplayed(selector, index);
609
+ }, opts?.timeout ?? 5e3);
610
+ if (!ok) throw new Error("Element still displayed after timeout: " + JSON.stringify(selector));
611
+ }
612
+ async waitForClickable(selector, opts, index = null) {
613
+ return await globalThis.__TS_RUNTIME__.pollCondition(async () => {
614
+ return this.isClickable(selector, index);
615
+ }, opts?.timeout ?? 5e3);
616
+ }
617
+ async getBounds(selector, index = null) {
618
+ const el = resolveEl(selector, index);
619
+ if (!el) return { x: 0, y: 0, top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
620
+ const r = el.getBoundingClientRect();
621
+ return {
622
+ x: r.x,
623
+ y: r.y,
624
+ top: r.top,
625
+ right: r.right,
626
+ bottom: r.bottom,
627
+ left: r.left,
628
+ width: r.width,
629
+ height: r.height
630
+ };
631
+ }
632
+ async closest(selector, targetSelector, index = null) {
633
+ const el = resolveEl(selector, index);
634
+ if (!el) return null;
635
+ const ancestor = el.closest(targetSelector);
636
+ return ancestor ? ancestor.tagName.toLowerCase() : null;
637
+ }
638
+ async clickAt(x, y) {
639
+ const el = document.elementFromPoint(x, y);
640
+ el?.click();
641
+ }
600
642
  async dragDrop(sourceSelector, targetSelector, sourceIndex = null) {
601
643
  const src = resolveEl(sourceSelector, sourceIndex);
602
644
  const dest = resolveEl(targetSelector, null);