aria-ease 5.0.2 → 5.0.3

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
@@ -175,7 +175,7 @@ useEffect(() => {
175
175
  accordionId: "accordion-container",
176
176
  triggersClass: "accordion-trigger",
177
177
  panelsClass: "accordion-panel",
178
- allowMultiple: false, // Only one panel open at a time (default)
178
+ allowMultipleOpen: false, // Only one panel open at a time (default)
179
179
  });
180
180
 
181
181
  return () => accordion.cleanup();
@@ -214,7 +214,7 @@ makeAccordionAccessible({
214
214
  accordionId: "faq-div",
215
215
  triggersClass: "dropdown-button",
216
216
  panelsClass: "accordion-panel",
217
- allowMultiple: false, // Only one panel open at a time
217
+ allowMultipleOpen: false, // Only one panel open at a time
218
218
  });
219
219
  ```
220
220
 
@@ -7,6 +7,10 @@ var contract_default = {
7
7
  combobox: {
8
8
  path: "./contracts/ComboboxContract.json",
9
9
  component: "combobox"
10
+ },
11
+ accordion: {
12
+ path: "./contracts/AccordionContract.json",
13
+ component: "accordion"
10
14
  }
11
15
  };
12
16
 
package/bin/cli.cjs CHANGED
@@ -283,6 +283,10 @@ var init_contract = __esm({
283
283
  combobox: {
284
284
  path: "./contracts/ComboboxContract.json",
285
285
  component: "combobox"
286
+ },
287
+ accordion: {
288
+ path: "./contracts/AccordionContract.json",
289
+ component: "accordion"
286
290
  }
287
291
  };
288
292
  }
@@ -628,25 +632,21 @@ async function runContractTestsPlaywright(componentName, url) {
628
632
  const page = await context.newPage();
629
633
  await page.goto(url, {
630
634
  waitUntil: "domcontentloaded",
631
- timeout: 9e4
635
+ timeout: 9e5
632
636
  });
637
+ await page.addStyleTag({ content: `* { transition: none !important; animation: none !important; }` });
633
638
  const mainSelector = componentContract.selectors.trigger || componentContract.selectors.input || componentContract.selectors.container;
634
639
  if (!mainSelector) {
635
640
  throw new Error(`No main selector (trigger, input, or container) found in contract for ${componentName}`);
636
641
  }
637
- await page.waitForSelector(mainSelector, { timeout: 9e4 });
642
+ await page.locator(mainSelector).first().waitFor({ state: "attached", timeout: 9e5 });
638
643
  if (componentName === "menu" && componentContract.selectors.trigger) {
639
- await page.waitForFunction(
640
- (selector) => {
641
- const trigger = document.querySelector(selector);
642
- return trigger && trigger.getAttribute("data-menu-initialized") === "true";
643
- },
644
- componentContract.selectors.trigger,
645
- { timeout: 1e4 }
646
- ).catch(() => {
647
- console.warn("Menu initialization signal not detected, continuing with tests...");
644
+ await page.locator(componentContract.selectors.trigger).first().waitFor({
645
+ state: "visible",
646
+ timeout: 1e4
647
+ }).catch(() => {
648
+ console.warn("Menu trigger not visible, continuing with tests...");
648
649
  });
649
- await page.waitForTimeout(300);
650
650
  }
651
651
  async function resolveRelativeTarget(selector, relative) {
652
652
  const items = await page.locator(selector).all();
@@ -722,7 +722,7 @@ async function runContractTestsPlaywright(componentName, url) {
722
722
  const popupSelector = componentContract.selectors.listbox || componentContract.selectors.container;
723
723
  if (!popupSelector) continue;
724
724
  const popupElement = page.locator(popupSelector).first();
725
- const isPopupVisible = await popupElement.isVisible();
725
+ const isPopupVisible = await popupElement.isVisible().catch(() => false);
726
726
  if (isPopupVisible) {
727
727
  let menuClosed = false;
728
728
  let closeSelector = componentContract.selectors.input;
@@ -734,44 +734,17 @@ async function runContractTestsPlaywright(componentName, url) {
734
734
  if (closeSelector) {
735
735
  const closeElement = page.locator(closeSelector).first();
736
736
  await closeElement.focus();
737
- await page.waitForTimeout(200);
738
737
  await page.keyboard.press("Escape");
739
- menuClosed = await page.waitForFunction(
740
- (selector) => {
741
- const popup = document.querySelector(selector);
742
- return popup && getComputedStyle(popup).display === "none";
743
- },
744
- popupSelector,
745
- { timeout: 3e3 }
746
- ).then(() => true).catch(() => false);
738
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
747
739
  }
748
740
  if (!menuClosed && componentContract.selectors.trigger) {
749
741
  const triggerElement = page.locator(componentContract.selectors.trigger).first();
750
742
  await triggerElement.click();
751
- await page.waitForTimeout(500);
752
- menuClosed = await page.waitForFunction(
753
- (selector) => {
754
- const popup = document.querySelector(selector);
755
- return popup && getComputedStyle(popup).display === "none";
756
- },
757
- popupSelector,
758
- { timeout: 3e3 }
759
- ).then(() => true).catch(() => false);
743
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
760
744
  }
761
745
  if (!menuClosed) {
762
746
  await page.mouse.click(10, 10);
763
- await page.waitForTimeout(500);
764
- menuClosed = await page.waitForFunction(
765
- (selector) => {
766
- const popup = document.querySelector(selector);
767
- return popup && getComputedStyle(popup).display === "none";
768
- },
769
- popupSelector,
770
- { timeout: 3e3 }
771
- ).then(() => true).catch(() => false);
772
- if (menuClosed) {
773
- console.log("\u{1F3AF} Strategy 3 (Click outside) worked");
774
- }
747
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
775
748
  }
776
749
  if (!menuClosed) {
777
750
  throw new Error(
@@ -782,25 +755,12 @@ async function runContractTestsPlaywright(componentName, url) {
782
755
  This indicates a problem with the menu component's close functionality.`
