Skip to content

Commit 56ae7e2

Browse files
committed
test(org): compare rail styles with the mouse parked in both captures
The carried capture read Files with the pointer resting on it from the click that navigated there, so its hover background looked like a leak. Both captures now park the pointer and wait out the transition, the carried one asserts nothing in the rail is hovered, and background stays compared.
1 parent ecfa0f4 commit 56ae7e2

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

‎apps/sim/scripts/org-redesign-e2e/checks/blast-radius.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import {
1717
url,
1818
withSession,
1919
} from '@/scripts/org-redesign-e2e/harness'
20-
import { composer, navigateWithinDocument, railLink } from '@/scripts/org-redesign-e2e/locators'
20+
import {
21+
composer,
22+
navigateWithinDocument,
23+
parkMouse,
24+
railLink,
25+
} from '@/scripts/org-redesign-e2e/locators'
2126

2227
export async function blastRadiusChecks() {
2328
section('Blast radius')
@@ -103,6 +108,7 @@ export async function blastRadiusChecks() {
103108
session.page.getByRole('complementary', { name: 'Workspace sidebar' })
104109
).toBeVisible()
105110
await session.settle()
111+
await parkMouse(session.page)
106112
fresh = await sample(session.page)
107113
},
108114
{ theme }
@@ -125,6 +131,11 @@ export async function blastRadiusChecks() {
125131
assert(await inDocument(), 'The move to /workspace reloaded the page')
126132
await session.settle()
127133
await expect(page.locator('[data-platform-ui]')).toHaveCount(0)
134+
// The click that got here leaves the pointer over a rail row, which would read as hover.
135+
await parkMouse(page)
136+
await expect(
137+
page.getByRole('complementary', { name: 'Workspace sidebar' }).locator(':hover')
138+
).toHaveCount(0)
128139
const carried = await sample(page)
129140
const differences = Object.keys(fresh)
130141
.filter((key) => key in carried && carried[key] !== fresh[key])

‎apps/sim/scripts/org-redesign-e2e/locators.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@ export async function navigateWithinDocument(page: Page, navigate: () => Promise
8787
return () => page.evaluate(() => window.sameDocumentMark)
8888
}
8989

90+
/**
91+
* Rests the pointer on the page's far corner and lets any hover transition it ended finish, so two
92+
* captures of computed styles compare the same pointer state.
93+
*/
94+
export async function parkMouse(page: Page) {
95+
const size = page.viewportSize()
96+
assert(size, 'The page has a viewport')
97+
await page.mouse.move(size.width - 1, size.height - 1)
98+
await pageTurn(page)
99+
await page.evaluate(() =>
100+
Promise.all(
101+
document
102+
.getAnimations()
103+
.filter((animation) => animation instanceof CSSTransition)
104+
.map((animation) => animation.finished.catch(() => {}))
105+
)
106+
)
107+
}
108+
90109
export async function assertNoHorizontalOverflow(page: Page, label: string) {
91110
const { scrollWidth, width } = await page.evaluate(() => ({
92111
scrollWidth: document.documentElement.scrollWidth,

0 commit comments

Comments
 (0)