|
|
@@ -147,8 +147,22 @@ describe('web e2e: queue row actions', () => {
|
|
|
).toBe(2)
|
|
|
|
|
|
await page.setViewportSize({ width: 640, height: 1000 })
|
|
|
- const queueBox = await page.locator('[data-queue-dock]').boundingBox()
|
|
|
- const composerBox = await page.locator('[data-composer-card]').boundingBox()
|
|
|
+ // Compare one layout: viewport changes can move the grid between browser round trips.
|
|
|
+ const { queueBox, composerBox, dockInset } = await page.evaluate(() => {
|
|
|
+ const queue = document.querySelector('[data-queue-dock]')
|
|
|
+ const composer = document.querySelector('[data-composer-card]')
|
|
|
+ const box = (element: Element | null) => {
|
|
|
+ const rect = element?.getBoundingClientRect()
|
|
|
+ return rect === undefined ? null : { x: rect.x, width: rect.width }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ queueBox: box(queue),
|
|
|
+ composerBox: box(composer),
|
|
|
+ dockInset: composer === null ? null : Number.parseFloat(
|
|
|
+ getComputedStyle(composer).getPropertyValue('--dsh-composer-dock-inset'),
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ })
|
|
|
expect(queueBox).not.toBeNull()
|
|
|
expect(composerBox).not.toBeNull()
|
|
|
expect(queueBox!.x).toBeGreaterThanOrEqual(composerBox!.x)
|
|
|
@@ -156,14 +170,9 @@ describe('web e2e: queue row actions', () => {
|
|
|
.toBeLessThanOrEqual(composerBox!.x + composerBox!.width)
|
|
|
const queueLeftInset = queueBox!.x - composerBox!.x
|
|
|
const queueRightInset = composerBox!.x + composerBox!.width - queueBox!.x - queueBox!.width
|
|
|
- const composerMetrics = await page.locator('[data-composer-card]').evaluate((element) => {
|
|
|
- const style = getComputedStyle(element)
|
|
|
- return {
|
|
|
- dockInset: Number.parseFloat(style.getPropertyValue('--dsh-composer-dock-inset')),
|
|
|
- }
|
|
|
- })
|
|
|
- expect(queueLeftInset).toBeCloseTo(composerMetrics.dockInset, 1)
|
|
|
- expect(queueRightInset).toBeCloseTo(composerMetrics.dockInset, 1)
|
|
|
+ expect(dockInset).not.toBeNull()
|
|
|
+ expect(queueLeftInset).toBeCloseTo(dockInset!, 1)
|
|
|
+ expect(queueRightInset).toBeCloseTo(dockInset!, 1)
|
|
|
await page.setViewportSize({ width: 1680, height: 1000 })
|
|
|
|
|
|
const editRow = page.locator('[data-queue-dock] li', { hasText: EDIT })
|