783
756
  );
784
757
  }
785
- if (componentName === "menu" && componentContract.selectors.trigger) {
786
- await page.waitForFunction(
787
- (selector) => {
788
- const trigger = document.querySelector(selector);
789
- return document.activeElement === trigger;
790
- },
791
- componentContract.selectors.trigger,
792
- { timeout: 2e3 }
793
- ).catch(async () => {
794
- const triggerElement = page.locator(componentContract.selectors.trigger).first();
795
- await triggerElement.focus();
796
- await page.waitForTimeout(200);
797
- });
798
- }
799
- await page.waitForTimeout(500);
800
758
  if (componentContract.selectors.input) {
801
- const inputElement = page.locator(componentContract.selectors.input).first();
802
- await inputElement.clear();
803
- await page.waitForTimeout(100);
759
+ await page.locator(componentContract.selectors.input).first().clear();
760
+ }
761
+ if (componentName === "menu" && componentContract.selectors.trigger) {
762
+ const triggerElement = page.locator(componentContract.selectors.trigger).first();
763
+ await triggerElement.focus();
804
764
  }
805
765
  }
806
766
  }
@@ -844,7 +804,6 @@ This indicates a problem with the menu component's close functionality.`
844
804
  continue;
845
805
  }
846
806
  await page.locator(focusSelector).first().focus();
847
- await page.waitForTimeout(100);
848
807
  }
849
808
  if (act.type === "type" && act.value) {
850
809
  const typeSelector = componentContract.selectors[act.target];
@@ -853,7 +812,6 @@ This indicates a problem with the menu component's close functionality.`
853
812
  continue;
854
813
  }
855
814
  await page.locator(typeSelector).first().fill(act.value);
856
- await page.waitForTimeout(100);
857
815
  }
858
816
  if (act.type === "click") {
859
817
  if (act.target === "document") {
@@ -870,7 +828,6 @@ This indicates a problem with the menu component's close functionality.`
870
828
  continue;
871
829
  }
872
830
  await relativeElement.click();
873
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
874
831
  } else {
875
832
  const actionSelector = componentContract.selectors[act.target];
876
833
  if (!actionSelector) {
@@ -878,7 +835,6 @@ This indicates a problem with the menu component's close functionality.`
878
835
  continue;
879
836
  }
880
837
  await page.locator(actionSelector).first().click();
881
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
882
838
  }
