refactor: Booking list items actions UI (#22540)
* refactor: Booking list items actions UI * chore: save * fix: UI * fix: logic and remove unused * chore: change name * Update apps/web/components/booking/BookingListItem.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * perf: refactor * fix: update tests * chore: update reschedule test * refactor: create bookingActions and BookingListItem * tests: add unit tests for booking actions * fix: logic * fix: cancel button regresso --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ee9699e267
commit
16a7bb7bc5
8 files changed
+907
-225
No files matched your search
@@ -155,7 +155,8 @@ test.describe("pro user", () => {
|
||||
await pro.apiLogin();
|
||||
await page.goto("/bookings/upcoming");
|
||||
await page.waitForSelector('[data-testid="bookings"]');
|
||||
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
await page.locator('[data-testid="reschedule"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
const bookingId = url.searchParams.get("rescheduleUid");
|
||||
@@ -205,6 +206,9 @@ test.describe("pro user", () => {
|
||||
await pro.apiLogin();
|
||||
|
||||
await page.goto("/bookings/upcoming");
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
// Click the cancel option in the dropdown
|
||||
await page.locator('[data-testid="cancel"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
return url.pathname.startsWith("/booking/");
|
||||
@@ -237,6 +241,9 @@ test.describe("pro user", () => {
|
||||
await pro.apiLogin();
|
||||
|
||||
await page.goto("/bookings/upcoming");
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
// Click the cancel option in the dropdown
|
||||
await page.locator('[data-testid="cancel"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
return url.pathname.startsWith("/booking/");
|
||||
|
||||
@@ -363,7 +363,10 @@ test.describe("Bookings", () => {
|
||||
.locator(`[data-testid="select-filter-options-userId"] [role="option"]:has-text("${thirdUser.name}")`)
|
||||
.click();
|
||||
await bookingsGetResponse2;
|
||||
await expect(page.locator('text="Cancel event"').nth(0)).toBeVisible();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
// Check that the cancel option is visible in the dropdown
|
||||
await expect(page.locator('[data-testid="cancel"]')).toBeVisible();
|
||||
|
||||
//expect only 3 bookings (out of 4 total) to be shown in list.
|
||||
//where ThirdUser is either organizer or attendee
|
||||
|
||||
@@ -36,7 +36,9 @@ test("dynamic booking", async ({ page, users }) => {
|
||||
await test.step("can reschedule a booking", async () => {
|
||||
// Logged in
|
||||
await page.goto("/bookings/upcoming");
|
||||
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
// Click the reschedule option in the dropdown
|
||||
await page.locator('[data-testid="reschedule"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
const bookingId = url.searchParams.get("rescheduleUid");
|
||||
@@ -54,6 +56,9 @@ test("dynamic booking", async ({ page, users }) => {
|
||||
|
||||
await test.step("Can cancel the recently created booking", async () => {
|
||||
await page.goto("/bookings/upcoming");
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
// Click the cancel option in the dropdown
|
||||
await page.locator('[data-testid="cancel"]').click();
|
||||
await page.waitForURL((url) => {
|
||||
return url.pathname.startsWith("/booking");
|
||||
|
||||
@@ -33,7 +33,8 @@ test.describe("Reschedule Tests", async () => {
|
||||
await user.apiLogin();
|
||||
await page.goto("/bookings/upcoming");
|
||||
|
||||
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
|
||||
await page.locator('[data-testid="reschedule_request"]').click();
|
||||
|
||||
@@ -75,7 +76,8 @@ test.describe("Reschedule Tests", async () => {
|
||||
await user.apiLogin();
|
||||
await page.goto("/bookings/past");
|
||||
|
||||
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
|
||||
await expect(page.locator('[data-testid="reschedule"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="reschedule_request"]')).toBeVisible();
|
||||
@@ -91,10 +93,14 @@ test.describe("Reschedule Tests", async () => {
|
||||
|
||||
await page.reload();
|
||||
|
||||
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
||||
// Click the ellipsis menu button to open the dropdown
|
||||
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
|
||||
|
||||
await expect(page.locator('[data-testid="reschedule"]')).toBeHidden();
|
||||
await expect(page.locator('[data-testid="reschedule_request"]')).toBeHidden();
|
||||
// Check that the reschedule options are visible but disabled
|
||||
await expect(page.locator('[data-testid="reschedule"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="reschedule_request"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="reschedule"]')).toBeDisabled();
|
||||
await expect(page.locator('[data-testid="reschedule_request"]')).toBeDisabled();
|
||||
});
|
||||
|
||||
test("Should display former time when rescheduling availability", async ({ page, users, bookings }) => {
|
||||
|
||||
Reference in new issue
Block a user