Skip to content

Commit 2cd827d

Browse files
authored
fix(playwright): stabilize TagSuggestion select + scope tag-chip assertions (#27811)
* fix(playwright): stabilize TagSuggestion select + scope tag-chip assertions - selectTagInTagSuggestion now resolves the listbox via the combobox's aria-controls attribute instead of grabbing the first [role="listbox"] on the page, which races with stale dropdowns left open by previous combobox interactions and caused click() to hang until test timeout. - Scope post-select assertions to tags-container so they no longer match the still-rendered dropdown option in addition to the chip, which was triggering strict-mode violations. - DataProducts spec now dismisses the domain dropdown before opening the tags dropdown so the two listboxes don't overlap. * fix(playwright): simplify selectTagInTagSuggestion to anchor on tag-option testId Drop the listbox/aria-controls indirection in favour of the unique tag-option-${fqn} testId. click()'s actionability check covers what the explicit visibility/scroll waits were doing, and tag option testIds are unique across comboboxes so listbox scoping wasn't pulling its weight.
1 parent 5b935df commit 2cd827d

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/DataProducts.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,11 @@ test.describe('Data Products', () => {
479479
const domainOption = page.getByText(domain.data.displayName);
480480
await domainOption.waitFor({ state: 'visible' });
481481
await domainOption.click();
482+
await page.keyboard.press('Escape');
483+
await page
484+
.locator('[role="listbox"]')
485+
.first()
486+
.waitFor({ state: 'hidden' });
482487
});
483488

484489
await test.step('Search and select tag via TagSuggestion', async () => {
@@ -488,7 +493,10 @@ test.describe('Data Products', () => {
488493
});
489494

490495
await expect(
491-
page.getByTestId('add-domain-form').getByText(tag.data.displayName)
496+
page
497+
.getByTestId('add-domain-form')
498+
.getByTestId('tags-container')
499+
.getByText(tag.data.displayName)
492500
).toBeVisible();
493501
});
494502

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Domains.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,10 @@ test.describe('Domains', () => {
11671167
});
11681168

11691169
await expect(
1170-
page.getByTestId('add-domain-form').getByText(tag.data.displayName)
1170+
page
1171+
.getByTestId('add-domain-form')
1172+
.getByTestId('tags-container')
1173+
.getByText(tag.data.displayName)
11711174
).toBeVisible();
11721175
});
11731176

@@ -1219,7 +1222,10 @@ test.describe('Domains', () => {
12191222
});
12201223

12211224
await expect(
1222-
page.getByTestId('add-domain-form').getByText(tag.data.displayName)
1225+
page
1226+
.getByTestId('add-domain-form')
1227+
.getByTestId('tags-container')
1228+
.getByText(tag.data.displayName)
12231229
).toBeVisible();
12241230
});
12251231

openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ export const selectTagInTagSuggestion = async (
616616
}
617617
) => {
618618
const tagInput = page.getByRole('combobox', { name: 'Tags' });
619+
const tagOption = page.getByTestId(`tag-option-${tagFqn}`);
619620

620621
const tagSearchResponse = page.waitForResponse((response) => {
621622
const url = response.url();
@@ -626,13 +627,11 @@ export const selectTagInTagSuggestion = async (
626627
);
627628
});
628629

630+
await tagInput.click();
629631
await tagInput.fill(searchTerm);
630632
await tagSearchResponse;
631633

632-
await page.locator('[role="listbox"]').first().waitFor({ state: 'visible' });
633-
const tagOption = page.getByTestId(`tag-option-${tagFqn}`);
634-
await tagOption.waitFor({ state: 'visible' });
635634
await tagOption.click();
636635
await page.keyboard.press('Escape');
637-
await page.locator('[role="listbox"]').first().waitFor({ state: 'hidden' });
636+
await tagOption.waitFor({ state: 'hidden' });
638637
};

0 commit comments

Comments
 (0)