add localize
This commit is contained in:
parent
8386afc104
commit
1ec85e759e
|
@ -3,6 +3,7 @@ import { expect, type Page } from "@playwright/test";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import { randomString } from "@calcom/lib/random";
|
import { randomString } from "@calcom/lib/random";
|
||||||
|
|
||||||
|
import { localize } from "../lib/testUtils";
|
||||||
import type { createUsersFixture } from "./users";
|
import type { createUsersFixture } from "./users";
|
||||||
|
|
||||||
const reschedulePlaceholderText = "Let others know why you need to reschedule";
|
const reschedulePlaceholderText = "Let others know why you need to reschedule";
|
||||||
|
@ -235,11 +236,11 @@ export function createBookingPageFixture(page: Page) {
|
||||||
}
|
}
|
||||||
await page.getByTestId("field-add-save").click();
|
await page.getByTestId("field-add-save").click();
|
||||||
},
|
},
|
||||||
updateEventType: async (options?: { shouldCheck: boolean }) => {
|
updateEventType: async (options?: { shouldCheck: boolean; name: string }) => {
|
||||||
await page.getByTestId("update-eventtype").click();
|
await page.getByTestId("update-eventtype").click();
|
||||||
options?.shouldCheck &&
|
options?.shouldCheck &&
|
||||||
(await expect(
|
(await expect(
|
||||||
page.getByRole("button", { name: "Test Managed Event Type event type updated successfully" })
|
page.getByRole("button", { name: `${options?.name} event type updated successfully` })
|
||||||
).toBeVisible());
|
).toBeVisible());
|
||||||
},
|
},
|
||||||
previewEventType: async () => {
|
previewEventType: async () => {
|
||||||
|
@ -383,12 +384,16 @@ export function createBookingPageFixture(page: Page) {
|
||||||
await expect(scheduleSuccessfullyPage).toBeVisible();
|
await expect(scheduleSuccessfullyPage).toBeVisible();
|
||||||
},
|
},
|
||||||
createTeam: async (name: string) => {
|
createTeam: async (name: string) => {
|
||||||
await page.getByRole("link", { name: "Teams" }).click();
|
const teamsText = (await localize("en"))("teams");
|
||||||
|
const continueText = (await localize("en"))("continue");
|
||||||
|
const publishTeamText = (await localize("en"))("team_publish");
|
||||||
|
|
||||||
|
await page.getByRole("link", { name: teamsText }).click();
|
||||||
await page.getByTestId("new-team-btn").click();
|
await page.getByTestId("new-team-btn").click();
|
||||||
await page.getByPlaceholder("Acme Inc.").click();
|
await page.getByPlaceholder("Acme Inc.").click();
|
||||||
await page.getByPlaceholder("Acme Inc.").fill(`${name}-${randomString(3)}`);
|
await page.getByPlaceholder("Acme Inc.").fill(`${name}-${randomString(3)}`);
|
||||||
await page.getByRole("button", { name: "Continue" }).click();
|
await page.getByRole("button", { name: continueText }).click();
|
||||||
await page.getByRole("button", { name: "Publish team" }).click();
|
await page.getByRole("button", { name: publishTeamText }).click();
|
||||||
|
|
||||||
await page.getByTestId("vertical-tab-Back").click();
|
await page.getByTestId("vertical-tab-Back").click();
|
||||||
},
|
},
|
||||||
|
@ -397,20 +402,21 @@ export function createBookingPageFixture(page: Page) {
|
||||||
await page.getByTestId("option-0").click();
|
await page.getByTestId("option-0").click();
|
||||||
|
|
||||||
// We first simulate to create a default event type to check if managed option is not available
|
// We first simulate to create a default event type to check if managed option is not available
|
||||||
await expect(
|
|
||||||
page
|
const managedEventDescription = (await localize("en"))("managed_event_description");
|
||||||
.locator("div")
|
const roundRobinEventDescription = (await localize("en"))("round_robin_description");
|
||||||
.filter({ hasText: "Managed EventCreate & distribute event types in bulk to team members" })
|
const collectiveEventDescription = (await localize("en"))("collective_description");
|
||||||
).toBeHidden();
|
const quickChatText = (await localize("en"))("quick_chat");
|
||||||
|
await expect(page.locator("div").filter({ hasText: managedEventDescription })).toBeHidden();
|
||||||
await page.getByTestId("dialog-rejection").click();
|
await page.getByTestId("dialog-rejection").click();
|
||||||
|
|
||||||
await page.getByTestId("new-event-type").click();
|
await page.getByTestId("new-event-type").click();
|
||||||
await page.getByTestId("option-team-1").click();
|
await page.getByTestId("option-team-1").click();
|
||||||
await page.getByPlaceholder("Quick Chat").fill(name);
|
await page.getByPlaceholder(quickChatText).fill(name);
|
||||||
if (options.isCollectiveType) {
|
if (options.isCollectiveType) {
|
||||||
await page
|
await page
|
||||||
.locator("div")
|
.locator("div")
|
||||||
.filter({ hasText: "CollectiveSchedule meetings when all selected team members are available." })
|
.filter({ hasText: `Collective${collectiveEventDescription}` })
|
||||||
.getByRole("radio")
|
.getByRole("radio")
|
||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
@ -419,7 +425,7 @@ export function createBookingPageFixture(page: Page) {
|
||||||
if (options.isRoundRobinType) {
|
if (options.isRoundRobinType) {
|
||||||
await page
|
await page
|
||||||
.locator("div")
|
.locator("div")
|
||||||
.filter({ hasText: "Round RobinCycle meetings between multiple team members." })
|
.filter({ hasText: `Round Robin${roundRobinEventDescription}` })
|
||||||
.getByRole("radio")
|
.getByRole("radio")
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.click();
|
.click();
|
||||||
|
@ -428,16 +434,18 @@ export function createBookingPageFixture(page: Page) {
|
||||||
if (options.isManagedType) {
|
if (options.isManagedType) {
|
||||||
await page
|
await page
|
||||||
.locator("div")
|
.locator("div")
|
||||||
.filter({ hasText: "Managed EventCreate & distribute event types in bulk to team members" })
|
.filter({ hasText: `Managed Event${managedEventDescription}` })
|
||||||
.getByRole("radio")
|
.getByRole("radio")
|
||||||
.last()
|
.last()
|
||||||
.click();
|
.click();
|
||||||
await expect(
|
|
||||||
page.getByText('"username" will be filled by the username of the members assigned')
|
const managedEventClarification = (await localize("en"))("managed_event_url_clarification");
|
||||||
).toBeVisible();
|
await expect(page.getByText(managedEventClarification)).toBeVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Continue" }).click();
|
const continueText = (await localize("en"))("continue");
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: continueText }).click();
|
||||||
await expect(page.getByRole("button", { name: "event type created successfully" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "event type created successfully" })).toBeVisible();
|
||||||
await page.getByTestId("update-eventtype").click();
|
await page.getByTestId("update-eventtype").click();
|
||||||
},
|
},
|
||||||
|
@ -450,33 +458,36 @@ export function createBookingPageFixture(page: Page) {
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
// Check if the correct messages is showed in the dialog
|
// Check if the correct messages is showed in the dialog
|
||||||
await expect(
|
const deleteManagedEventTypeDescription = (await localize("en"))(
|
||||||
page.getByText("Members assigned to this event type will also have their event types deleted.")
|
"delete_managed_event_type_description"
|
||||||
).toBeVisible();
|
);
|
||||||
await expect(
|
const confirmDeleteEventTypeText = (await localize("en"))("deleteManagedEventTypeDescription");
|
||||||
page.getByText("Anyone who they've shared their link with will no longer be able to book using it")
|
await expect(page.getByText(deleteManagedEventTypeDescription)).toBeVisible();
|
||||||
).toBeVisible();
|
await page.getByRole("button", { name: confirmDeleteEventTypeText }).click();
|
||||||
await page.getByRole("button", { name: "Yes, delete" }).click();
|
|
||||||
|
|
||||||
// Check if the correct image is showed when there is no event type
|
// Check if the correct image is showed when there is no event type
|
||||||
await expect(page.getByTestId("empty-screen")).toBeVisible();
|
await expect(page.getByTestId("empty-screen")).toBeVisible();
|
||||||
},
|
},
|
||||||
assertManagedEventTypeDeleted: async () => {
|
assertManagedEventTypeDeleted: async () => {
|
||||||
await expect(page.getByRole("button", { name: "Event type deleted successfully" })).toBeVisible();
|
const eventTypeDeletedText = (await localize("en"))("event_type_deleted_successfully");
|
||||||
|
await expect(page.getByRole("button", { name: eventTypeDeletedText })).toBeVisible();
|
||||||
},
|
},
|
||||||
deleteTeam: async () => {
|
deleteTeam: async () => {
|
||||||
await page.getByRole("link", { name: "Teams" }).click();
|
const teamsText = (await localize("en"))("teams");
|
||||||
await page.getByRole("link", { name: "Team Logo Test Team" }).click();
|
const teamLogoText = (await localize("en"))("team_logo");
|
||||||
await page.getByRole("button", { name: "Disband Team" }).click();
|
const disbandTeamText = (await localize("en"))("disband_team");
|
||||||
await page.getByRole("button", { name: "Yes, disband team" }).click();
|
const confirmDisbandTeamText = (await localize("en"))("confirm_disband_team");
|
||||||
|
await page.getByRole("link", { name: teamsText }).click();
|
||||||
|
await page.getByRole("link", { name: `${teamLogoText} Test Team` }).click();
|
||||||
|
await page.getByRole("button", { name: disbandTeamText }).click();
|
||||||
|
await page.getByRole("button", { name: confirmDisbandTeamText }).click();
|
||||||
|
|
||||||
// Check if the correct image is showed when there is no team
|
// Check if the correct image is showed when there is no team
|
||||||
await expect(page.getByRole("img", { name: "Cal.com is better with teams" })).toBeVisible();
|
await expect(page.getByRole("img", { name: "Cal.com is better with teams" })).toBeVisible();
|
||||||
},
|
},
|
||||||
assertTeamDeleted: async () => {
|
assertTeamDeleted: async () => {
|
||||||
await expect(
|
const teamDisbandedText = (await localize("en"))("your_team_disbanded_successfully");
|
||||||
page.getByRole("button", { name: "Your team has been disbanded successfully" })
|
await expect(page.getByRole("button", { name: teamDisbandedText })).toBeVisible();
|
||||||
).toBeVisible();
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user