Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
test(calendar): restore the event details browser suite and run it in CI (#9473)
gbirmande907f2948fa
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.ymlindex 23961a8cb6..4ba9f3529f 100644--- a/.github/workflows/web-app-check-main.yml+++ b/.github/workflows/web-app-check-main.yml@@ -18,6 +18,7 @@ jobs:codegen_changed: ${{ steps.filter.outputs.codegen_changed }}i18n_changed: ${{ steps.filter.outputs.i18n_changed }}database_grid_changed: ${{ steps.filter.outputs.database_grid_changed }}+ calendar_details_changed: ${{ steps.filter.outputs.calendar_details_changed }}steps:- name: Checkout Repouses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10@@ -71,6 +72,10 @@ jobs:- 'apps/web/src/features/settings/**'database_grid_changed:- 'apps/web/src/features/database/**'+ calendar_details_changed:+ - 'apps/web/src/features/calendar-view/**'+ - 'apps/web/src/features/calendar/**'+ - 'apps/web/src/lib/queries/calendar/**'android-native-check:name: Android Native Checkruns-on: namespace-profile-linux-tiny-no-cache@@ -428,6 +433,12 @@ jobs:bunx playwright install-deps chromiumjust test-database-browserworking-directory: apps/web+ - name: Calendar Event Details Browser Tests+ if: needs.path-check.outputs.calendar_details_changed == 'true'+ run: |-+ bunx playwright install-deps chromium+ just test-calendar-details-browser+ working-directory: apps/web- name: Teardown Nixif: always()uses: './.github/actions/teardown-nix'diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 965e0f503a..4f897cddca 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -127,8 +127,11 @@ Event details placement has a backend-free browser regression: the desktoppopover stays beside its event when join requests arrive after it opens, andslides into a short window; the phone drawer shows late requests. The samesuite covers the Add guests and Forward invitation editors (the real-`EventGuests` over a stand-in contact picker) on desktop and phone:-`bunx playwright test --config src/features/calendar-view/browser-test/playwright.config.ts`.+`EventGuests` over a stand-in contact picker) on desktop and phone, and long+guest addresses wrapping in both: `just test-calendar-details-browser`. CI runs+it when calendar details or `src/lib/queries/calendar` change. Its fixture+aliases those query modules to `preview-adapters.tsx`, so a module export or+callback argument the adapters lack leaves every page blank; mirror it there.Keep the popover's `flip` limited to `left-start`: an end fallback re-places itabove the event whenever a late section changes its height. Keep the guesteditors' `overlap`: without it their height follows the room below the button,diff --git a/apps/web/justfile b/apps/web/justfileindex fc3ff11d7e..2306ffc50c 100644--- a/apps/web/justfile+++ b/apps/web/justfile@@ -225,6 +225,12 @@ test-i18n-browser *ARGS:test-database-browser *ARGS:env -u LD_LIBRARY_PATH bunx playwright test --config src/features/database/browser-test/playwright.config.ts {{ARGS}}+# Event details placement and guest editors on desktop and phone, in Chromium+# over preview adapters. Same LD_LIBRARY_PATH caveat as the sign-up browser+# tests above.+test-calendar-details-browser *ARGS:+ env -u LD_LIBRARY_PATH bunx playwright test --config src/features/calendar-view/browser-test/playwright.config.ts {{ARGS}}+# Optimistic mutations through the real worker/WASM cache in Chromium. Same# LD_LIBRARY_PATH caveat as the sign-up browser tests above.test-functional *ARGS:diff --git a/apps/web/src/features/calendar-view/browser-test/event-details.browser.e2e.ts b/apps/web/src/features/calendar-view/browser-test/event-details.browser.e2e.tsindex c77e63b4f1..92434faab9 100644--- a/apps/web/src/features/calendar-view/browser-test/event-details.browser.e2e.ts+++ b/apps/web/src/features/calendar-view/browser-test/event-details.browser.e2e.ts@@ -1,4 +1,4 @@-import { expect, type Page, test } from '@playwright/test';+import { expect, type Locator, type Page, test } from '@playwright/test';const deliverJoinRequests = (page: Page) =>page.evaluate(() => window.calendarPreview.deliverJoinRequests());@@ -40,7 +40,7 @@ async function openDetails(page: Page, query: string) {return { anchor, details };}-async function box(locator: ReturnType<Page['getByRole']>) {+async function box(locator: Locator) {const rect = await locator.boundingBox();if (!rect) throw new Error('Expected a laid-out element');return { ...rect, bottom: rect.y + rect.height };@@ -270,3 +270,58 @@ test('the phone drawer shows join requests that arrive after it opens', async ({);await expect(requests).toHaveCount(0);});++// The fixture's `?addresses=long` guests: one with a name, one known only by+// address. Neither address has a space to break at.+const NAMED_GUEST = {+ name: 'Rowan Field',+ address:+ 'quarterly.planning.review.coordinator.northeast@facilities-and-operations.example.com',+};+const ADDRESS_ONLY_GUEST =+ 'shared.conference.room.booking.notifications@resource-scheduling.example.com';++/** The address text, not just its row, wraps inside the details. */+async function expectAddressWraps(details: Locator, address: string) {+ const text = details.getByText(address, { exact: true });+ await expect(text).toHaveCount(1);+ await text.scrollIntoViewIfNeeded();+ const inside = await box(details);+ const line = await box(text);+ expect(line.x).toBeGreaterThanOrEqual(inside.x);+ expect(line.x + line.width).toBeLessThanOrEqual(inside.x + inside.width);+ expect(line.y).toBeGreaterThanOrEqual(inside.y);+ expect(line.bottom).toBeLessThanOrEqual(inside.bottom);+ const layout = await text.evaluate((element) => ({+ overflow: element.scrollWidth - element.clientWidth,+ lines:+ element.getBoundingClientRect().height /+ Number.parseFloat(getComputedStyle(element).lineHeight),+ }));+ expect(layout.overflow).toBeLessThanOrEqual(0);+ expect(layout.lines).toBeGreaterThan(1.5);+ return line;+}++test('long guest addresses wrap inside the popover and the phone drawer', async ({+ page,+ isMobile,+}) => {+ let details: Locator;+ if (isMobile) {+ await page.goto('/?addresses=long');+ await page+ .getByRole('button', { name: 'Planning review', exact: true })+ .click();+ details = page.getByRole('dialog', { name: 'Planning review' });+ await expect(details).toBeVisible();+ } else {+ ({ details } = await openDetails(page, 'addresses=long'));+ }++ const name = details.getByText(NAMED_GUEST.name, { exact: true });+ await expect(name).toHaveCount(1);+ const address = await expectAddressWraps(details, NAMED_GUEST.address);+ expect(address.y).toBeGreaterThanOrEqual((await box(name)).bottom - 1);+ await expectAddressWraps(details, ADDRESS_ONLY_GUEST);+});diff --git a/apps/web/src/features/calendar-view/browser-test/fixture.tsx b/apps/web/src/features/calendar-view/browser-test/fixture.tsxindex 44b99687f9..07e997cea9 100644--- a/apps/web/src/features/calendar-view/browser-test/fixture.tsx+++ b/apps/web/src/features/calendar-view/browser-test/fixture.tsx@@ -13,6 +13,21 @@ for (const [token, value] of Object.entries(macroLightTheme.colorTokens)) {document.documentElement.dataset.themeLight = 'true';const params = new URLSearchParams(location.search);+// `?addresses=long` adds a named guest and an address-only guest whose+// addresses have no spaces, so they must break inside their rows.+const longAddressGuests: CalendarEvent['attendees'] =+ params.get('addresses') === 'long'+ ? [+ 'quarterly.planning.review.coordinator.northeast@facilities-and-operations.example.com',+ 'shared.conference.room.booking.notifications@resource-scheduling.example.com',+ ].map((email) => ({+ email,+ isOptional: false,+ isOrganizer: false,+ isSelf: false,+ responseStatus: 'accepted',+ }))+ : [];const calendar = { id: 'calendar-1', name: 'Calendar', color: '#609fe2' };const sampleEvent: CalendarEvent = {id: 'planning-review',@@ -61,6 +76,7 @@ const sampleEvent: CalendarEvent = {isSelf: false,responseStatus: 'needs_action',},+ ...longAddressGuests,],organizerEmail: '[email protected]',sourceCalendarIds: [calendar.id],diff --git a/apps/web/src/features/calendar-view/browser-test/playwright.config.ts b/apps/web/src/features/calendar-view/browser-test/playwright.config.tsindex f51450d0c0..2c74ddabff 100644--- a/apps/web/src/features/calendar-view/browser-test/playwright.config.ts+++ b/apps/web/src/features/calendar-view/browser-test/playwright.config.ts@@ -10,6 +10,8 @@ export default defineConfig({outputDir: `${directory}/test-results`,timeout: 45_000,fullyParallel: true,+ forbidOnly: !!process.env.CI,+ reporter: process.env.CI ? [['list'], ['github']] : 'list',use: {baseURL: `http://127.0.0.1:${port}`,trace: 'retain-on-failure',diff --git a/apps/web/src/features/calendar-view/browser-test/preview-adapters.tsx b/apps/web/src/features/calendar-view/browser-test/preview-adapters.tsxindex 518e47d5cb..e3a3548425 100644--- a/apps/web/src/features/calendar-view/browser-test/preview-adapters.tsx+++ b/apps/web/src/features/calendar-view/browser-test/preview-adapters.tsx@@ -88,22 +88,28 @@ export function useCalendarJoinRequestsQuery(},};}+const ANSWER_STATUS = { accept: 'accepted', decline: 'declined' } as const;+type JoinRequestAnswer = {+ request: CalendarJoinRequest;+ decision: keyof typeof ANSWER_STATUS;+};+export const isAlreadyAnswered = (+ answered: CalendarJoinRequest,+ decision: JoinRequestAnswer['decision']+) => answered.status !== ANSWER_STATUS[decision];export function useRespondToCalendarJoinRequestMutation(callbacks?: {- onSuccess?: (answered: CalendarJoinRequest) => void;+ onSuccess?: (answered: CalendarJoinRequest, args: JoinRequestAnswer) => void;}) {return {isPending: false,- mutate: (args: {- request: CalendarJoinRequest;- decision: 'accept' | 'decline';- }) => {+ mutate: (args: JoinRequestAnswer) => {setJoinRequests((current) =>current?.filter((request) => request.id !== args.request.id));- callbacks?.onSuccess?.({- ...args.request,- status: args.decision === 'accept' ? 'accepted' : 'declined',- });+ callbacks?.onSuccess?.(+ { ...args.request, status: ANSWER_STATUS[args.decision] },+ args+ );},};}@@ -160,7 +166,7 @@ export const copyCalendarEventMention = () =>export const downloadCalendarEventIcs = () =>announce('Download event · Preview only');export const openDocument = () => announce('Open document · Preview only');-export const toast = { success: announce, failure: announce };+export const toast = { success: announce, alert: announce, failure: announce };export const createCalendarRsvpController = () => ({pending: () => false,@@ -177,6 +183,8 @@ const names: Record<string, string> = {'macro|[email protected]': 'Morgan Member','[email protected]': 'Alex Morgan','[email protected]': 'Sam Lee',+ 'quarterly.planning.review.coordinator.northeast@facilities-and-operations.example.com':+ 'Rowan Field','[email protected]': 'You',};export const useContacts = () => contacts;diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.mdindex b375ceaf00..a41d7c4fe5 100644--- a/docs/agent-guide/calendar.md+++ b/docs/agent-guide/calendar.md@@ -500,7 +500,11 @@ window. The picker, the people chosen and the send button stay visible at everyevent position and window height. The same regression covers both editors in atall and a short window (`?guests=add` or `?guests=forward`, with`?contacts=late` delivering the picker's contacts on-`window.calendarPreview.deliverContacts()`) and their phone sheets.+`window.calendarPreview.deliverContacts()`) and their phone sheets. With `?addresses=long` it+checks that a named guest's address and an address-only guest's address, neither with a space,+wrap inside the popover and the phone drawer. CI runs it (`just test-calendar-details-browser`+in `apps/web`) when calendar details or the calendar queries change; its `preview-adapters.tsx`+stands in for those queries, so give it every export and callback argument the components use.The `New event` composer (also opened by dragging a range on the grid) has an `Event kind`pill choosing between `Event` and `Out of office`. Picking `Out of office` hides the guests,@@ -549,7 +553,8 @@ Each guest in event details (desktop popover and phone drawer) shows their nameaddress on a muted line under it, as the user card shows a person, followed by `Organizer` or`Optional` and any comment; the viewer's own row (`(you)`) does too, which tells their inboxesapart. A guest Macro has no name for (no Macro profile or email contact) shows the address-once, as the name. The address wraps instead of truncating in a narrow popover or on a phone.+once, as the name. The address wraps instead of truncating in a narrow popover or on a phone+(the event details browser regression's `?addresses=long`).The `Organizer` row under the calendar row, shown when someone other than the calendarorganizes the event, adds the organizer's address the same way. Teammates' read-only eventdetails (`Shared in Macro · Read only`) list guests by provider name, or by address when therediff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rsindex 34d969abce..12fe04799e 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs@@ -79,6 +79,10 @@ fn path_check() -> Job {"database_grid_changed","${{ steps.filter.outputs.database_grid_changed }}",)+ .add_output(+ "calendar_details_changed",+ "${{ steps.filter.outputs.calendar_details_changed }}",+ ).add_step(checkout("Checkout Repo", false)).add_step(paths_filter())}@@ -201,6 +205,7 @@ fn test() -> Job {.add_step(run_signup_browser_tests()).add_step(run_i18n_browser_tests()).add_step(run_database_browser_tests())+ .add_step(run_calendar_details_browser_tests()).add_step(steps::teardown_nix())}@@ -288,7 +293,9 @@ fn paths_filter() -> Step<Use> {// generated workflows`. `i18n_changed` covers what the interface language// browser tests render: translations, the menu primitives, and settings// navigation. `database_grid_changed` covers the database grid's browser- // tests.+ // tests. `calendar_details_changed` covers what the event details browser+ // tests render and the query modules their fixture replaces, whose exports+ // the fixture must keep matching.Step::new("Filter changed paths").uses("dorny",@@ -299,7 +306,7 @@ fn paths_filter() -> Step<Use> {.add_with(("filters",format!(- "should_run:\n{artifact_paths} - 'services/lexical-service/**'\n - 'packages/sdk/**'\n - 'packages/sdk-docs/**'\n - 'services/ai-editing-worker/**'\n - 'packages/code-mode-sdk/**'\n - 'crates/code_execution/src/outbound/deno/*.mjs'\n - 'crates/agent_code_mode/src/domain/documentation.json'\n - 'crates/agent_code_mode/SKILL.md'\n - '.github/actions/setup-reqs-web/**'\ncodegen_changed:\n - 'crates/**/*.rs'\n - 'services/**/*.rs'\n - 'Cargo.toml'\n - 'Cargo.lock'\n - 'apps/web/scripts/generate-api-schema.ts'\n - 'apps/web/scripts/services.ts'\n - 'packages/sdk/**'\n - 'apps/docs/**'\n - '.github/actions/setup-reqs-web/**'\ni18n_changed:\n - 'apps/web/src/lib/i18n/**'\n - 'apps/web/src/lib/core/component/ContextMenu.tsx'\n - 'apps/web/src/lib/core/constant/settingsTabsConfig.tsx'\n - 'apps/web/src/components/ui/components/Dropdown.tsx'\n - 'apps/web/src/features/settings/**'\ndatabase_grid_changed:\n - 'apps/web/src/features/database/**'\n"+ "should_run:\n{artifact_paths} - 'services/lexical-service/**'\n - 'packages/sdk/**'\n - 'packages/sdk-docs/**'\n - 'services/ai-editing-worker/**'\n - 'packages/code-mode-sdk/**'\n - 'crates/code_execution/src/outbound/deno/*.mjs'\n - 'crates/agent_code_mode/src/domain/documentation.json'\n - 'crates/agent_code_mode/SKILL.md'\n - '.github/actions/setup-reqs-web/**'\ncodegen_changed:\n - 'crates/**/*.rs'\n - 'services/**/*.rs'\n - 'Cargo.toml'\n - 'Cargo.lock'\n - 'apps/web/scripts/generate-api-schema.ts'\n - 'apps/web/scripts/services.ts'\n - 'packages/sdk/**'\n - 'apps/docs/**'\n - '.github/actions/setup-reqs-web/**'\ni18n_changed:\n - 'apps/web/src/lib/i18n/**'\n - 'apps/web/src/lib/core/component/ContextMenu.tsx'\n - 'apps/web/src/lib/core/constant/settingsTabsConfig.tsx'\n - 'apps/web/src/components/ui/components/Dropdown.tsx'\n - 'apps/web/src/features/settings/**'\ndatabase_grid_changed:\n - 'apps/web/src/features/database/**'\ncalendar_details_changed:\n - 'apps/web/src/features/calendar-view/**'\n - 'apps/web/src/features/calendar/**'\n - 'apps/web/src/lib/queries/calendar/**'\n"),))}@@ -489,6 +496,18 @@ fn run_database_browser_tests() -> Step<Run> {.working_directory(xtask_paths::repo_dir!("apps/web"))}+/// Event details placement and guest editors in desktop and phone Chromium,+/// over preview adapters instead of a backend. Only when calendar details or+/// the calendar queries the adapters stand in for change.+fn run_calendar_details_browser_tests() -> Step<Run> {+ Step::new("Calendar Event Details Browser Tests")+ .run("bunx playwright install-deps chromium\njust test-calendar-details-browser")+ .if_condition(Expression::new(+ "needs.path-check.outputs.calendar_details_changed == 'true'",+ ))+ .working_directory(xtask_paths::repo_dir!("apps/web"))+}+fn cycles_import_check() -> Step<Run> {Step::new("Cycles Import Check").run("biome lint --changed --no-errors-on-unmatched --only=suspicious/noImportCycles")diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rsindex 358faa2553..933e66965f 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs@@ -382,6 +382,43 @@ fn test_job_runs_signup_browser_tests_after_vitest() {);}+/// The event details fixture replaces the calendar query modules with preview+/// adapters, so a change to those modules runs the suite that would show a+/// blank page when an adapter export goes missing.+#[test]+fn calendar_details_browser_tests_run_when_the_replaced_queries_change() {+ let yaml = web_app_check_main().to_string().expect("workflow yaml");+ let filters = yaml+ .split("filters: |")+ .nth(1)+ .and_then(|rest| rest.split("id: filter").next())+ .expect("path-check filters");+ let calendar = filters+ .split("calendar_details_changed:")+ .nth(1)+ .expect("calendar_details_changed filter");+ for path in [+ "apps/web/src/features/calendar-view/**",+ "apps/web/src/lib/queries/calendar/**",+ ] {+ assert!(calendar.contains(path), "{path} runs the suite: {calendar}");+ }+ let start = yaml.find("name: Test\n").expect("Test job");+ let end = yaml[start..]+ .find("name: Cycles Import Check")+ .map_or(yaml.len(), |offset| start + offset);+ let step = yaml[start..end]+ .split("- name: Calendar Event Details Browser Tests")+ .nth(1)+ .and_then(|rest| rest.split("- name:").next())+ .expect("calendar details browser step");+ assert!(+ step.contains("needs.path-check.outputs.calendar_details_changed == 'true'")+ && step.contains("just test-calendar-details-browser"),+ "the step runs the suite when calendar details change: {step}"+ );+}+#[test]fn test_job_keeps_vitest_module_cache_on_the_cache_volume() {let yaml = web_app_check_main().to_string().expect("workflow yaml");