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