fix(e2e): fix broken employment MultiSelect selector after IconButton refactor#1599
Draft
sinatragianpaolo wants to merge 6 commits into
Draft
fix(e2e): fix broken employment MultiSelect selector after IconButton refactor#1599sinatragianpaolo wants to merge 6 commits into
sinatragianpaolo wants to merge 6 commits into
Conversation
Target the StyledTrigger element directly instead of the outer wrapper, whose onClick is a no-op in non-editable mode, causing intermittent failures when the click coordinates miss the inner trigger in CI. Also wait for the option to be visible before clicking it.
…put correctly
The MultiSelect component uses isAutocomplete which renders the listbox via a
portal (listboxAppendToNode={document.body}). Clicking a portal option causes
mousedown to blur the combobox input before the click registers, making the
test flaky in CI. The trigger click also leaves focus on the wrapper div, not
the inner input, so keyboard.type() was going to the wrong element.
Fix: after opening the dropdown, wait for the input[role="combobox"] to be
visible, fill it to filter options, then use keyboard ArrowDown+Enter to select
via the input:keyDown:Enter path — no mousedown on the portal option.
…loyment test
After fill(), React needs two renders to propagate inputValue→matchingOptions→
aria-hidden on non-matching options. In CI this happens too slowly, so ArrowDown
was firing before Garden v9's ne.values updated, causing navigation to land on
Employee instead of Unemployed.
Fix: wait for getByRole('option').toHaveCount(1) before pressing ArrowDown.
Hidden options receive aria-hidden=true and drop out of getByRole results, so
count=1 reliably signals that Downshift's navigation pool is ready.
marcbon
approved these changes
May 4, 2026
Collaborator
|
ho approvato, ma ancora uno dei test e2e fallisce. metto in draft, da fixare @sinatragianpaolo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Causa
Il test
employment.spec.ts › It should have a number > 0 as an outputfalliva deterministicamente (3/3 tentativi) a causa di un selettore fragile basato sul conteggio di SVG.Il selettore originale era:
L'intento era aprire la dropdown del MultiSelect cliccando il suo chevron. Il selettore funzionava quando il pulsante di eliminazione dell'accordion era un
Buttoncon testo + icona (struttura al momento della scrittura del test, giugno 2025).Cosa ha rotto il test
Il commit d0067ea99 (settembre 2025) ha sostituito il
Buttoncon testo con unIconButtonche contiene solo ilTrashIconSVG:Questo ha aggiunto un SVG nell'header dell'accordion, spostando l'indice del chevron del MultiSelect da
nth(2)anth(3). Il click finiva sul chevron dell'accordion, che lo collassava invece di aprire la dropdown. UNEMPLOYED non veniva mai selezionato e il PATCH body restituiva['EMPLOYEE', 'STUDENT']invece di['EMPLOYEE', 'STUDENT', 'UNEMPLOYED'].Fix
Sostituito il selettore SVG-based con
getByRole('combobox'), che punta direttamente all'elemento interattivo del MultiSelect indipendentemente dalla struttura degli SVG circostanti.Rimosso anche un commento errato (
// Find the locality module) copiato dal test di locality.