-
Notifications
You must be signed in to change notification settings - Fork 9.3k
feat: Multiple Round Robin Host Selection #20796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e1b65f7
70d82a3
117d7c2
d66d1ef
efbb6a7
84b0566
4455501
84360c5
91baf7b
03c0447
943bf26
1614fe4
3bb1f55
3a80408
8c02a6b
083462f
257fcbc
30132b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { expect } from "@playwright/test"; | ||
|
||
import { test } from "./lib/fixtures"; | ||
import { selectFirstAvailableTimeSlotNextMonth, bookTimeSlot } from "./lib/testUtils"; | ||
import { submitAndWaitForResponse } from "./lib/testUtils"; | ||
|
||
test.describe.configure({ mode: "parallel" }); | ||
|
||
test.describe("Team Availability", () => { | ||
test.beforeEach(async ({ users }) => { | ||
const teamMatesObj = [ | ||
{ name: "teammate-1" }, | ||
{ name: "teammate-2" }, | ||
{ name: "teammate-3" }, | ||
{ name: "teammate-4" }, | ||
]; | ||
|
||
const owner = await users.create( | ||
{ username: "pro-user", name: "pro-user" }, | ||
{ | ||
hasTeam: true, | ||
teammates: teamMatesObj, | ||
} | ||
); | ||
|
||
await owner.apiLogin(); | ||
}); | ||
|
||
test.afterEach(async ({ users }) => { | ||
await users.deleteAll(); | ||
}); | ||
|
||
test("success booking with multiple hosts", async ({ page, users }) => { | ||
await page.goto("/event-types"); | ||
await expect(page).toHaveURL(/.*\/event-types/); | ||
|
||
// creating new team round robin event | ||
await page.getByTestId("new-event-type").click(); | ||
await page.getByTestId("option-team-1").click(); | ||
await page.getByTestId("event-type-quick-chat").fill("test-rr-event"); | ||
await page.getByLabel("Round RobinCycle meetings").click(); | ||
await page.getByRole("button", { name: "Continue" }).click(); | ||
await page.getByTestId("round-robin-multiple-hosts-toggle").click(); | ||
|
||
// setting multiple hosts count | ||
await page.getByTestId("round-robin-multiple-hosts-count-input").fill("3"); | ||
|
||
// assigning all team members | ||
await page.getByTestId("assign-all-team-members-toggle").click(); | ||
|
||
// updating event type | ||
await submitAndWaitForResponse(page, "/api/trpc/eventTypes/update?batch=1", { | ||
action: () => page.locator("[data-testid=update-eventtype]").click(), | ||
}); | ||
const page2Promise = page.waitForEvent("popup"); | ||
|
||
// booking event | ||
await page.getByTestId("preview-button").click(); | ||
const page2 = await page2Promise; | ||
|
||
await selectFirstAvailableTimeSlotNextMonth(page2); | ||
await bookTimeSlot(page2); | ||
|
||
// booking success as multiple hosts count(3) is less than available hosts(4) | ||
await expect(page2.getByTestId("success-page")).toBeVisible(); | ||
}); | ||
|
||
test("show alert if multiple hosts count is more than available hosts", async ({ page, users }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rule violated: E2E Tests Best Practices
|
||
await page.goto("/event-types"); | ||
await expect(page).toHaveURL(/.*\/event-types/); | ||
|
||
// creating new team round robin event | ||
await page.getByTestId("new-event-type").click(); | ||
await page.getByTestId("option-team-1").click(); | ||
await page.getByTestId("event-type-quick-chat").fill("test-rr-event"); | ||
await page.getByLabel("Round RobinCycle meetings").click(); | ||
await page.getByRole("button", { name: "Continue" }).click(); | ||
await page.getByTestId("round-robin-multiple-hosts-toggle").click(); | ||
|
||
// setting multiple hosts count | ||
await page.getByTestId("round-robin-multiple-hosts-count-input").fill("10"); | ||
|
||
// assigning all team members | ||
await page.getByTestId("assign-all-team-members-toggle").click(); | ||
|
||
// updating event type | ||
await submitAndWaitForResponse(page, "/api/trpc/eventTypes/update?batch=1", { | ||
action: () => page.locator("[data-testid=update-eventtype]").click(), | ||
}); | ||
const page2Promise = page.waitForEvent("popup"); | ||
|
||
// booking event | ||
await page.getByTestId("preview-button").click(); | ||
const page2 = await page2Promise; | ||
await selectFirstAvailableTimeSlotNextMonth(page2); | ||
|
||
// showing error alert as multiple hosts count(10) is more than available hosts(4) | ||
await bookTimeSlot(page2, { expectedStatusCode: 500 }); | ||
await expect(page2.getByTestId("alert")).toBeVisible(); | ||
await expect(page2.getByTestId("alert")).toContainText("Could not book the meeting."); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,7 @@ export type FormValues = { | |
forwardParamsSuccessRedirect: boolean | null; | ||
secondaryEmailId?: number; | ||
isRRWeightsEnabled: boolean; | ||
roundRobinHostsCount: number; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type should be 'number & { min: 1 }' or similar to indicate that this field only accepts positive integers. Currently, it accepts any number which could lead to bugs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't really require, as we're having that check in other part of code. |
||
maxLeadThreshold?: number; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "EventType" ADD COLUMN "roundRobinHostsCount" INTEGER DEFAULT 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Column should be defined as NOT NULL since it has a default value and validation in code ensures it's always >= 1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a CHECK constraint to enforce roundRobinHostsCount >= 1 at the database level. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
Warnings: | ||
|
||
- Made the column `roundRobinHostsCount` on table `EventType` required. This step will fail if there are existing NULL values in that column. | ||
|
||
*/ | ||
-- AlterTable | ||
ALTER TABLE "EventType" ALTER COLUMN "roundRobinHostsCount" SET NOT NULL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Migration will fail if any NULL values exist in the roundRobinHostsCount column despite the initial default value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule violated: E2E Tests Best Practices