test: e2e for not allowing reschedule of a cancelled booking (#12928)
* test: e2e for not allowing reschedule of a cancelled booking * Fix failing test
This commit is contained in:
1 parent
69656b7861
commit
4fa7bb64eb
8 files changed
+51
-9
No files matched your search
@@ -126,6 +126,34 @@ test.describe("pro user", () => {
|
||||
await bookFirstEvent(page);
|
||||
});
|
||||
|
||||
test("Can cancel the recently created booking and shouldn't be allowed to reschedule it", async ({
|
||||
page,
|
||||
users,
|
||||
}, testInfo) => {
|
||||
// Because it tests the entire booking flow + the cancellation + rebooking
|
||||
test.setTimeout(testInfo.timeout * 3);
|
||||
await bookFirstEvent(page);
|
||||
await expect(page.locator(`[data-testid="attendee-email-${testEmail}"]`)).toHaveText(testEmail);
|
||||
await expect(page.locator(`[data-testid="attendee-name-${testName}"]`)).toHaveText(testName);
|
||||
|
||||
const [pro] = users.get();
|
||||
await pro.apiLogin();
|
||||
|
||||
await page.goto("/bookings/upcoming");
|
||||
await page.locator('[data-testid="cancel"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
return url.pathname.startsWith("/booking/");
|
||||
});
|
||||
await page.locator('[data-testid="confirm_cancel"]').click();
|
||||
|
||||
const cancelledHeadline = page.locator('[data-testid="cancelled-headline"]');
|
||||
await expect(cancelledHeadline).toBeVisible();
|
||||
const bookingCancelledId = new URL(page.url()).pathname.split("/booking/")[1];
|
||||
await page.goto(`/reschedule/${bookingCancelledId}`);
|
||||
// Should be redirected to the booking details page which shows the cancelled headline
|
||||
await expect(page.locator('[data-testid="cancelled-headline"]')).toBeVisible();
|
||||
});
|
||||
|
||||
test("can book an event that requires confirmation and then that booking can be accepted by organizer", async ({
|
||||
page,
|
||||
users,
|
||||
|
||||
@@ -535,7 +535,8 @@ type CustomUserOptsKeys =
|
||||
| "locale"
|
||||
| "name"
|
||||
| "email"
|
||||
| "organizationId";
|
||||
| "organizationId"
|
||||
| "role";
|
||||
type CustomUserOpts = Partial<Pick<Prisma.User, CustomUserOptsKeys>> & {
|
||||
timeZone?: TimeZoneEnum;
|
||||
eventTypes?: SupportedTestEventTypes[];
|
||||
@@ -565,6 +566,7 @@ const createUser = (
|
||||
completedOnboarding: opts?.completedOnboarding ?? true,
|
||||
timeZone: opts?.timeZone ?? TimeZoneEnum.UK,
|
||||
locale: opts?.locale ?? "en",
|
||||
role: opts?.role ?? "USER",
|
||||
...getOrganizationRelatedProps({ organizationId: opts?.organizationId, role: opts?.roleInOrganization }),
|
||||
schedules:
|
||||
opts?.completedOnboarding ?? true
|
||||
|
||||
@@ -354,6 +354,6 @@ export async function doOnOrgDomain(
|
||||
await callback({ page });
|
||||
}
|
||||
|
||||
// When App directory is there, this is the 404 page text. It is commented till it's disabled
|
||||
// export const NotFoundPageText = "This page could not be found";
|
||||
export const NotFoundPageText = "ERROR 404";
|
||||
// When App directory is there, this is the 404 page text. We should work on fixing the 404 page as it changed due to app directory.
|
||||
export const NotFoundPageText = "This page could not be found";
|
||||
// export const NotFoundPageText = "ERROR 404";
|
||||
@@ -18,12 +18,14 @@ function capitalize(text: string) {
|
||||
}
|
||||
|
||||
test.describe("Organization", () => {
|
||||
test("should be able to create an organization and complete onboarding", async ({
|
||||
test("Admin should be able to create an organization and complete onboarding", async ({
|
||||
page,
|
||||
users,
|
||||
emails,
|
||||
}) => {
|
||||
const orgOwner = await users.create();
|
||||
const orgOwner = await users.create({
|
||||
role: "ADMIN",
|
||||
});
|
||||
const orgDomain = `${orgOwner.username}-org`;
|
||||
const orgName = capitalize(`${orgOwner.username}-org`);
|
||||
await orgOwner.apiLogin();
|
||||
|
||||
@@ -13,7 +13,9 @@ test.describe("Settings/admin A/B tests", () => {
|
||||
url: "http://localhost:3000",
|
||||
},
|
||||
]);
|
||||
const user = await users.create();
|
||||
const user = await users.create({
|
||||
role: "ADMIN",
|
||||
});
|
||||
await user.apiLogin();
|
||||
|
||||
await page.goto("/settings/admin");
|
||||
|
||||
Reference in new issue
Block a user