Add Event Types Test (#2610)
* Add Event Types Test * Accept license for tests * Accept license on preview * Remove debugging code * Add License consent flag * Test fixes * Update playwright.config.ts * Update webhookResponse-chromium.txt Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
parent
82d77dc10f
commit
7d98c0bb1c
4 changed files with 47 additions and 5 deletions
|
@ -20,7 +20,7 @@ export default function LicenseBanner() {
|
|||
- Acquire a commercial license to remove these terms by visiting: cal.com/sales
|
||||
NEXT_PUBLIC_LICENSE_CONSENT=''
|
||||
*/
|
||||
if (process.env.NEXT_PUBLIC_LICENSE_CONSENT === "agree") {
|
||||
if (process.env.NEXT_PUBLIC_LICENSE_CONSENT === "agree" || process.env.NEXT_PUBLIC_IS_E2E) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1117,7 +1117,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
|||
open={advancedSettingsVisible}
|
||||
onOpenChange={() => setAdvancedSettingsVisible(!advancedSettingsVisible)}>
|
||||
<>
|
||||
<CollapsibleTrigger type="button" className="flex w-full">
|
||||
<CollapsibleTrigger
|
||||
type="button"
|
||||
data-testid="show-advanced-settings"
|
||||
className="flex w-full">
|
||||
<ChevronRightIcon
|
||||
className={`${
|
||||
advancedSettingsVisible ? "rotate-90 transform" : ""
|
||||
|
@ -1127,7 +1130,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
|||
{t("show_advanced_settings")}
|
||||
</span>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent className="mt-4 space-y-6">
|
||||
<CollapsibleContent data-testid="advanced-settings-content" className="mt-4 space-y-6">
|
||||
{/**
|
||||
* Only display calendar selector if user has connected calendars AND if it's not
|
||||
* a team event. Since we don't have logic to handle each attende calendar (for now).
|
||||
|
@ -1663,7 +1666,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
|||
<Button href="/event-types" color="secondary" tabIndex={-1}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
<Button type="submit" disabled={updateMutation.isLoading}>
|
||||
<Button type="submit" data-testid="update-eventtype" disabled={updateMutation.isLoading}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
@ -69,6 +69,25 @@ test.describe("Event Types tests", () => {
|
|||
await expect(formTitle).toBe(firstTitle);
|
||||
await expect(formSlug).toBe(firstSlug);
|
||||
});
|
||||
test("edit first event", async ({ page }) => {
|
||||
const $eventTypes = await page.locator("[data-testid=event-types] > *");
|
||||
const firstEventTypeElement = await $eventTypes.first();
|
||||
await firstEventTypeElement.click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
return !!url.pathname.match(/\/event-types\/.+/);
|
||||
},
|
||||
});
|
||||
await expect(page.locator("[data-testid=advanced-settings-content]")).not.toBeVisible();
|
||||
await page.locator("[data-testid=show-advanced-settings]").click();
|
||||
await expect(page.locator("[data-testid=advanced-settings-content]")).toBeVisible();
|
||||
await page.locator("[data-testid=update-eventtype]").click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
return url.pathname.endsWith("/event-types");
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("free user", () => {
|
||||
|
@ -88,5 +107,25 @@ test.describe("Event Types tests", () => {
|
|||
test("can not add new event type", async ({ page }) => {
|
||||
await expect(page.locator("[data-testid=new-event-type]")).toBeDisabled();
|
||||
});
|
||||
|
||||
test("edit first event", async ({ page }) => {
|
||||
const $eventTypes = await page.locator("[data-testid=event-types] > *");
|
||||
const firstEventTypeElement = await $eventTypes.first();
|
||||
await firstEventTypeElement.click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
return !!url.pathname.match(/\/event-types\/.+/);
|
||||
},
|
||||
});
|
||||
await expect(page.locator("[data-testid=advanced-settings-content]")).not.toBeVisible();
|
||||
await page.locator("[data-testid=show-advanced-settings]").click();
|
||||
await expect(page.locator("[data-testid=advanced-settings-content]")).toBeVisible();
|
||||
await page.locator("[data-testid=update-eventtype]").click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
return url.pathname.endsWith("/event-types");
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":null,"additionalNotes":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
|
||||
{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","additionalNotes":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
|
Loading…
Reference in a new issue