Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: alannnc <[email protected]> Co-authored-by: zomars <[email protected]>
This commit is contained in:
3 files changed
+71
-4
No files matched your search
@@ -26,11 +26,11 @@ import {
|
||||
DialogFooter,
|
||||
MeetingTimeInTimezones,
|
||||
showToast,
|
||||
Tooltip,
|
||||
TableActions,
|
||||
TextAreaField,
|
||||
Tooltip,
|
||||
} from "@calcom/ui";
|
||||
import { Check, Clock, MapPin, RefreshCcw, Send, Ban, X, CreditCard } from "@calcom/ui/components/icon";
|
||||
import { Ban, Check, Clock, CreditCard, MapPin, RefreshCcw, Send, X } from "@calcom/ui/components/icon";
|
||||
|
||||
import useMeQuery from "@lib/hooks/useMeQuery";
|
||||
|
||||
@@ -74,8 +74,10 @@ function BookingListItem(booking: BookingItemProps) {
|
||||
}
|
||||
utils.viewer.bookings.invalidate();
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("booking_confirmation_failed"), "error");
|
||||
onError: (e) => {
|
||||
let message = t("booking_confirmation_failed");
|
||||
if ("message" in e) message = e.message;
|
||||
showToast(message, "error");
|
||||
utils.viewer.bookings.invalidate();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -137,6 +137,8 @@ test.describe("pro user", () => {
|
||||
page.click('[data-testid="confirm"]'),
|
||||
page.waitForResponse((response) => response.url().includes("/api/trpc/bookings/confirm")),
|
||||
]);
|
||||
|
||||
await page.goto("/bookings/unconfirmed");
|
||||
// This is the only booking in there that needed confirmation and now it should be empty screen
|
||||
await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
|
||||
});
|
||||
@@ -227,6 +229,45 @@ test.describe("pro user", () => {
|
||||
const firstSlotAvailableText = await firstSlotAvailable.innerText();
|
||||
expect(firstSlotAvailableText).toContain("9:00");
|
||||
});
|
||||
|
||||
test("Cannot confirm booking for a slot, if another confirmed booking already exists for same slot.", async ({
|
||||
page,
|
||||
users,
|
||||
}) => {
|
||||
// First booking done for first available time slot in next month
|
||||
await bookOptinEvent(page);
|
||||
|
||||
const [pro] = users.get();
|
||||
await page.goto(`/${pro.username}`);
|
||||
|
||||
// Second booking done for same time slot
|
||||
await bookOptinEvent(page);
|
||||
|
||||
await pro.apiLogin();
|
||||
|
||||
await page.goto("/bookings/unconfirmed");
|
||||
|
||||
// Confirm first booking
|
||||
await Promise.all([
|
||||
page.click('[data-testid="confirm"]'),
|
||||
page.waitForResponse((response) => response.url().includes("/api/trpc/bookings/confirm")),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
page.goto("/bookings/unconfirmed"),
|
||||
page.waitForResponse((response) => response.url().includes("/api/trpc/bookings/get")),
|
||||
]);
|
||||
|
||||
// Confirm second booking
|
||||
await page.click('[data-testid="confirm"]');
|
||||
const response = await page.waitForResponse(
|
||||
(response) => response.url().includes("/api/trpc/bookings/confirm") && response.status() !== 200
|
||||
);
|
||||
const responseObj = await response.json();
|
||||
|
||||
expect(responseObj[0]?.error?.json?.data?.code).toEqual("BAD_REQUEST");
|
||||
expect(responseObj[0]?.error?.json?.message).toEqual("Slot already confirmed for other booking");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("prefill", () => {
|
||||
|
||||
Reference in new issue
Block a user