Skip to content

Commit 3114056

Browse files
committed
Minor change on test
1 parent 50b1cd8 commit 3114056

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/v2/admin_groups.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)