33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
const builderUrl = '/en/builder'
|
|
|
|
test('dnd keyboard fallback: Up/Down buttons reorder sections', async ({ page }) => {
|
|
await page.goto(builderUrl)
|
|
|
|
// add specific sections in order: hero, faq, cta
|
|
await page.getByTestId('card-hero').click()
|
|
await page.getByTestId('card-faq').click()
|
|
await page.getByTestId('card-cta').click()
|
|
|
|
const list = page.getByTestId('section-canvas')
|
|
const items = () => list.getByTestId(/sec-item-/)
|
|
|
|
// initial order
|
|
await expect(items().nth(0)).toContainText('hero')
|
|
await expect(items().nth(1)).toContainText('faq')
|
|
await expect(items().nth(2)).toContainText('cta')
|
|
|
|
// move first item down
|
|
await items().nth(0).getByLabel('Down 0').click()
|
|
await expect(items().nth(0)).toContainText('faq')
|
|
await expect(items().nth(1)).toContainText('hero')
|
|
await expect(items().nth(2)).toContainText('cta')
|
|
|
|
// move last item up
|
|
await items().nth(2).getByLabel('Up 2').click()
|
|
await expect(items().nth(0)).toContainText('faq')
|
|
await expect(items().nth(1)).toContainText('cta')
|
|
await expect(items().nth(2)).toContainText('hero')
|
|
})
|