| 1 |
import { expect, test } from '../fixtures'; |
| 2 |
|
| 3 |
// ShowTitle:B adds a site-title field and SubmitOutside:B pushes the submit |
| 4 |
// button below the description, together making the page taller than the |
| 5 |
// control. Make sure the "WP Admin Dashboard" exit link is reachable. |
| 6 |
// Regression for company-product#2257. |
| 7 |
|
| 8 |
const SHORT_MOBILE = { width: 360, height: 640 }; |
| 9 |
|
| 10 |
const forceVariantB = (page) => |
| 11 |
page.addInitScript(() => { |
| 12 |
let ext: unknown; |
| 13 |
Object.defineProperty(window, 'extLaunchData', { |
| 14 |
configurable: true, |
| 15 |
get: () => ext, |
| 16 |
set: (value) => { |
| 17 |
const data = value as { |
| 18 |
activeTests?: Record<string, { variant: string }>; |
| 19 |
} | null; |
| 20 |
if (data && typeof data === 'object') { |
| 21 |
data.activeTests = { |
| 22 |
...data.activeTests, |
| 23 |
'AutoLaunch.ShowTitle': { variant: 'B' }, |
| 24 |
'AutoLaunch.SubmitOutside': { variant: 'B' }, |
| 25 |
}; |
| 26 |
} |
| 27 |
ext = value; |
| 28 |
}, |
| 29 |
}); |
| 30 |
}); |
| 31 |
|
| 32 |
test.beforeEach(async ({ requestUtils }) => { |
| 33 |
await requestUtils.login(); |
| 34 |
}); |
| 35 |
|
| 36 |
test('B variant scrolls on a short mobile viewport and the exit link is reachable', async ({ |
| 37 |
page, |
| 38 |
admin, |
| 39 |
}) => { |
| 40 |
await forceVariantB(page); |
| 41 |
await page.setViewportSize(SHORT_MOBILE); |
| 42 |
await admin.visitAdminPage('admin.php', 'page=extendify-auto-launch'); |
| 43 |
|
| 44 |
const exitLink = page.getByRole('link', { name: 'WP Admin Dashboard' }); |
| 45 |
await expect(exitLink).toBeAttached(); |
| 46 |
|
| 47 |
const scroller = page.locator('div.overflow-y-auto'); |
| 48 |
await expect(scroller).toHaveCSS('overflow-y', 'auto'); |
| 49 |
|
| 50 |
await exitLink.scrollIntoViewIfNeeded(); |
| 51 |
await expect(exitLink).toBeVisible(); |
| 52 |
}); |
| 53 |
|