E2E: 멀티선택 회전 후 그룹 드래그 스냅 유지 및 라이브리전 검증 추가
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
const wysiwygUrl = '/en/wysiwyg'
|
||||
|
||||
async function getLefts(page: import('@playwright/test').Page) {
|
||||
const els = page.locator('[data-testid^="obj-text-"]')
|
||||
const count = await els.count()
|
||||
const results: number[] = []
|
||||
for (let i = 0; i < count; i++) {
|
||||
const style = await els.nth(i).evaluate((n) => (n as HTMLElement).style.left || '0')
|
||||
results.push(parseInt(style || '0', 10))
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
test.describe('WYSIWYG - Group rotate then drag with snap and live region', () => {
|
||||
test('after rotating multiselect, dragging group by 13px snaps to 16px; live region says 선택 2개', 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()
|
||||
|
||||
const live = page.getByTestId('aria-live')
|
||||
await expect(live).toContainText(/선택\s*2개/)
|
||||
|
||||
// Rotate ~15deg via rotate handle
|
||||
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()
|
||||
|
||||
const before = await getLefts(page)
|
||||
|
||||
// Drag group by ~13px on X; expect grid snap to 16
|
||||
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 + 5)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(tbox.x + 5 + 13, tbox.y + 5)
|
||||
await page.mouse.up()
|
||||
|
||||
const after = await getLefts(page)
|
||||
const dx = after[1] - before[1]
|
||||
expect(dx).toBe(16)
|
||||
expect(after[0] - before[0]).toBe(16)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user