Skip to content

Commit 4e6ab3d

Browse files
Fix racy import validation in duplicate detection test
setValue types character-by-character, firing async validation on each keystroke. On slow runners, a validation for partial text can resolve after the final one, showing "1 invalid" instead of "1 duplicate". Set the value directly and dispatch a single input event instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ebfc231 commit 4e6ab3d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/firefox/extension.spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,16 @@ describe('Popup', function () {
205205
const importBtn = await $('#import-btn');
206206
await importBtn.click();
207207

208+
// Set value directly and dispatch a single input event, rather than using
209+
// setValue which types character-by-character. Each keystroke triggers async
210+
// validation — on slow runners, a validation for partial text can resolve
211+
// after the final one, producing "1 invalid" instead of "1 duplicate".
208212
const textarea = await $('#import-textarea');
209-
await textarea.setValue(`- ${issueUrl(TEST_ISSUES[0])}`);
213+
const pasteText = `- ${issueUrl(TEST_ISSUES[0])}`;
214+
await browser.execute(function (el, text) {
215+
el.value = text;
216+
el.dispatchEvent(new Event('input', { bubbles: true }));
217+
}, textarea, pasteText);
210218
await browser.pause(500);
211219

212220
const validation = await $('#import-validation');

0 commit comments

Comments
 (0)