883
839
  }
884
840
  if (act.type === "keypress" && act.key) {
@@ -901,9 +857,7 @@ This indicates a problem with the menu component's close functionality.`
901
857
  keyValue = keyValue.replace(/ /g, "");
902
858
  }
903
859
  if (act.target === "focusable" && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape"].includes(keyValue)) {
904
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
905
860
  await page.keyboard.press(keyValue);
906
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
907
861
  } else {
908
862
  const keypressSelector = componentContract.selectors[act.target];
909
863
  if (!keypressSelector) {
@@ -932,7 +886,6 @@ This indicates a problem with the menu component's close functionality.`
932
886
  continue;
933
887
  }
934
888
  await relativeElement.hover();
935
- await page.waitForTimeout(100);
936
889
  } else {
937
890
  const hoverSelector = componentContract.selectors[act.target];
938
891
  if (!hoverSelector) {
@@ -940,12 +893,9 @@ This indicates a problem with the menu component's close functionality.`
940
893
  continue;
941
894
  }
942
895
  await page.locator(hoverSelector).first().hover();
943
- await page.waitForTimeout(100);
944
896
  }
945
897
  }
946
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
947
898
  }
948
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
949
899
  for (const assertion of assertions) {
950
900
  let target;
951
901
  if (assertion.target === "relative") {
package/bin/cli.js CHANGED
@@ -204,7 +204,7 @@ program.command("audit").description("Run axe-core powered accessibility audit o
204
204
  console.log(chalk.green("\n\u{1F389} All audits completed."));
205
205
  });
206
206
  program.command("test").description("Run core a11y accessibility standard tests on UI components").action(async () => {
207
- const { runTest } = await import("./test-RHQ2LJVG.js");
207
+ const { runTest } = await import("./test-JNQFZBJA.js");
208
208
  runTest();
209
209
  });
210
210
  program.command("help").description("Display help information").action(() => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ContractReporter,
3
3
  contract_default
4
- } from "./chunk-Y2FZWFX7.js";
4
+ } from "./chunk-TUWQNVQJ.js";
5
5
  import {
6
6
  __export,
7
7
  __reExport
@@ -44,25 +44,21 @@ async function runContractTestsPlaywright(componentName, url) {
44
44
  const page = await context.newPage();
45
45
  await page.goto(url, {
46
46
  waitUntil: "domcontentloaded",
47
- timeout: 9e4
47
+ timeout: 9e5
48
48
  });
49
+ await page.addStyleTag({ content: `* { transition: none !important; animation: none !important; }` });
49
50
  const mainSelector = componentContract.selectors.trigger || componentContract.selectors.input || componentContract.selectors.container;
50
51
  if (!mainSelector) {
51
52
  throw new Error(`No main selector (trigger, input, or container) found in contract for ${componentName}`);
52
53
  }
53
- await page.waitForSelector(mainSelector, { timeout: 9e4 });
54
+ await page.locator(mainSelector).first().waitFor({ state: "attached", timeout: 9e5 });
54
55
  if (componentName === "menu" && componentContract.selectors.trigger) {
55
- await page.waitForFunction(
56
- (selector) => {
57
- const trigger = document.querySelector(selector);
58
- return trigger && trigger.getAttribute("data-menu-initialized") === "true";
59
- },
60
- componentContract.selectors.trigger,
61
- { timeout: 1e4 }
62
- ).catch(() => {
63
- console.warn("Menu initialization signal not detected, continuing with tests...");
56
+ await page.locator(componentContract.selectors.trigger).first().waitFor({
57
+ state: "visible",
58
+ timeout: 1e4
59
+ }).catch(() => {
60
+ console.warn("Menu trigger not visible, continuing with tests...");
64
61
  });
65
- await page.waitForTimeout(300);
66
62
  }
67
63
  async function resolveRelativeTarget(selector, relative) {
68
64
  const items = await page.locator(selector).all();
@@ -138,7 +134,7 @@ async function runContractTestsPlaywright(componentName, url) {
138
134
  const popupSelector = componentContract.selectors.listbox || componentContract.selectors.container;
139
135
  if (!popupSelector) continue;
140
136
  const popupElement = page.locator(popupSelector).first();
141
- const isPopupVisible = await popupElement.isVisible();
137
+ const isPopupVisible = await popupElement.isVisible().catch(() => false);
142
138
  if (isPopupVisible) {
143
139
  let menuClosed = false;
144
140
  let closeSelector = componentContract.selectors.input;
@@ -150,44 +146,17 @@ async function runContractTestsPlaywright(componentName, url) {
150
146
  if (closeSelector) {
151
147
  const closeElement = page.locator(closeSelector).first();
152
148
  await closeElement.focus();
153
- await page.waitForTimeout(200);
154
149
  await page.keyboard.press("Escape");
155
- menuClosed = await page.waitForFunction(
156
- (selector) => {
157
- const popup = document.querySelector(selector);
158
- return popup && getComputedStyle(popup).display === "none";
159
- },
160
- popupSelector,
161
- { timeout: 3e3 }
162
- ).then(() => true).catch(() => false);
150
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
163
151
  }
164
152
  if (!menuClosed && componentContract.selectors.trigger) {
165
153
  const triggerElement = page.locator(componentContract.selectors.trigger).first();
166
154
  await triggerElement.click();
167
- await page.waitForTimeout(500);
168
- menuClosed = await page.waitForFunction(
169
- (selector) => {
170
- const popup = document.querySelector(selector);
171
- return popup && getComputedStyle(popup).display === "none";
172
- },
173
- popupSelector,
174
- { timeout: 3e3 }
175
- ).then(() => true).catch(() => false);
155
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
176
156
  }
177
157
  if (!menuClosed) {
178
158
  await page.mouse.click(10, 10);
179
- await page.waitForTimeout(500);
180
- menuClosed = await page.waitForFunction(
181
- (selector) => {
182
- const popup = document.querySelector(selector);
183
- return popup && getComputedStyle(popup).display === "none";
184
- },
185
- popupSelector,
186
- { timeout: 3e3 }
187
- ).then(() => true).catch(() => false);
188
- if (menuClosed) {
189
- console.log("\u{1F3AF} Strategy 3 (Click outside) worked");
190
- }
159
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
191
160
  }
192
161
  if (!menuClosed) {
193
162
  throw new Error(
@@ -198,25 +167,12 @@ async function runContractTestsPlaywright(componentName, url) {
198
167
  This indicates a problem with the menu component's close functionality.`
199
168
  );
200
169
  }
201
- if (componentName === "menu" && componentContract.selectors.trigger) {
202
- await page.waitForFunction(
203
- (selector) => {
204
- const trigger = document.querySelector(selector);
205
- return document.activeElement === trigger;
206
- },
207
- componentContract.selectors.trigger,
208
- { timeout: 2e3 }
209
- ).catch(async () => {
210
- const triggerElement = page.locator(componentContract.selectors.trigger).first();
211
- await triggerElement.focus();
212
- await page.waitForTimeout(200);
213
- });
214
- }
215
- await page.waitForTimeout(500);
216
170
  if (componentContract.selectors.input) {
217
- const inputElement = page.locator(componentContract.selectors.input).first();
218
- await inputElement.clear();
219
- await page.waitForTimeout(100);
171
+ await page.locator(componentContract.selectors.input).first().clear();
172
+ }
173
+ if (componentName === "menu" && componentContract.selectors.trigger) {
174
+ const triggerElement = page.locator(componentContract.selectors.trigger).first();
175
+ await triggerElement.focus();
220
176
  }
221
177
  }
222
178
  }
@@ -260,7 +216,6 @@ This indicates a problem with the menu component's close functionality.`
260
216
  continue;
261
217
  }
262
218
  await page.locator(focusSelector).first().focus();
263
- await page.waitForTimeout(100);
264
219
  }
265
220
  if (act.type === "type" && act.value) {
266
221
  const typeSelector = componentContract.selectors[act.target];
@@ -269,7 +224,6 @@ This indicates a problem with the menu component's close functionality.`
269
224
  continue;
270
225
  }
271
226
  await page.locator(typeSelector).first().fill(act.value);
272
- await page.waitForTimeout(100);
273
227
  }
274
228
  if (act.type === "click") {
275
229
  if (act.target === "document") {
@@ -286,7 +240,6 @@ This indicates a problem with the menu component's close functionality.`
286
240
  continue;
287
241
  }
288
242
  await relativeElement.click();
289
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
290
243
  } else {
291
244
  const actionSelector = componentContract.selectors[act.target];
292
245
  if (!actionSelector) {
@@ -294,7 +247,6 @@ This indicates a problem with the menu component's close functionality.`
294
247
  continue;
295
248
  }
296
249
  await page.locator(actionSelector).first().click();
297
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
298
250
  }
299
251
  }
300
252
  if (act.type === "keypress" && act.key) {
@@ -317,9 +269,7 @@ This indicates a problem with the menu component's close functionality.`
317
269
  keyValue = keyValue.replace(/ /g, "");
318
270
  }
319
271
  if (act.target === "focusable" && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape"].includes(keyValue)) {
320
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
321
272
  await page.keyboard.press(keyValue);
322
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
323
273
  } else {
324
274
  const keypressSelector = componentContract.selectors[act.target];
325
275
  if (!keypressSelector) {
@@ -348,7 +298,6 @@ This indicates a problem with the menu component's close functionality.`
348
298
  continue;
349
299
  }
350
300
  await relativeElement.hover();
351
- await page.waitForTimeout(100);
352
301
  } else {
353
302
  const hoverSelector = componentContract.selectors[act.target];
354
303
  if (!hoverSelector) {
@@ -356,12 +305,9 @@ This indicates a problem with the menu component's close functionality.`
356
305
  continue;
357
306
  }
358
307
  await page.locator(hoverSelector).first().hover();
359
- await page.waitForTimeout(100);
360
308
  }
361
309
  }
362
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
363
310
  }
364
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
365
311
  for (const assertion of assertions) {
366
312
  let target;
367
313
  if (assertion.target === "relative") {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ContractReporter,
3
3
  contract_default
4
- } from "./chunk-Y2FZWFX7.js";
4
+ } from "./chunk-TUWQNVQJ.js";
5
5
  import "./chunk-I2KLQ2HA.js";
6
6
 
7
7
  // src/utils/test/src/test.ts
@@ -116,7 +116,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
116
116
  const devServerUrl = await checkDevServer(url);
117
117
  if (devServerUrl) {
118
118
  console.log(`\u{1F3AD} Running Playwright E2E tests on ${devServerUrl}`);
119
- const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-FFEJJCQO.js");
119
+ const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-O22AQ4RK.js");
120
120
  contract = await runContractTestsPlaywright(componentName, devServerUrl);
121
121
  } else {
122
122
  console.log(`\u{1F9EA} Running jsdom tests (limited event handling)`);
@@ -25,6 +25,10 @@ var contract_default = {
25
25
  combobox: {
26
26
  path: "./contracts/ComboboxContract.json",
27
27
  component: "combobox"
28
+ },
29
+ accordion: {
30
+ path: "./contracts/AccordionContract.json",
31
+ component: "accordion"
28
32
  }
29
33
  };
30
34
 
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __reExport,
5
5
  contract_default
6
- } from "./chunk-AVCZIF6G.js";
6
+ } from "./chunk-KJ33RDSC.js";
7
7
 
