feat: Add Owner during organization creation (#13069)

* feat: Add Owner during organization creation

* chore: remove dead code

* fix: change route from onboard-admin to onboard-members

* fix: change button name to add_members from add_team_member

* fix: change MembershipRole badge colour

* fix: previous membership role bug

* update: "On-board administrators" tests

* fix: wrong import

* Reverted extra changes

* fix: current user cannot remove itself

* Reverted extra changes

* Reverted extra changes 2

* send isOrg to removeMember handler

* fix: removed prisma.user.delete cleanup as not needed

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-01-22 10:24:09 -05:00
1 parent 2ae2c15083
commit 3c8c6d0574
11 files changed
+62 -130

No files matched your search

@@ -103,18 +103,20 @@ test.describe("Organization", () => {
await page.locator("button[type=submit]").click();
// Waiting to be in next step URL
await page.waitForURL("/settings/organizations/*/onboard-admins");
await page.waitForURL("/settings/organizations/*/onboard-members");
});
await test.step("On-board administrators", async () => {
// Required field
await page.locator("button[type=submit]").click();
await page.waitForSelector('[data-testid="pending-member-list"]');
expect(await page.getByTestId("pending-member-item").count()).toBe(1);
// Happy path
const adminEmail = users.trackEmail({ username: "rick", domain: `${orgDomain}.com` });
await page.locator('textarea[name="emails"]').fill(adminEmail);
await page.locator("button[type=submit]").click();
//can add members
await page.getByTestId("new-member-button").click();
await page.locator('[placeholder="email\\@example\\.com"]').fill(adminEmail);
await page.getByTestId("invite-new-member-button").click();
await expect(page.locator(`li:has-text("${adminEmail}")`)).toBeVisible();
// Check if invited admin received the invitation email
await expectInvitationEmailToBeReceived(
page,
@@ -122,7 +124,15 @@ test.describe("Organization", () => {
adminEmail,
`${orgName}'s admin invited you to join the organization ${orgName} on Cal.com`
);
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
// can remove members
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
const lastRemoveMemberButton = page.getByTestId("remove-member-button").last();
await lastRemoveMemberButton.click();
await page.waitForLoadState("networkidle");
await expect(page.getByTestId("pending-member-item")).toHaveCount(1);
await page.getByTestId("publish-button").click();
// Waiting to be in next step URL
await page.waitForURL("/settings/organizations/*/add-teams");
});