Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

8.8 KB
Raw Blame

Spreadsheet browser fixture

This isolated entry mounts the real SpreadsheetEditor with its local Loro source, IronCalc calculation worker, Excel import/export worker, and shared Macro styles and controls. It does not load authentication, hosted document APIs, or product routes. Reloading resets the workbook. This verifies the editor and worker integration, not network collaboration or persistence.

From apps/web, start the fixture on loopback port 3017:

bunx vite --config src/features/block-spreadsheet/browser-test/vite.config.ts

Open http://127.0.0.1:3017/. The seeded B4 should calculate to 30. Use ?readonly for a viewer and ?load=1500 to hold the workbook back for 1.5 seconds and show the loading skeleton. Test-only window.spreadsheetFixture.snapshot() returns the current workbook and setReadonly(boolean) simulates permission changes without replacing the editor. The fixture applies the app's coarse-pointer touch attribute and keyboard viewport handler, including the --dvh height used by the app shell.

Run the browser regressions (the configuration starts or reuses the fixture):

bunx playwright test --config src/features/block-spreadsheet/browser-test/playwright.config.ts

The tests exercise pointer formula references, autocomplete, menu/dialog focus, sheet creation and rename, cross-sheet calculation, permission changes, and XLSX import/export through native browser file APIs. They also verify atomic import undo/redo, restoring a distant selection across tabs, and formatting without a calculation-status flash or grid remount. Further regressions cover immediate typing after the workbook loads (without taking focus from a control reached while loading) and after adding or duplicating sheets, returning focus from toolbar fields, range formatting/sorting, and footer controls down to a 360-pixel panel. Dropdowns added, used and removed from the toolbar and cell menus (with choice colors drawn as chips in cells and in the open list), open lists kept clear of their cell (above it near the bottom edge) and moved to another dropdown cell with one click, checkboxes inserted, toggled by click and Space, counted by formulas, removed with Delete and the cell menu, and downloaded in Excel's checkbox format, date calendars on typed, imported and date-validated cells (keys, clicks and the stored form of the picked day), Dropdowns added, used and removed from the toolbar and cell menus, a block converted to a table at once (filtered by values and by condition, sorted, totaled in its footer, typed with a mismatch flag, grown by typing, its header and name renamed with their formulas, formula completion, recolored, grouped, converted back to a range that keeps its look, and deleted), imported conditional formatting, validation lists and notes, imported charts and images (drawn over their cells, following edits, deleted and restored with undo, and kept in the download), radar, bubble, stock and contour charts (imported, redrawn after edits, inserted from More charts and downloaded), 100% stacked columns from the insert menu and combo charts chosen in Edit chart, Excel 2016 histogram, pareto, waterfall, funnel, box and whisker, treemap and sunburst charts and pie of pie and bar of pie (imported from chartEx parts, redrawn after edits, inserted, retyped and downloaded as chartEx), shapes, text boxes, groups, SmartArt and an EMF logo (drawn, a linked text box following its cell, moved and downloaded), GETPIVOTDATA formulas of an imported pivot table (calculated, following an edit to the table and downloaded), pivot tables over another workbook (downloaded with their records, link and pivot charts), and creating, editing, moving and sizing charts and images with the pointer and the keyboard have their own suites. The imported workbook was created independently with openpyxl; the exported file is reopened using ExcelJS to check formula caches and workbook structure. Failure traces and screenshots stay in this directory's ignored test-results/ folder.

Install the Playwright Chromium runtime if needed (bunx playwright install chromium) or set PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH to an existing Chromium binary. The fixture and its configuration are separate from the production app entry points.

To verify bundled workers as well, build the fixture with its Vite config and serve that output with Vite preview. Set SPREADSHEET_BROWSER_BASE_URL to the preview URL when running Playwright; the suite then uses that server without starting the development fixture.

Run the separate phone regressions without repeating desktop tests:

bunx playwright test --config src/features/block-spreadsheet/browser-test/playwright.mobile.config.ts

The android-chrome (Pixel 7) and iphone-webkit (iPhone 13) projects exercise touch taps, edit/apply/cancel, formula suggestions, selection/reference handles (including a selection handle held past the bottom edge to scroll), formatting menus, sheet creation/rename, find, viewer permissions, the narrow footer, and tapping between dropdown cells while a list is open. Landscape and reduced viewport checks cover layout with less vertical space. Chromium swipes and handle drags use CDP's trusted touch input, including native scrolling and pointer cancellation; ribbon swipes must not format cells. WebKit exposes touch taps but no trusted touch-drag API, so its handle tests use a mouse pointer after touch selection. They do not verify native iOS drag gestures. Reduced viewports do not simulate the operating system's keyboard; verify keyboard resizing, keyboard retention during suggestion/reference picking, and pinch/scroll behavior in iOS Simulator and on physical devices.

Manual verification in iOS 26.5 Safari on an iPhone 17 Pro simulator covered the real software keyboard, the footer staying above it, touch autocomplete, and tapping a formula reference while keeping the input focused. Native handle drags extended a selection from A2 to B4 and a formula reference from B2 to B3; applying =SUM(B2:B3) returned 30. Native vertical swipes scrolled without changing the selection. Physical-device testing, including iPhone compatibility mouse events, is still separate from these simulator checks.

Install matching browser runtimes with bunx playwright install chromium webkit. Existing compatible runtimes can be selected with PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH and PLAYWRIGHT_WEBKIT_EXECUTABLE_PATH. SPREADSHEET_BROWSER_BASE_URL also works for the mobile configuration and allows both suites to use the same bundled fixture server.

Live collaboration regression

collaboration.browser.e2e.ts boots the compiled Rust sync Worker in an isolated Miniflare instance and connects three independent browser contexts through the production sync socket, source, spreadsheet session, and editor. Build services/sync-service/build/worker/shim.mjs before running it. It uses only local test JWTs and temporary storage; no hosted accounts or documents are touched. The test verifies edit delivery, named/color-separated range overlays and their geometry, idle presence beyond the ten-second TTL, sheet-local cursors, reconnect recovery and departing-user cleanup. It saves a visual capture to /tmp/spreadsheet-live-collaboration.png. This does not verify hosted authentication or permission-token refresh. The ordinary fixture remains local-only unless the explicit test document/socket query parameters are supplied.

Editor interaction regressions

spreadsheet.browser.e2e.ts also enters @ dates (a menu pick, and the @date calendar by keyboard, pointer and Escape) as date values that =A6+30, DATEDIF and the Excel download read as dates; the phone suite taps an @date day.

range-move.browser.e2e.ts drags a selection by its border: the destination outline and label, formulas following the moved cells, a single undo, the confirmation before replacing values, auto-scroll past the grid's bottom edge, clicks, double-clicks and the cell menu on the border, and Escape cancelling a drag.

editor-interactions.browser.e2e.ts mounts the real global hotkey listener to verify that selected-cell typing and arrows beat app navigation shortcuts. It also exercises multi-header drag/Shift selection, drags that scroll the grid past its bottom and right edges and back over the sticky headers to reach off-screen cells (including a fill-handle drag down to the last row), persistent row resizing and auto-fit, cross-sheet formula reference picking (including after comparison operators, from a row past the other sheet's end), and numeric/month-end date fill with undo. formatting.browser.e2e.ts checks mixed whole-column formatting, style persistence, viewport stability, a styled cell's pixels staying the same when selected, in a range and edited, percentage entry through both editors against the real calculation worker, the accounting layout, and indented line items measured from their aligned edge.