Skip to content

Commit e4a3d8e

Browse files
fix: handle request access button as link or dropdown in e2e test #4749
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 03ad4da commit e4a3d8e

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

e2e/anvil/anvil-dataset.spec.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ describe("Dataset", () => {
2525
test("displays request access button", async ({ page }) => {
2626
await goToDataset(page, CHIP_TEXT_ACCESS_REQUIRED);
2727

28-
// Confirm request access button is visible.
29-
const exportButton = getLinkWithText(page, BUTTON_TEXT_REQUEST_ACCESS);
28+
// Confirm request access button is visible (can be link or dropdown button).
29+
const exportButton = getLinkOrButtonWithText(
30+
page,
31+
BUTTON_TEXT_REQUEST_ACCESS
32+
);
3033
await expect(exportButton).toBeVisible();
3134
});
3235

@@ -209,6 +212,16 @@ function getLinkWithText(page: Page, buttonText: string): Locator {
209212
return page.locator(`a:has-text("${buttonText}")`);
210213
}
211214

215+
/**
216+
* Return the link or button with the given text.
217+
* @param page - Playwright page object.
218+
* @param buttonText - The text of the element to find.
219+
* @returns - Playwright locator object for the link or button.
220+
*/
221+
function getLinkOrButtonWithText(page: Page, buttonText: string): Locator {
222+
return page.locator(`:is(a, button):has-text("${buttonText}")`);
223+
}
224+
212225
/**
213226
* Navigate to the datasets list.
214227
* @param page - Playwright page object.

0 commit comments

Comments
 (0)