revert: "fix: view team bookings (#14079)" (#14561)

This reverts commit f86c448359.
This commit is contained in:
Keith Williams authored and GitHub committed 2024-04-13 00:53:05 +00:00
1 parent becad5ee67
commit fd193e651d
5 files changed
+82 -828

No files matched your search

-51
View File
@@ -1,5 +1,4 @@
import type { Frame, Page } from "@playwright/test";
import type { APIResponse } from "@playwright/test";
import { expect } from "@playwright/test";
import { createHash } from "crypto";
import EventEmitter from "events";
@@ -372,53 +371,3 @@ export async function doOnOrgDomain(
// 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 NotFoundPageTextAppDir = "This page does not exist.";
// export const NotFoundPageText = "ERROR 404";
export type Team = {
id: number;
slug: string | null;
name: string;
};
export type EventType = {
id: number;
title: string;
slug: string;
};
export type User = {
id: number;
name: string | null;
username: string | null;
};
export async function bookTeamEvent(page: Page, team: Team, eventType: EventType) {
await page.goto(`/team/${team.slug}/${eventType.slug}/`);
await bookEventOnThisPage(page);
const bookingTitle = `${eventType.title} between ${team.name} and ${testName}`;
await assertBookingIsCorrect(page, bookingTitle);
}
export async function bookUserEvent(page: Page, user: User, eventType: EventType) {
await page.goto(`/${user.username}/${eventType.slug}/`);
await bookEventOnThisPage(page);
const bookingTitle = `${eventType.title} between ${user.name} and ${testName}`;
await assertBookingIsCorrect(page, bookingTitle);
}
export async function assertBookingIsCorrect(page: Page, bookingTitle: string) {
await expect(page.locator("[data-testid=booking-title]")).toHaveText(bookingTitle);
// The booker should be in the attendee list
await expect(page.locator(`[data-testid="attendee-name-${testName}"]`)).toHaveText(testName);
}
export const assertBookingVisibleFor = async (
user: { apiLogin: () => Promise<APIResponse> },
pageFixture: Fixtures["page"],
eventType: EventType,
shouldBeVisible: boolean
) => {
await user.apiLogin();
await pageFixture.goto(`/bookings/upcoming`);
const upcomingBookingList = pageFixture.locator('[data-testid="booking-item"]');
shouldBeVisible
? await expect(upcomingBookingList.locator(`text=${eventType.title}`)).toBeVisible()
: await expect(upcomingBookingList.locator(`text=${eventType.title}`)).toBeHidden();
};