* add functionality to change location in booking and send out mail * add i18n * change location with dropdown like in event-types * small fixes and code clean up * clean code * improve format of current Location string * clean code * clear selection when dialog closed * added mutation and changed props (first working verison) * clean code * clean code * clean code * clean code * fix typo * change maxHeight of select * use useWatch for selectedLocation * pass default values with props * set current location directly in useState * clear selected values when updating location * fix trpc query for credentialst * change icons for editing booking * improve naming of variables * remove unnecessary orderBy * use locationOptionsToString method * fix current location naming for Cal Video * add phone input * save phone number as location of booking * remove input field for phone number for event-types * fix redirection issue * show previous selected location in event-type * remove attendee number from selection for booking * make first letter of location lowercase * remove input field for attendee phone number * clear Errors when changing location type * set location details to optional * clean code * fixing issue that dropdown doesn't close when dialog opens * clean code * make overflow visibile in dialog * fix existing bug with address not showing in event-type settings * fix issue with losing focus after validation * close rejection dialog * small spelling fixes * fix issue with LocationChangeEmail * fix failing E2E test * fix failing E2E test * fix E2E test * bug fix for saving user phone, and other minor changes * merge main * improve text * fix UI of booking list * Delete admin * remove selection after update and submit * add translation for error message * add default values for checkbox * add "your phone number" to locations on booking page * remove duplicate attributes from viewer.bookings Co-authored-by: Omar López <zomars@me.com> * check if user is authorized to make changes to booking * remove location string * clan code for displayLocaitonPublicly checkbox * fetch locationOptions on server side * remove trpc query for credentials * fix phone number input * fix labels of host and attendee phone number for booking page * Migrates edit location to tRPC * Link elemnt should only be used in `a` tags * Adds missin router * Migrates locationOptions to tRPC query * Type fixes Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Alan <alannnc@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
139 lines
4.3 KiB
TypeScript
139 lines
4.3 KiB
TypeScript
import { expect } from "@playwright/test";
|
|
|
|
import { test } from "./lib/fixtures";
|
|
import {
|
|
bookFirstEvent,
|
|
bookTimeSlot,
|
|
selectFirstAvailableTimeSlotNextMonth,
|
|
selectSecondAvailableTimeSlotNextMonth,
|
|
} from "./lib/testUtils";
|
|
|
|
test.describe.configure({ mode: "parallel" });
|
|
|
|
test.describe("free user", () => {
|
|
test.beforeEach(async ({ page, users }) => {
|
|
const free = await users.create({ plan: "FREE" });
|
|
await page.goto(`/${free.username}`);
|
|
});
|
|
test.afterEach(async ({ users }) => {
|
|
await users.deleteAll();
|
|
});
|
|
|
|
test("only one visible event", async ({ page, users }) => {
|
|
const [free] = users.get();
|
|
await expect(page.locator(`[href="/${free.username}/${free.eventTypes[0].slug}"]`)).toBeVisible();
|
|
await expect(page.locator(`[href="/${free.username}/${free.eventTypes[1].slug}"]`)).not.toBeVisible();
|
|
});
|
|
|
|
test("cannot book same slot multiple times", async ({ page }) => {
|
|
// Click first event type
|
|
await page.click('[data-testid="event-type-link"]');
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
|
|
|
// Navigate to book page
|
|
await page.waitForNavigation({
|
|
url(url) {
|
|
return url.pathname.endsWith("/book");
|
|
},
|
|
});
|
|
|
|
// save booking url
|
|
const bookingUrl: string = page.url();
|
|
|
|
// book same time spot twice
|
|
await bookTimeSlot(page);
|
|
|
|
// Make sure we're navigated to the success page
|
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
|
|
|
// return to same time spot booking page
|
|
await page.goto(bookingUrl);
|
|
|
|
// book same time spot again
|
|
await bookTimeSlot(page);
|
|
|
|
// check for error message
|
|
await expect(page.locator("[data-testid=booking-fail]")).toBeVisible();
|
|
});
|
|
|
|
test("Second event type is not bookable", async ({ page, users }) => {
|
|
const [free] = users.get();
|
|
// Not available in listing
|
|
await expect(page.locator(`[href="/${free.username}/${free.eventTypes[1].slug}"]`)).toHaveCount(0);
|
|
|
|
await page.goto(`/${free.username}/${free.eventTypes[1].slug}`);
|
|
// Not available on a direct visit to event type page
|
|
await expect(page.locator('[data-testid="404-page"]')).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe("pro user", () => {
|
|
test.beforeEach(async ({ page, users }) => {
|
|
const pro = await users.create();
|
|
await page.goto(`/${pro.username}`);
|
|
});
|
|
test.afterEach(async ({ users }) => {
|
|
await users.deleteAll();
|
|
});
|
|
|
|
test("pro user's page has at least 2 visible events", async ({ page }) => {
|
|
// await page.pause();
|
|
const $eventTypes = page.locator("[data-testid=event-types] > *");
|
|
expect(await $eventTypes.count()).toBeGreaterThanOrEqual(2);
|
|
});
|
|
|
|
test("book an event first day in next month", async ({ page }) => {
|
|
await bookFirstEvent(page);
|
|
});
|
|
|
|
test("can reschedule a booking", async ({ page, users, bookings }) => {
|
|
const [pro] = users.get();
|
|
const [eventType] = pro.eventTypes;
|
|
await bookings.create(pro.id, pro.username, eventType.id);
|
|
|
|
await pro.login();
|
|
await page.goto("/bookings/upcoming");
|
|
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
|
await page.locator('[data-testid="reschedule"]').click();
|
|
await page.waitForNavigation({
|
|
url: (url) => {
|
|
const bookingId = url.searchParams.get("rescheduleUid");
|
|
return !!bookingId;
|
|
},
|
|
});
|
|
await selectSecondAvailableTimeSlotNextMonth(page);
|
|
// --- fill form
|
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
|
await page.waitForNavigation({
|
|
url(url) {
|
|
return url.pathname === "/success" && url.searchParams.get("reschedule") === "true";
|
|
},
|
|
});
|
|
});
|
|
|
|
test("Can cancel the recently created booking and rebook the same timeslot", async ({ page, users }) => {
|
|
await bookFirstEvent(page);
|
|
|
|
const [pro] = users.get();
|
|
await pro.login();
|
|
|
|
await page.goto("/bookings/upcoming");
|
|
await page.locator('[data-testid="cancel"]').first().click();
|
|
await page.waitForNavigation({
|
|
url: (url) => {
|
|
return url.pathname.startsWith("/cancel");
|
|
},
|
|
});
|
|
// --- fill form
|
|
await page.locator('[data-testid="cancel"]').click();
|
|
await page.waitForNavigation({
|
|
url(url) {
|
|
return url.pathname === "/cancel/success";
|
|
},
|
|
});
|
|
await page.goto(`/${pro.username}`);
|
|
await bookFirstEvent(page);
|
|
});
|
|
});
|