Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/api-keys-select-expiration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/testing': patch
---

Make the unstable API keys page object's `selectExpiration` wait for the expiration dropdown to open and close, instead of force-clicking the option while the list is still animating.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect } from '@playwright/test';

import type { EnhancedPage } from './app';
import { common } from './common';

Expand Down Expand Up @@ -51,8 +53,11 @@ export const createAPIKeysComponentPageObject = (testArgs: { page: EnhancedPage
return page.getByLabel(/Description/i).fill(value);
},
selectExpiration: async (value?: keyof typeof expirationOptions) => {
await page.getByRole('button', { name: /Select date/i }).click();
return page.getByText(expirationOptions[value ?? 'never'], { exact: true }).click({ force: true });
const trigger = page.locator('.cl-selectButton__apiKeyExpiration');
await trigger.click();
await expect(trigger).toHaveAttribute('aria-expanded', 'true');
await page.getByRole('option', { name: expirationOptions[value ?? 'never'], exact: true }).click();
await expect(trigger).toHaveAttribute('aria-expanded', 'false');
},
clickSaveButton: () => {
return page.getByText(/Create key/i).click();
Expand Down
Loading