Compare commits

..

2 Commits

Author SHA1 Message Date
jaybe 64790cf991 E2E: Guides ON 상태에서 멀티선택 회전 후 스냅 및 라이브리전 검증 추가
Auto PR / open-pr (push) Successful in 24s
Auto Label PR / add-automerge-label (pull_request) Successful in 7s
CI / test (pull_request) Failing after 1m58s
2025-11-17 21:00:45 +09:00
jaybe adb96080a8 E2E: 멀티선택 회전 후 그룹 리사이즈(N/S) 스냅 유지 검증 추가
Auto PR / open-pr (push) Successful in 21s
Auto Label PR / add-automerge-label (pull_request) Successful in 7s
CI / test (pull_request) Failing after 1m55s
2025-11-17 20:48:24 +09:00
2 changed files with 172 additions and 0 deletions
@@ -0,0 +1,113 @@
import { test, expect } from '@playwright/test'
const wysiwygUrl = '/en/wysiwyg'
async function getBox(page: import('@playwright/test').Page, nth: number) {
const el = page.locator('[data-testid^="obj-text-"]').nth(nth)
const left = await el.evaluate((n) => parseInt((n as HTMLElement).style.left || '0', 10))
const top = await el.evaluate((n) => parseInt((n as HTMLElement).style.top || '0', 10))
const width = await el.evaluate((n) => parseInt((n as HTMLElement).style.width || '0', 10))
const height = await el.evaluate((n) => parseInt((n as HTMLElement).style.height || '0', 10))
return { left, top, width, height }
}
function snap8(v: number) { return Math.round(v / 8) * 8 }
test.describe('WYSIWYG - Group rotate then resize (N/S) with snap', () => {
test('rotate ~15°, then group resize S by +16 (snap) — heights grow equally, top unchanged', async ({ page }) => {
await page.goto(wysiwygUrl)
const canvas = page.getByTestId('wysiwyg-canvas')
await expect(canvas).toBeVisible()
const addText = page.getByRole('button', { name: /^Add Text$/i })
await addText.click()
await addText.click()
// marquee select both
const cbox = await canvas.boundingBox()
if (!cbox) throw new Error('canvas not found')
await page.mouse.move(cbox.x + 40, cbox.y + 40)
await page.mouse.down()
await page.mouse.move(cbox.x + 260, cbox.y + 160)
await page.mouse.up()
// rotate to ~15°
const rotateHandle = page.locator('[data-testid^="rotate-handle-"]').first()
const hbox = await rotateHandle.boundingBox()
if (!hbox) throw new Error('rotate handle not found')
await page.mouse.move(hbox.x + 5, hbox.y + 5)
await page.mouse.down()
await page.mouse.move(hbox.x + 40, hbox.y + 5)
await page.mouse.up()
const b0 = await getBox(page, 0)
const b1 = await getBox(page, 1)
// resize south edge of the second by +16px
const target = page.locator('[data-testid^="obj-text-"]').nth(1)
const tbox = await target.boundingBox()
if (!tbox) throw new Error('target not found')
await page.mouse.move(tbox.x + 5, tbox.y + tbox.height - 3)
await page.mouse.down()
await page.mouse.move(tbox.x + 5, tbox.y + tbox.height + 16)
await page.mouse.up()
const a0 = await getBox(page, 0)
const a1 = await getBox(page, 1)
const dh = snap8(b1.height + 16) - b1.height
expect(a0.top).toBe(b0.top)
expect(a1.top).toBe(b1.top)
expect(a0.height).toBe(b0.height + dh)
expect(a1.height).toBe(b1.height + dh)
})
test('rotate ~15°, then group resize N by +16 (snap) — heights grow equally, top shifts equally', async ({ page }) => {
await page.goto(wysiwygUrl)
const canvas = page.getByTestId('wysiwyg-canvas')
await expect(canvas).toBeVisible()
const addText = page.getByRole('button', { name: /^Add Text$/i })
await addText.click()
await addText.click()
// marquee select both
const cbox = await canvas.boundingBox()
if (!cbox) throw new Error('canvas not found')
await page.mouse.move(cbox.x + 40, cbox.y + 40)
await page.mouse.down()
await page.mouse.move(cbox.x + 260, cbox.y + 160)
await page.mouse.up()
// rotate to ~15°
const rotateHandle = page.locator('[data-testid^="rotate-handle-"]').first()
const hbox = await rotateHandle.boundingBox()
if (!hbox) throw new Error('rotate handle not found')
await page.mouse.move(hbox.x + 5, hbox.y + 5)
await page.mouse.down()
await page.mouse.move(hbox.x + 40, hbox.y + 5)
await page.mouse.up()
const b0 = await getBox(page, 0)
const b1 = await getBox(page, 1)
// resize north edge of the first by -16px (drag up)
const first = page.locator('[data-testid^="obj-text-"]').first()
const fbox = await first.boundingBox()
if (!fbox) throw new Error('first not found')
await page.mouse.move(fbox.x + 5, fbox.y + 3)
await page.mouse.down()
await page.mouse.move(fbox.x + 5, fbox.y - 16)
await page.mouse.up()
const a0 = await getBox(page, 0)
const a1 = await getBox(page, 1)
const dh = snap8(b0.height + 16) - b0.height
const dy = a0.top - b0.top
expect(a0.height).toBe(b0.height + dh)
expect(a1.height).toBe(b1.height + dh)
expect(dy).toBeLessThanOrEqual(-16)
expect(a1.top - b1.top).toBe(dy)
})
})
@@ -0,0 +1,59 @@
import { test, expect } from '@playwright/test'
const wysiwygUrl = '/en/wysiwyg'
test.describe('WYSIWYG - Guides toggle with group rotate + snap + live region', () => {
test('guides ON: after multiselect and rotate, dragging snaps and aria-live shows guides + selection', async ({ page }) => {
await page.goto(wysiwygUrl)
const canvas = page.getByTestId('wysiwyg-canvas')
await expect(canvas).toBeVisible()
const addText = page.getByRole('button', { name: /^Add Text$/i })
await addText.click()
await addText.click()
// Turn on Guides
const guidesBtn = page.getByRole('button', { name: /Guides/i })
await guidesBtn.click()
// Marquee select both
const cbox = await canvas.boundingBox()
if (!cbox) throw new Error('canvas not found')
await page.mouse.move(cbox.x + 40, cbox.y + 40)
await page.mouse.down()
await page.mouse.move(cbox.x + 260, cbox.y + 160)
await page.mouse.up()
const live = page.getByTestId('aria-live')
await expect(live).toContainText(/선택\s*2개/)
// Rotate ~15deg
const rotateHandle = page.locator('[data-testid^="rotate-handle-"]').first()
const hbox = await rotateHandle.boundingBox()
if (!hbox) throw new Error('rotate handle not found')
await page.mouse.move(hbox.x + 5, hbox.y + 5)
await page.mouse.down()
await page.mouse.move(hbox.x + 40, hbox.y + 5)
await expect(live).toContainText(/가이드\s*x=|y=/)
await page.mouse.up()
// Drag group by ~13px on X to verify grid snap still applies with guides
const target = page.locator('[data-testid^="obj-text-"]').nth(1)
const tbox = await target.boundingBox()
if (!tbox) throw new Error('target not found')
// Read before
const leftsBefore = await page.locator('[data-testid^="obj-text-"]').evaluateAll((nodes) => nodes.map(n => parseInt((n as HTMLElement).style.left || '0', 10)))
await page.mouse.move(tbox.x + 5, tbox.y + 5)
await page.mouse.down()
await page.mouse.move(tbox.x + 5 + 13, tbox.y + 5)
await page.mouse.up()
const leftsAfter = await page.locator('[data-testid^="obj-text-"]').evaluateAll((nodes) => nodes.map(n => parseInt((n as HTMLElement).style.left || '0', 10)))
const dx = leftsAfter[1] - leftsBefore[1]
expect(dx).toBe(16)
expect(leftsAfter[0] - leftsBefore[0]).toBe(16)
})
})