* refactor: apply biome formatting to apps/web (batch 1) Formats apps/web non-modules directories: - apps/web/app - apps/web/lib - apps/web/pages - apps/web/styles - apps/web/server - apps/web/test - Root-level .ts and .mjs files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to apps/web/modules (batch 2) Formats smaller apps/web/modules directories: - onboarding, data-table, users, apps, auth - integration-attribute-sync, shell, availability - feature-flags, team, webhooks, getting-started - feature-opt-in, troubleshooter, schedules, notifications - signup-view.tsx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to apps/web/modules (batch 3) Formats medium apps/web/modules directories: - bookings - event-types - insights - embed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to apps/web/modules/ee (batch 4) Formats apps/web/modules/ee directory. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to apps/web (batch 5) Formats remaining apps/web directories: - apps/web/modules/settings - apps/web/modules/booking-audit - apps/web/playwright Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to apps/web/components (batch 6) Formats remaining apps/web/components files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to new apps/web files from main Formats newly added/modified files from main merge: - WorkflowStepContainer.tsx (resolved merge conflicts) - Newly moved files (blocklist, form-builder, schedules, etc.) - Other files modified in main Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: apply biome formatting to new apps/web files from main Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
144 lines
5.0 KiB
TypeScript
144 lines
5.0 KiB
TypeScript
import { expect } from "@playwright/test";
|
|
import type { Page } from "@playwright/test";
|
|
import { doOnOrgDomain, setupOrgMember } from "playwright/lib/testUtils";
|
|
|
|
import { test } from "../lib/fixtures";
|
|
|
|
type TestContext = Awaited<ReturnType<typeof setupOrgMember>>;
|
|
|
|
interface ToggleSeoSwitchParams {
|
|
page: Page;
|
|
switchTestId: string;
|
|
expectedChecked: boolean;
|
|
waitForMessage?: string;
|
|
}
|
|
|
|
interface VerifyRobotsMetaTagParams {
|
|
page: Page;
|
|
orgSlug: string | null;
|
|
urls: string[];
|
|
expectedContent: string;
|
|
}
|
|
|
|
// Helper function to toggle the SEO switch
|
|
async function toggleSeoSwitch({
|
|
page,
|
|
switchTestId,
|
|
expectedChecked,
|
|
waitForMessage,
|
|
}: ToggleSeoSwitchParams): Promise<void> {
|
|
const seoSwitch = await page.getByTestId(switchTestId);
|
|
await seoSwitch.click();
|
|
await expect(seoSwitch).toBeChecked({ checked: expectedChecked });
|
|
if (waitForMessage) {
|
|
await page.waitForSelector(`text=${waitForMessage}`);
|
|
}
|
|
}
|
|
|
|
async function verifyRobotsMetaTag({ page, orgSlug, urls, expectedContent }: VerifyRobotsMetaTagParams) {
|
|
await doOnOrgDomain({ orgSlug, page }, async ({ page, goToUrlWithErrorHandling }) => {
|
|
for (const relativeUrl of urls) {
|
|
const { url } = await goToUrlWithErrorHandling(relativeUrl);
|
|
const metaTag = page.locator('head > meta[name="robots"]');
|
|
await expect(metaTag).toBeAttached();
|
|
const metaTagValue = await metaTag.getAttribute("content");
|
|
expect(metaTagValue).not.toBeNull();
|
|
expect(
|
|
metaTagValue
|
|
?.split(",")
|
|
.map((s) => s.trim())
|
|
.join(",")
|
|
).toEqual(
|
|
expectedContent
|
|
.split(",")
|
|
.map((s) => s.trim())
|
|
.join(",")
|
|
);
|
|
}
|
|
});
|
|
}
|
|
|
|
test.describe("Organization Settings", () => {
|
|
// Skip these tests for now since the meta tag is being placed in the body instead of the head
|
|
test.describe
|
|
.skip("Setting - 'Allow search engine indexing' inside Org profile settings", async () => {
|
|
let ctx: TestContext;
|
|
|
|
test.beforeEach(async ({ users }) => {
|
|
ctx = await setupOrgMember(users);
|
|
});
|
|
|
|
test.afterEach(async ({ users }) => {
|
|
await users.deleteAll();
|
|
});
|
|
|
|
test("Disabling SEO indexing updates settings and meta tags", async ({ page }) => {
|
|
await test.step("Disable 'Allow search engine indexing' for organization", async () => {
|
|
await page.goto(`/settings/organizations/profile`);
|
|
const seoSwitch = await page.getByTestId(`${ctx.org.id}-seo-indexing-switch`);
|
|
await expect(seoSwitch).toBeChecked({ checked: false });
|
|
});
|
|
|
|
await test.step("Verify 'robots' meta tag for different pages when SEO indexing is disabled", async () => {
|
|
const { team, teamEvent, org, orgMember, userEvent } = ctx;
|
|
await verifyRobotsMetaTag({
|
|
page,
|
|
orgSlug: org.slug,
|
|
urls: [
|
|
`/team/${team.slug}`,
|
|
`/team/${team.slug}/${teamEvent.slug}`,
|
|
`/${orgMember.username}`,
|
|
`/${orgMember.username}/${userEvent.slug}`,
|
|
],
|
|
expectedContent: "noindex,nofollow",
|
|
});
|
|
});
|
|
});
|
|
|
|
test("Enabling SEO indexing updates settings and meta tags", async ({ page }) => {
|
|
await test.step("Enable 'Allow search engine indexing' for organization", async () => {
|
|
await page.goto(`/settings/organizations/profile`);
|
|
await toggleSeoSwitch({
|
|
page,
|
|
switchTestId: `${ctx.org.id}-seo-indexing-switch`,
|
|
expectedChecked: true,
|
|
waitForMessage: "Your team has been updated successfully.",
|
|
});
|
|
});
|
|
|
|
await test.step("Verify 'robots' meta tag for different pages when SEO indexing is enabled", async () => {
|
|
const { team, teamEvent, org, orgMember, userEvent } = ctx;
|
|
await verifyRobotsMetaTag({
|
|
page,
|
|
orgSlug: org.slug,
|
|
urls: [
|
|
`/team/${team.slug}`,
|
|
`/team/${team.slug}/${teamEvent.slug}`,
|
|
`/${orgMember.username}`,
|
|
`/${orgMember.username}/${userEvent.slug}`,
|
|
],
|
|
expectedContent: "index,follow",
|
|
});
|
|
});
|
|
});
|
|
|
|
test("Organization settings override user settings", async ({ page }) => {
|
|
await test.step("Disable 'Allow search engine indexing' for organization", async () => {
|
|
await page.goto(`/settings/organizations/profile`);
|
|
const seoSwitch = await page.getByTestId(`${ctx.org.id}-seo-indexing-switch`);
|
|
await expect(seoSwitch).toBeChecked({ checked: false });
|
|
});
|
|
|
|
await test.step("Verify organization settings override user settings for 'robots' meta tag", async () => {
|
|
const { org, orgMember, userEvent } = ctx;
|
|
await verifyRobotsMetaTag({
|
|
page,
|
|
orgSlug: org.slug,
|
|
urls: [`/${orgMember.username}/${userEvent.slug}`],
|
|
expectedContent: "noindex,nofollow",
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|