| 48 | }); |
| 49 | |
| 50 | const openCreateOrgModal = async (currentOrg: string) => { |
| 51 | // Under parallel-suite load the radix menu re-renders while the org |
| 52 | // list loads; a click can land on a closing menu. Bounded retry with |
| 53 | // a clean reopen keeps the journey honest without 30s hangs. |
| 54 | for (let attempt = 1; ; attempt++) { |
| 55 | try { |
| 56 | await page.keyboard.press("Escape"); |
| 57 | await page.getByRole("button", { name: /Test User/ }).click(); |
| 58 | await page.getByRole("menuitem", { name: currentOrg }).click({ timeout: 5_000 }); |
| 59 | const subContent = page.locator('[data-slot="dropdown-menu-sub-content"]'); |
| 60 | await subContent.waitFor({ state: "visible", timeout: 5_000 }); |
| 61 | await subContent |
| 62 | .getByText("Create organization", { exact: true }) |
| 63 | .click({ timeout: 5_000 }); |
| 64 | await page.getByText("Add another organization").waitFor({ timeout: 5_000 }); |
| 65 | return; |
| 66 | } catch (error) { |
| 67 | if (attempt >= 3) throw error; |
| 68 | } |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | for (let i = 2; i <= FREE_LIMIT; i++) { |
| 73 | await step(`Open the org switcher and choose "Create organization"`, async () => { |