8
8
  // src/utils/test/contract/contractTestRunnerPlaywright.ts
9
9
  import { chromium } from "playwright";
@@ -42,25 +42,21 @@ async function runContractTestsPlaywright(componentName, url) {
42
42
  const page = await context.newPage();
43
43
  await page.goto(url, {
44
44
  waitUntil: "domcontentloaded",
45
- timeout: 9e4
45
+ timeout: 9e5
46
46
  });
47
+ await page.addStyleTag({ content: `* { transition: none !important; animation: none !important; }` });
47
48
  const mainSelector = componentContract.selectors.trigger || componentContract.selectors.input || componentContract.selectors.container;
48
49
  if (!mainSelector) {
49
50
  throw new Error(`No main selector (trigger, input, or container) found in contract for ${componentName}`);
50
51
  }
51
- await page.waitForSelector(mainSelector, { timeout: 9e4 });
52
+ await page.locator(mainSelector).first().waitFor({ state: "attached", timeout: 9e5 });
52
53
  if (componentName === "menu" && componentContract.selectors.trigger) {
53
- await page.waitForFunction(
54
- (selector) => {
55
- const trigger = document.querySelector(selector);
56
- return trigger && trigger.getAttribute("data-menu-initialized") === "true";
57
- },
58
- componentContract.selectors.trigger,
59
- { timeout: 1e4 }
60
- ).catch(() => {
61
- console.warn("Menu initialization signal not detected, continuing with tests...");
54
+ await page.locator(componentContract.selectors.trigger).first().waitFor({
55
+ state: "visible",
56
+ timeout: 1e4
57
+ }).catch(() => {
58
+ console.warn("Menu trigger not visible, continuing with tests...");
62
59
  });
63
- await page.waitForTimeout(300);
64
60
  }
65
61
  async function resolveRelativeTarget(selector, relative) {
66
62
  const items = await page.locator(selector).all();
@@ -136,7 +132,7 @@ async function runContractTestsPlaywright(componentName, url) {
136
132
  const popupSelector = componentContract.selectors.listbox || componentContract.selectors.container;
137
133
  if (!popupSelector) continue;
138
134
  const popupElement = page.locator(popupSelector).first();
139
- const isPopupVisible = await popupElement.isVisible();
135
+ const isPopupVisible = await popupElement.isVisible().catch(() => false);
140
136
  if (isPopupVisible) {
141
137
  let menuClosed = false;
142
138
  let closeSelector = componentContract.selectors.input;
@@ -148,44 +144,17 @@ async function runContractTestsPlaywright(componentName, url) {
148
144
  if (closeSelector) {
149
145
  const closeElement = page.locator(closeSelector).first();
150
146
  await closeElement.focus();
151
- await page.waitForTimeout(200);
152
147
  await page.keyboard.press("Escape");
153
- menuClosed = await page.waitForFunction(
154
- (selector) => {
155
- const popup = document.querySelector(selector);
156
- return popup && getComputedStyle(popup).display === "none";
157
- },
158
- popupSelector,
159
- { timeout: 3e3 }
160
- ).then(() => true).catch(() => false);
148
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
161
149
  }
162
150
  if (!menuClosed && componentContract.selectors.trigger) {
163
151
  const triggerElement = page.locator(componentContract.selectors.trigger).first();
164
152
  await triggerElement.click();
165
- await page.waitForTimeout(500);
166
- menuClosed = await page.waitForFunction(
167
- (selector) => {
168
- const popup = document.querySelector(selector);
169
- return popup && getComputedStyle(popup).display === "none";
170
- },
171
- popupSelector,
172
- { timeout: 3e3 }
173
- ).then(() => true).catch(() => false);
153
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
174
154
  }
175
155
  if (!menuClosed) {
176
156
  await page.mouse.click(10, 10);
177
- await page.waitForTimeout(500);
178
- menuClosed = await page.waitForFunction(
179
- (selector) => {
180
- const popup = document.querySelector(selector);
181
- return popup && getComputedStyle(popup).display === "none";
182
- },
183
- popupSelector,
184
- { timeout: 3e3 }
185
- ).then(() => true).catch(() => false);
186
- if (menuClosed) {
187
- console.log("\u{1F3AF} Strategy 3 (Click outside) worked");
188
- }
157
+ menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
189
158
  }
190
159
  if (!menuClosed) {
191
160
  throw new Error(
@@ -196,25 +165,12 @@ async function runContractTestsPlaywright(componentName, url) {
196
165
  This indicates a problem with the menu component's close functionality.`
197
166
  );
198
167
  }
199
- if (componentName === "menu" && componentContract.selectors.trigger) {
200
- await page.waitForFunction(
201
- (selector) => {
202
- const trigger = document.querySelector(selector);
203
- return document.activeElement === trigger;
204
- },
205
- componentContract.selectors.trigger,
206
- { timeout: 2e3 }
207
- ).catch(async () => {
208
- const triggerElement = page.locator(componentContract.selectors.trigger).first();
209
- await triggerElement.focus();
210
- await page.waitForTimeout(200);
211
- });
212
- }
213
- await page.waitForTimeout(500);
214
168
  if (componentContract.selectors.input) {
215
- const inputElement = page.locator(componentContract.selectors.input).first();
216
- await inputElement.clear();
217
- await page.waitForTimeout(100);
169
+ await page.locator(componentContract.selectors.input).first().clear();
170
+ }
171
+ if (componentName === "menu" && componentContract.selectors.trigger) {
172
+ const triggerElement = page.locator(componentContract.selectors.trigger).first();
173
+ await triggerElement.focus();
218
174
  }
219
175
  }
220
176
  }
@@ -258,7 +214,6 @@ This indicates a problem with the menu component's close functionality.`
258
214
  continue;
259
215
  }
260
216
  await page.locator(focusSelector).first().focus();
261
- await page.waitForTimeout(100);
262
217
  }
263
218
  if (act.type === "type" && act.value) {
264
219
  const typeSelector = componentContract.selectors[act.target];
@@ -267,7 +222,6 @@ This indicates a problem with the menu component's close functionality.`
267
222
  continue;
268
223
  }
269
224
  await page.locator(typeSelector).first().fill(act.value);
270
- await page.waitForTimeout(100);
271
225
  }
272
226
  if (act.type === "click") {
273
227
  if (act.target === "document") {
@@ -284,7 +238,6 @@ This indicates a problem with the menu component's close functionality.`
284
238
  continue;
285
239
  }
286
240
  await relativeElement.click();
287
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
288
241
  } else {
289
242
  const actionSelector = componentContract.selectors[act.target];
290
243
  if (!actionSelector) {
@@ -292,7 +245,6 @@ This indicates a problem with the menu component's close functionality.`
292
245
  continue;
293
246
  }
294
247
  await page.locator(actionSelector).first().click();
295
- await page.waitForTimeout(componentName === "menu" ? 800 : 200);
296
248
  }
297
249
  }
298
250
  if (act.type === "keypress" && act.key) {
@@ -315,9 +267,7 @@ This indicates a problem with the menu component's close functionality.`
315
267
  keyValue = keyValue.replace(/ /g, "");
316
268
  }
317
269
  if (act.target === "focusable" && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape"].includes(keyValue)) {
318
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
319
270
  await page.keyboard.press(keyValue);
320
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
321
271
  } else {
322
272
  const keypressSelector = componentContract.selectors[act.target];
323
273
  if (!keypressSelector) {
@@ -346,7 +296,6 @@ This indicates a problem with the menu component's close functionality.`
346
296
  continue;
347
297
  }
348
298
  await relativeElement.hover();
349
- await page.waitForTimeout(100);
350
299
  } else {
351
300
  const hoverSelector = componentContract.selectors[act.target];
352
301
  if (!hoverSelector) {
@@ -354,12 +303,9 @@ This indicates a problem with the menu component's close functionality.`
354
303
  continue;
355
304
  }
356
305
  await page.locator(hoverSelector).first().hover();
357
- await page.waitForTimeout(100);
358
306
  }
359
307
  }
360
- await page.waitForTimeout(componentName === "menu" ? 200 : 100);
361
308
  }
362
- await page.waitForTimeout(componentName === "menu" ? 300 : 100);
363
309
  for (const assertion of assertions) {
364
310
  let target;
365
311
  if (assertion.target === "relative") {