@sungen/driver-ui 3.2.16-beta.7 → 3.2.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sungen/driver-ui",
3
- "version": "3.2.16-beta.7",
3
+ "version": "3.2.17",
4
4
  "description": "Sungen UI capability (Playwright) — step patterns, viewpoint gate, and phase hooks. Plugs into @sun-asterisk/sungen via the capability SPI.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -13,7 +13,7 @@
13
13
  "author": "eqe team (engineer & quality) — Sun Asterisk",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@sun-asterisk/sungen": "3.2.16-beta.7"
16
+ "@sun-asterisk/sungen": "3.2.17"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "@playwright/test": "^1.57.0"
@@ -125,6 +125,67 @@ export const interactionPatterns: StepPattern[] = [
125
125
  },
126
126
  priority: 20,
127
127
  },
128
+ {
129
+ // `try to click [X] button` — the DISABLED-element probe (issue: no way to write
130
+ // "click a disabled control and confirm nothing happens").
131
+ //
132
+ // A plain `click` compiles to Playwright's `.click()`, which auto-waits for the element to
133
+ // be ACTIONABLE (visible + enabled + stable). That wait is the whole point for a real click,
134
+ // but it makes the inverse scenario — "the re-send link is in cooldown, clicking it must do
135
+ // nothing" — impossible to express: the step can only ever time out on an element that is
136
+ // disabled BY DESIGN.
137
+ //
138
+ // This variant bypasses the actionability wait (`{ force: true }`), so the click is really
139
+ // dispatched at the element's position. A natively-`disabled` control swallows it and nothing
140
+ // happens (the following assertions prove that); an `aria-disabled`/CSS-only "disabled"
141
+ // control that still handles the click is caught as the bug it is. Note the element must
142
+ // still exist and be rendered — this is not a silent no-op.
143
+ //
144
+ // When User try to click [Re-send] link # cooldown active → must stay inert
145
+ // Then User see [Re-send] link is disabled
146
+ // And User see [Cooldown] text # …and no re-send happened
147
+ name: 'try-click-element',
148
+ matcher: (step: ParsedStep) =>
149
+ /\b(?:tr(?:y|ies)|attempts?)\s+to\s+click\b/i.test(step.text) &&
150
+ // `… and accept/dismiss [OK] alert` stays with click-with-alert: force-clicking here would
151
+ // drop the page.once('dialog') listener the compound form exists to register.
152
+ !/\band\s+(?:accept|accepts|dismiss|dismisses)\s+\[[^\]]*\]\s+alert\b/i.test(step.text) &&
153
+ !!step.selectorRef,
154
+ resolver: (step, context) => {
155
+ const resolved = context.selectorResolver.resolveSelector(
156
+ step.selectorRef!, undefined, step.elementType, step.nth
157
+ );
158
+
159
+ // No `with {{v}}` → plain forced click. Mirrors click-element.
160
+ if (!(step.dataRef || step.value) || !step.text.includes('with')) {
161
+ return {
162
+ templateName: 'click-action',
163
+ data: { ...resolved, selectorRef: step.selectorRef, force: true },
164
+ comment: `Try to click ${step.selectorRef} (bypasses the enabled/actionability wait)`,
165
+ };
166
+ }
167
+
168
+ // `with {{v}}` → filter to the matching row/item first. Mirrors click-element-with-text.
169
+ let dataValue: string;
170
+ if (step.value) {
171
+ dataValue = step.value;
172
+ } else {
173
+ try {
174
+ dataValue = context.dataResolver.resolveData(step.dataRef!, context.featureName);
175
+ } catch {
176
+ dataValue = `\${${step.dataRef}}`;
177
+ }
178
+ }
179
+ const { name: _name, ...resolvedWithoutName } = resolved;
180
+
181
+ return {
182
+ templateName: 'click-element-with-text',
183
+ data: { ...resolvedWithoutName, dataValue, force: true },
184
+ comment: `Try to click ${step.selectorRef} with text ${step.dataRef || step.value} (bypasses the enabled/actionability wait)`,
185
+ };
186
+ },
187
+ priority: 22, // above click-with-alert (21) and every other click pattern — the verb wins
188
+ },
128
189
  {
129
190
  name: 'unknown-element-action',
130
191
  matcher: (step: ParsedStep) => {