Skip to content

Commit b7744dd

Browse files
committed
Fix a11y contrast and harden flaky E2E tests
- Darken `--color-accent-text` from 40% to 55% black mix for WCAG AA compliance - Add `opacity: 1` to search input placeholders to prevent browser dimming - Replace fixed sleep with polling in file-watching duplicate check test - Increase `waitForDialogsToClose` timeout to 30s for MTP conflict tests - Make `waitForDialogsToClose` accept a configurable timeout parameter
1 parent faa2534 commit b7744dd

7 files changed

Lines changed: 35 additions & 28 deletions

File tree

apps/desktop/src/app.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
--color-accent-text: color-mix(
4949
in srgb,
5050
var(--color-accent),
51-
black 40%
52-
); /* Darkened accent for a11y when used as foreground text */
51+
black 55%
52+
); /* Darkened accent for a11y when used as foreground text (≥4.5:1 on --color-bg-secondary) */
5353
--color-accent-hover: color-mix(in oklch, var(--color-accent), white 15%);
5454
--color-accent-subtle: color-mix(in oklch, var(--color-accent), transparent 85%);
5555
--color-cmdr-gold: #d4a006;

apps/desktop/src/lib/search/AiSearchRow.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
136136
.name-input::placeholder {
137137
color: var(--color-text-tertiary);
138+
opacity: 1; /* Override browser default dimming for a11y contrast */
138139
}
139140
140141
/* Shared button style for Ask AI */

apps/desktop/src/lib/search/SearchInputArea.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@
349349
350350
.name-input::placeholder {
351351
color: var(--color-text-tertiary);
352+
opacity: 1; /* Override browser default dimming for a11y contrast */
352353
}
353354
354355
.name-input.ai-highlight {

apps/desktop/test/e2e-playwright/conflict-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export async function clickTransferStart(tauriPage: PageLike): Promise<void> {
170170
}
171171

172172
/** Waits for all modal dialogs to close after an operation completes. */
173-
export async function waitForDialogsToClose(tauriPage: PageLike): Promise<void> {
174-
const closed = await pollUntil(tauriPage, async () => !(await tauriPage.isVisible('.modal-overlay')), 15000)
173+
export async function waitForDialogsToClose(tauriPage: PageLike, timeout = 15000): Promise<void> {
174+
const closed = await pollUntil(tauriPage, async () => !(await tauriPage.isVisible('.modal-overlay')), timeout)
175175
expect(closed).toBe(true)
176176
}

apps/desktop/test/e2e-playwright/file-watching.spec.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,29 @@ test.describe('File watching', () => {
257257
await tauriPage.click(`${TRANSFER_DIALOG} .btn-primary`)
258258
await pollUntil(tauriPage, async () => !(await tauriPage.isVisible('.modal-overlay')), 10000)
259259

260-
// File should appear in right pane
261-
await pollUntil(tauriPage, async () => fileExistsInPane(tauriPage, 'file-a.txt', 1), 5000)
262-
263-
// Wait for the watcher to fire after the synthetic diff, then verify
264-
// there is exactly one entry (no duplicate from watcher re-adding it).
265-
await sleep(2000)
266-
const count = await tauriPage.evaluate<number>(`(function() {
267-
var pane = document.querySelectorAll('.file-pane')[1];
268-
if (!pane) return 0;
269-
var entries = pane.querySelectorAll('.file-entry');
270-
var c = 0;
271-
for (var i = 0; i < entries.length; i++) {
272-
var name = (entries[i].querySelector('.col-name') || entries[i].querySelector('.name') || {}).textContent || '';
273-
if (name === 'file-a.txt') c++;
274-
}
275-
return c;
276-
})()`)
277-
expect(count).toBe(1)
260+
// File should appear in right pane, and after the watcher fires there
261+
// should be exactly one instance (no duplicate from watcher re-adding it).
262+
// Poll instead of a fixed sleep — the DOM can be transiently empty during
263+
// a watcher-triggered re-render.
264+
const noDuplicates = await pollUntil(
265+
tauriPage,
266+
async () => {
267+
const count = await tauriPage.evaluate<number>(`(function() {
268+
var pane = document.querySelectorAll('.file-pane')[1];
269+
if (!pane) return 0;
270+
var entries = pane.querySelectorAll('.file-entry');
271+
var c = 0;
272+
for (var i = 0; i < entries.length; i++) {
273+
var name = (entries[i].querySelector('.col-name') || entries[i].querySelector('.name') || {}).textContent || '';
274+
if (name === 'file-a.txt') c++;
275+
}
276+
return c;
277+
})()`)
278+
return count === 1
279+
},
280+
10000,
281+
)
282+
expect(noDuplicates).toBe(true)
278283
})
279284

280285
test('respects hidden file visibility for externally created dotfiles', async ({ tauriPage }) => {

apps/desktop/test/e2e-playwright/indexing.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ test.describe('Drive indexing', () => {
202202
}
203203
// If the index has data but not the exact size, the extra file hasn't been indexed yet.
204204
// Wait a bit more.
205-
console.warn( // eslint-disable-line no-console
205+
console.warn(
206206
`Index has recursiveSize=${String(fallback.recursiveSize)}, expected ${String(expectedSizeWithExtra)}`,
207207
)
208208
}

apps/desktop/test/e2e-playwright/mtp-conflicts.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test.describe('MTP cross-volume move conflicts', () => {
9898
await waitForConflictPolicy(tauriPage)
9999
await selectConflictPolicy(tauriPage, 'overwrite')
100100
await clickTransferStart(tauriPage)
101-
await waitForDialogsToClose(tauriPage)
101+
await waitForDialogsToClose(tauriPage, 30000)
102102

103103
// Wait for MTP operation
104104
await sleep(3000)
@@ -130,7 +130,7 @@ test.describe('MTP cross-volume move conflicts', () => {
130130
await waitForConflictPolicy(tauriPage)
131131
await selectConflictPolicy(tauriPage, 'skip')
132132
await clickTransferStart(tauriPage)
133-
await waitForDialogsToClose(tauriPage)
133+
await waitForDialogsToClose(tauriPage, 30000)
134134

135135
await sleep(3000)
136136

@@ -162,7 +162,7 @@ test.describe('MTP cross-volume move conflicts', () => {
162162
await waitForConflictPolicy(tauriPage)
163163
await selectConflictPolicy(tauriPage, 'overwrite')
164164
await clickTransferStart(tauriPage)
165-
await waitForDialogsToClose(tauriPage)
165+
await waitForDialogsToClose(tauriPage, 30000)
166166

167167
await sleep(3000)
168168
await mcpCall('refresh', {})
@@ -210,7 +210,7 @@ test.describe('MTP same-volume move conflicts', () => {
210210
await waitForConflictPolicy(tauriPage)
211211
await selectConflictPolicy(tauriPage, 'overwrite')
212212
await clickTransferStart(tauriPage)
213-
await waitForDialogsToClose(tauriPage)
213+
await waitForDialogsToClose(tauriPage, 30000)
214214

215215
await sleep(3000)
216216
await mcpCall('refresh', {})
@@ -251,7 +251,7 @@ test.describe('MTP same-volume move conflicts', () => {
251251
await waitForConflictPolicy(tauriPage)
252252
await selectConflictPolicy(tauriPage, 'skip')
253253
await clickTransferStart(tauriPage)
254-
await waitForDialogsToClose(tauriPage)
254+
await waitForDialogsToClose(tauriPage, 30000)
255255

256256
await sleep(3000)
257257

0 commit comments

Comments
 (0)