File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/compass-e2e-tests/helpers/commands Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,19 @@ export async function selectOption(
88 optionText : string
99) : Promise < void > {
1010 // click the field's button
11- const selectButton = browser . $ ( selector ) ;
11+ const selectButton = browser . $ ( ` ${ selector } ` ) ;
1212 await selectButton . waitForDisplayed ( ) ;
1313 await selectButton . click ( ) ;
1414
15- const controlledMenuId : string = await selectButton . getAttribute (
16- 'aria-controls'
17- ) ;
15+ let controlledMenuId = await selectButton . getAttribute ( 'aria-controls' ) ;
16+ // In leafygreen combobox we usually not immediately targeting the element
17+ // that controls the listbox, so if we haven't find it, try to look in the
18+ // element we selected
19+ if ( ! controlledMenuId ) {
20+ controlledMenuId = await selectButton
21+ . $ ( '[aria-controls]' )
22+ . getAttribute ( 'aria-controls' ) ;
23+ }
1824 // wait for the list to pop up
1925 const selectList = browser . $ ( `[id="${ controlledMenuId } "][role="listbox"]` ) ;
2026 await selectList . waitForDisplayed ( ) ;
You can’t perform that action at this time.
0 commit comments