test: reset view scale after navigation (#26939)
Failing test for #26876
This commit is contained in:
parent
829609dac0
commit
fd28e8d801
|
|
@ -189,4 +189,44 @@ it.describe('mobile viewport', () => {
|
||||||
await page.waitForFunction('window.scrollY === 100');
|
await page.waitForFunction('window.scrollY === 100');
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('view scale should reset after navigation', async ({ browser, browserName }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26876' });
|
||||||
|
it.fixme(browserName === 'webkit');
|
||||||
|
const context = await browser.newContext({
|
||||||
|
viewport: { width: 390, height: 664 },
|
||||||
|
isMobile: true,
|
||||||
|
});
|
||||||
|
const page = await context.newPage();
|
||||||
|
await page.goto(`data:text/html,<meta name='viewport' content='device-width, initial-scale=1'><button>Mobile Viewport</button>`);
|
||||||
|
await page.route('**/button.html', route => {
|
||||||
|
void route.fulfill({
|
||||||
|
body: `<body>
|
||||||
|
<button>Click me</button>
|
||||||
|
<script>
|
||||||
|
window.clicks = [];
|
||||||
|
document.addEventListener('click', e => {
|
||||||
|
const dot = document.createElement('div');
|
||||||
|
dot.style.position = 'absolute';
|
||||||
|
dot.style.width = '10px';
|
||||||
|
dot.style.height = '10px';
|
||||||
|
dot.style.borderRadius = '5px';
|
||||||
|
dot.style.backgroundColor = 'red';
|
||||||
|
dot.style.left = e.pageX + 'px';
|
||||||
|
dot.style.top = e.pageY + 'px';
|
||||||
|
dot.textContent = 'x: ' + e.pageX + ' y: ' + e.pageY;
|
||||||
|
document.body.appendChild(dot);
|
||||||
|
window.clicks.push({ x: e.pageX, y: e.pageY });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>`,
|
||||||
|
contentType: 'text/html',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await page.goto('http://localhost/button.html');
|
||||||
|
await page.getByText('Click me').click({ force: true });
|
||||||
|
expect(await page.evaluate(() => (window as any).clicks)).toEqual(
|
||||||
|
browserName === 'chromium' ? [{ x: 41, y: 18 }] : [{ x: 37, y: 15 }]);
|
||||||
|
await context.close();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue