* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
76 lines
2.5 KiB
TypeScript
76 lines
2.5 KiB
TypeScript
import { expect } from "@playwright/test";
|
|
import path from "node:path";
|
|
|
|
import { CAL_URL } from "@calcom/lib/constants";
|
|
import { prisma } from "@calcom/prisma";
|
|
|
|
import { test } from "../lib/fixtures";
|
|
|
|
test.describe("User Avatar", async () => {
|
|
test("it can upload a user profile image", async ({ page, users }) => {
|
|
const user = await users.create({ name: "John Doe" });
|
|
await user.apiLogin();
|
|
|
|
let objectKey: string;
|
|
|
|
await test.step("Can upload an initial picture", async () => {
|
|
await page.goto("/settings/my-account/profile");
|
|
|
|
await page.getByTestId("open-upload-avatar-dialog").click();
|
|
|
|
const [fileChooser] = await Promise.all([
|
|
// It is important to call waitForEvent before click to set up waiting.
|
|
page.waitForEvent("filechooser"),
|
|
// Opens the file chooser.
|
|
page
|
|
.getByTestId("open-upload-image-filechooser")
|
|
.click(),
|
|
]);
|
|
|
|
await fileChooser.setFiles(`${path.dirname(__filename)}/../fixtures/cal.png`);
|
|
|
|
await page.getByTestId("upload-avatar").click();
|
|
|
|
await page.getByText("Update").click();
|
|
await page.waitForSelector("text=Settings updated successfully");
|
|
|
|
const response = await prisma.avatar.findUniqueOrThrow({
|
|
where: {
|
|
teamId_userId_isBanner: {
|
|
userId: user.id,
|
|
teamId: 0,
|
|
isBanner: false,
|
|
},
|
|
},
|
|
});
|
|
|
|
objectKey = response.objectKey;
|
|
|
|
const avatarImage = page.getByTestId("profile-upload-avatar").locator("img");
|
|
|
|
await expect(avatarImage).toHaveAttribute("src", new RegExp(`^\/api\/avatar\/${objectKey}\.png$`));
|
|
|
|
const urlResponse = await page.request.get((await avatarImage.getAttribute("src")) || "", {
|
|
maxRedirects: 0,
|
|
});
|
|
|
|
await expect(urlResponse?.status()).toBe(200);
|
|
});
|
|
|
|
await test.step("View avatar on the public page", async () => {
|
|
await page.goto(`/${user.username}`);
|
|
|
|
await expect(page.locator(`img`)).toHaveAttribute(
|
|
"src",
|
|
new RegExp(`\/api\/avatar\/${objectKey}\.png$`)
|
|
);
|
|
// verify objectKey is passed to the OG image
|
|
// yes, OG image URI encodes at multiple places.. don't want to mess with that.
|
|
const ogImageLocator = page.locator('meta[property="og:image"]');
|
|
await expect(ogImageLocator).toHaveCount(1);
|
|
const searchParam = `meetingImage=${encodeURIComponent(`${CAL_URL}/api/avatar/${objectKey}.png`)}`;
|
|
await expect(ogImageLocator).toHaveAttribute("content", new RegExp(encodeURIComponent(searchParam)));
|
|
});
|
|
});
|
|
});
|