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
6 changes: 6 additions & 0 deletions apps/admin/src/settings/membership/access.acceptance.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ function configWithPublicSiteAccessLimit() {
async function choose(selectTestId: string, option: string) {
await settingsScreen.access().getByTestId(selectTestId).click();
await settingsScreen.selectOptionExact(option).click();
// Choosing an option starts the dropdown's close, it does not finish it: the
// list stays mounted and the body keeps `pointer-events: none` until the
// teardown completes. Anything clicked inside that window races it — the
// click is either refused or opens a layer the teardown then dismisses — so
// wait the dropdown out before the caller touches the next control.
await expect(settingsScreen.selectOptionExact(option)).toHaveCount(0);
}

describe('Access settings', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ describe('Tier checkout collection', () => {
await expect.element(modal.getByRole('button', { name: 'Saved' })).toBeVisible();

expect(createApi.lastRequest?.body).toMatchObject({ tiers: [{ name: createdTier.name }] });
// The checkout write is chained after the tier's, so "Saved" — which the tier's own
// save flips — is reached before it lands. Wait for the write itself.
await expect.poll(() => putApi.requests.length).toBe(1);
const sent = (
putApi.lastRequest?.body as { tiers_checkout_config: [{ shipping: { collect: boolean } }] }
).tiers_checkout_config[0];
Expand All @@ -380,7 +383,8 @@ describe('Tier checkout collection', () => {
await modal.getByLabelText('Collect business tax ID').click();
await modal.getByRole('button', { name: 'Save' }).click();
await expect.element(modal.getByRole('button', { name: 'Saved' })).toBeVisible();
expect(putApi.requests).toHaveLength(1);
// "Saved" is the tier save's signal; the checkout write is chained after it.
await expect.poll(() => putApi.requests.length).toBe(1);

await modal.getByRole('button', { name: 'Close' }).click();
await expect(settingsScreen.tierDetailModal()).toHaveCount(0);
Expand Down
Loading