microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
63.95k stars 3.47k forks source link

[Bug]: Mobile Safari cannot select locators outside the visible area #31551

Open boeschung opened 6 days ago

boeschung commented 6 days ago

Version

1.45.1

Steps to reproduce

// Doesn't work in Mobile Safari
test(`1. Test: doesn't work with mobile safari`, async ({ page }) => {
  await page.goto(
    "https://www.verkuendung-bayern.de/service/haeufig-gestellte-fragen/"
  );
  await page
    .getByRole("link", { name: "Erklärung zur Barrierefreiheit", exact: true })
    .click();
  await expect(page).toHaveURL(
    "https://www.verkuendung-bayern.de/service/barrierefrei/"
  );
});

// Doesn't work in Mobile Safari
test(`2. Test: doesn't work with mobile safari`, async ({ page }) => {
  await page.goto(
    "https://www.verkuendung-bayern.de/"
  );
  await page
    .getByTitle('Veröffentlichungen im BayMBl.', { exact: true })
    .click();
  await expect(page).toHaveURL(
    "https://www.verkuendung-bayern.de/baymbl/"
  );
});

// This test work in Mobile Safari
test(`3. Test: work with mobile safari`, async ({ page }) => {
  await page.goto(
    "https://www.verkuendung-bayern.de/"
  );
  await page
    .getByRole('link', { name: 'Bayerische Ministerialblatt' })
    .click();
  await expect(page).toHaveURL(
    "https://www.verkuendung-bayern.de/baymbl/"
  );
});

Expected behavior

All 3 tests should work in Mobile Safari.

Actual behavior

All 3 tests work in the browsers Chromium, Firefox, Webkit, Mobile Chrome, Microsoft Edge and Google Chrome. In Mobile Safari, tests 1 and 2 do not work, but test 3 does.

Additional context

No response

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 26.68 GB / 38.83 GB
    Container: Yes
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    bun: 1.0.21 - ~/.bun/bin/bun
  IDEs:
    VSCode: 1.72.2 - /usr/bin/code
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.45.1 => 1.45.1
mxschmitt commented 5 days ago

Investigation: I can reproduce, passes on macOS but fails on Ubuntu for Mobile Safari (devices['iPhone 12']). Looks like scrollIntoViewIfNeeded isn't working there. When taking a screenshot() it stays at the top of the page.