@@ -62,6 +62,12 @@ test('Admin groups management', async ({ page }) => {
6262 selectableGroups1 = await page . getByRole ( 'option' ) . count ( ) ;
6363 await selectSlimSelect ( page , page . getByLabel ( 'Select groups' ) , group2 , true ) ;
6464 await modal . getByRole ( 'button' , { name : 'Add' } ) . click ( ) ;
65+ if ( await modal . getByText ( 'Group is required' ) . isVisible ( ) ) {
66+ // Sometimes playwright clicks the "Add" button before the slim-select change event
67+ // is propagated; in that case no group is selected and the error appears.
68+ console . warn ( '"Group is required" message was displayed. Retrying to add group.' ) ;
69+ await modal . getByRole ( 'button' , { name : 'Add' } ) . click ( ) ;
70+ }
6571 await waitModalClosed ( page ) ;
6672 await expect ( groupBadges ) . toHaveCount ( initialGroupBadgesCount + 1 ) ;
6773 } ) ;
@@ -91,6 +97,8 @@ test('Admin groups management', async ({ page }) => {
9197 for ( let group of [ group2 , group3 ] . sort ( ) ) {
9298 await selectSlimSelect ( page , page . getByLabel ( 'Select groups' ) , group , true ) ;
9399 }
100+ // Await slim-select change events are propagated before clicking the Add button
101+ await new Promise ( r => setTimeout ( r , 500 ) ) ;
94102 await modal . getByRole ( 'button' , { name : 'Add' } ) . click ( ) ;
95103 await waitModalClosed ( page ) ;
96104 finalCount = initialGroupBadgesCount + 2 ;
0 commit comments