Commit 0dfdcb2
committed
E2E: stop relying on OS focus for the Escape-binding tests
The two `Escape closes the X window (production binding)` tests in
settings.spec.ts and viewer.spec.ts went through `keyboard.press('Escape')`,
which delivers the keystroke via the OS. Under Xvfb on Linux CI the
keystroke routinely lands on the main window (the previous test left
focus there, or the open-animation hasn't transferred it yet), the
scoped webview never sees it, and the test sits waiting for a
window-close that doesn't come. The existing two-attempt focus poll
helped but didn't eliminate the race — both tests flaked on the most
recent PR run.
Switch both to a synthetic `document.dispatchEvent(new KeyboardEvent('keydown',
{ key: 'Escape', bubbles: true }))` via `evaluate`. That bubbles through
the `<svelte:window on:keydown>` listener regardless of OS focus, which
is what the test is actually meant to exercise (the handler's close
logic). The Tauri/webkit2gtk OS → webview event pipeline isn't cmdr's
responsibility to test.
Pattern matches `network-toggle.spec.ts` and `file-operations.spec.ts`,
which already use synthetic Escape dispatch for the same reason. Drops
the helper `tryEscape` / focus-poll machinery; the test is now linear.1 parent e8259ee commit 0dfdcb2
2 files changed
Lines changed: 34 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
345 | 334 | | |
346 | 335 | | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | 336 | | |
354 | 337 | | |
355 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
221 | 209 | | |
222 | 210 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | 211 | | |
230 | 212 | | |
231 | 213 | | |
| |||
0 commit comments