mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
test(e2e): the iPad case checks what broke #1432, the guides read today's texts
The iPad case could no longer fail on its own regression: a draggable row behind the long-press bridge is what tablets get by design since #1616, and nothing in the case swiped. What turned swipes into drags in #1432 was the drag-drop-touch polyfill, so the case now asserts that a tablet never loads it. Two help-media guides waited for "1 files" and "2 flight(s) imported", which now read "1 file" and "2 flights imported".
This commit is contained in:
@@ -459,12 +459,12 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
target: p => card(p).getByText('Upload', { exact: true }),
|
||||
act: async p => {
|
||||
await card(p).locator('input[type="file"][multiple]').setInputFiles(await coverFixture())
|
||||
await expect(card(p).getByRole('button', { name: '1 files' })).toBeVisible({ timeout: 30_000 })
|
||||
await expect(card(p).getByRole('button', { name: '1 file', exact: true })).toBeVisible({ timeout: 30_000 })
|
||||
await settle(p)
|
||||
},
|
||||
},
|
||||
// The list opens itself once the upload lands.
|
||||
only(p => card(p).getByRole('button', { name: '1 files' })),
|
||||
only(p => card(p).getByRole('button', { name: '1 file', exact: true })),
|
||||
// No click: openFile hands the browser a download.
|
||||
only(p => card(p).getByRole('button', { name: UPLOADED })),
|
||||
],
|
||||
|
||||
@@ -650,7 +650,7 @@ const SCRIPTS: Record<string, GuideScript> = {
|
||||
await importCta(p).click()
|
||||
await expect(p.getByText('Import from AirTrail', { exact: true })).toHaveCount(0, { timeout: 30_000 })
|
||||
// The toast counts flight ids, so the joined pair reports two.
|
||||
const toast = p.getByText('2 flight(s) imported', { exact: true })
|
||||
const toast = p.getByText('2 flights imported', { exact: true })
|
||||
await expect(toast).toBeVisible({ timeout: 15_000 })
|
||||
await expect(card(p, JOINED.title)).toBeVisible({ timeout: 20_000 })
|
||||
// The toast fades after three seconds; the card's picture and the
|
||||
|
||||
@@ -61,8 +61,13 @@ test('#1432 iPad: the places list scrolls under a swipe', async ({ page }) => {
|
||||
expect(env.coarse, 'iPad reports a coarse primary pointer').toBe(true)
|
||||
expect(env.width, 'iPad sits above the 768px "mobile" breakpoint').toBeGreaterThanOrEqual(768)
|
||||
|
||||
// 1. A swipe must not become a drag: a row is either not draggable, or draggable
|
||||
// only behind the long-press bridge (#1616).
|
||||
// 1. A swipe must not become a drag. What turned it into one in #1432 was the
|
||||
// drag-drop-touch polyfill; it belongs to hybrid laptops only now
|
||||
// (utils/touchDragPolyfill.ts), so a tablet must never load it. A row may be
|
||||
// draggable, but only behind the long-press bridge (#1616).
|
||||
const polyfillLoaded = await page.evaluate(() =>
|
||||
performance.getEntriesByType('resource').some(e => /drag-?drop-?touch/i.test(e.name)))
|
||||
expect(polyfillLoaded, 'the drag-drop-touch polyfill stays off a tablet').toBe(false)
|
||||
const row = page.locator('div[draggable]').filter({ hasText: 'Place 1' }).first()
|
||||
await expect(row).toBeVisible()
|
||||
const swipeSafe = await row.evaluate(el => el.getAttribute('draggable') !== 'true' || !!el.closest('[data-touch-drag]'))
|
||||
|
||||
Reference in New Issue
Block a user