test: Add more orgs tests (#12241)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-11-21 14:03:01 -03:00
1 parent 556b382f75
commit 48dde246e9
15 files changed
+397 -35

No files matched your search

@@ -11,24 +11,6 @@ const MembersView = () => {
<LicenseRequired>
<Meta title={t("organization_members")} description={t("organization_description")} />
<div>
{/* {team && (
<>
{isInviteOpen && (
<TeamInviteList
teams={[
{
id: team.id,
accepted: team.membership.accepted || false,
logo: team.logo,
name: team.name,
slug: team.slug,
role: team.membership.role,
},
]}
/>
)}
</>
)} */}
<UserListTable />
</div>
</LicenseRequired>
@@ -25,6 +25,7 @@ import {
TextAreaField,
} from "@calcom/ui";
import { Link } from "@calcom/ui/components/icon";
import type { Window as WindowWithClipboardValue } from "@calcom/web/playwright/fixtures/clipboard";
import type { PendingMember } from "../lib/types";
import { GoogleWorkspaceInviteButton } from "./GoogleWorkspaceInviteButton";
@@ -92,8 +93,15 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
const inviteLink =
isOrgInvite || (props?.orgMembers && props.orgMembers?.length > 0) ? orgInviteLink : teamInviteLink;
await navigator.clipboard.writeText(inviteLink);
showToast(t("invite_link_copied"), "success");
try {
await navigator.clipboard.writeText(inviteLink);
showToast(t("invite_link_copied"), "success");
} catch (e) {
if (process.env.NEXT_PUBLIC_IS_E2E) {
(window as WindowWithClipboardValue).E2E_CLIPBOARD_VALUE = inviteLink;
}
console.error(e);
}
};
const options: MembershipRoleOption[] = useMemo(() => {
@@ -204,12 +204,15 @@ export function UserListTable() {
id: "teams",
header: "Teams",
cell: ({ row }) => {
const { teams, accepted } = row.original;
const { teams, accepted, email } = row.original;
// TODO: Implement click to filter
return (
<div className="flex h-full flex-wrap items-center gap-2">
{accepted ? null : (
<Badge variant="red" className="text-xs">
<Badge
variant="red"
className="text-xs"
data-testid={`email-${email.replace("@", "")}-pending`}>
Pending
</Badge>
)}
@@ -7,12 +7,7 @@ import { sendAdminOrganizationNotification } from "@calcom/emails";
import { hashPassword } from "@calcom/features/auth/lib/hashPassword";
import { subdomainSuffix } from "@calcom/features/ee/organizations/lib/orgDomains";
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/availability";
import {
IS_TEAM_BILLING_ENABLED,
RESERVED_SUBDOMAINS,
IS_PRODUCTION,
WEBAPP_URL,
} from "@calcom/lib/constants";
import { IS_TEAM_BILLING_ENABLED, RESERVED_SUBDOMAINS, WEBAPP_URL } from "@calcom/lib/constants";
import { getTranslation } from "@calcom/lib/server/i18n";
import slugify from "@calcom/lib/slugify";
import { prisma } from "@calcom/prisma";
@@ -175,7 +170,6 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {
return { user: { ...createOwnerOrg, password } };
} else {
if (!IS_PRODUCTION) return { checked: true };
const language = await getTranslation(input.language ?? "en", "common");
const secret = createHash("md5")
@@ -2,6 +2,7 @@ import { createHash } from "crypto";
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import logger from "@calcom/lib/logger";
import { totpRawCheck } from "@calcom/lib/totp";
import type { ZVerifyCodeInputSchema } from "@calcom/prisma/zod-utils";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
@@ -21,7 +22,10 @@ export const verifyCodeHandler = async ({ ctx, input }: VerifyCodeOptions) => {
if (!user || !email || !code) throw new TRPCError({ code: "BAD_REQUEST" });
if (!IS_PRODUCTION) return true;
if (!IS_PRODUCTION || process.env.NEXT_PUBLIC_IS_E2E) {
logger.warn(`Skipping code verification in dev/E2E environment`);
return true;
}
await checkRateLimitAndThrowError({
rateLimitingType: "core",
identifier: email,