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
66.73k stars 3.66k forks source link

[REGRESSION]: bundled WebKit renders websites built with Angular/React incorrectly since v1.25.0 #17766

Closed theDavidBarton closed 2 years ago

theDavidBarton commented 2 years ago

Context:

Code Snippet

Basically, everything made via the API got 2-5 times slower. For example page.goto:

playwright.config.js

const { devices } = require('@playwright/test')

const config = {
  use: {
    browserName: 'webkit',
    ...devices['iPhone 11']
  }  
}

module.exports = config

example.test.js

const { test, expect } = require('@playwright/test')

test.describe.serial('flight search', () => {
  let page
  test.beforeAll(async ({ browser }) => page = await browser.newPage())
  test.afterAll(async () => await page.close())

  test('should be opened on page', async () => {
    await page.goto('https://www.delta.com/eu/en')
  })
})

Describe the bug

Since the version v1.25.0 the bundled/patched Webkit won't render correctly most pages built with Angular or React on Windows OS. I believe for the same reason but the Webkit tests got extremely slow if we try to upgrade anywhere above v1.24.2. Let me share some example websites where the issue can be reproduced:

As far as I see it has nothing to do with Playwright or Playwright Test libraries, but the patched Webkit executable itself. You can even reproduce this without Playwright simply by opening the Webkit executable on a Windows machine and visiting any of the sites I've listed above.

Works and renders correctly on webkit-1683:

C:\Users\theDa\AppData\Local\ms-playwright\webkit-1683\Playwright.exe

image

Faulty on patched Webkits bundled since 1.25 (e.g. webkit-1715):

C:\Users\theDa\AppData\Local\ms-playwright\webkit-1715\Playwright.exe

  1. dropdown got slow and laggy
  2. background-image rendering issues (you can see this on many of the above example websites, that is the most visible symptom)
  3. floating elements disappearing from the viewport e.g. cookie consent

image

The issue 1.) is the most worrisome and it prevents us from upgrading Playwright.

I've noticed there were some changes regarding Webkit patching between 1.24.2 and 1.25.0, I am pretty sure that is the issue. I haven't found others reporting this (or they just didn't use the same keywords to describe the issue) but I think this would be worth a fix for those who have sites built in a similar way and they want to test against Safari 😅

Thank you!

fujii commented 2 years ago

The background image issue looks like this upstream bug. https://bugs.webkit.org/show_bug.cgi?id=245813

theDavidBarton commented 2 years ago

thank you for your expertise on it @fujii.
do you think the 3rd point (cookie prompt disappeared from viewport) can be also a WinCairo-specific issue and I should rather focus only on the 1st point here? (about the latter I am rather convinced that requires a fix with a Playwright release)

fujii commented 2 years ago

I also confirmed webkit-1715 had the cookie prompt issue, but webkit-1722 doesn't. I don't know, but it might be already fixed. https://playwright.azureedge.net/builds/webkit/1715/webkit-win64.zip https://playwright.azureedge.net/builds/webkit/1722/webkit-win64.zip

For, the dropdown slow and laggy issue. I'm not confident that I'm seeing the same issue with you. But, I'm frequently observing busy WebKitWebProcess.exe process in the PayPal page. It seems that JavaScript is running in the cases. I don't know this is relevant to your problem.

testgitdl commented 2 years ago

Tested on 1.28.0-alpha-oct-17-2022 and my problem is fixed https://github.com/microsoft/playwright/issues/17614 Thank you!

dgozman commented 2 years ago

Closing as per above.

theDavidBarton commented 2 years ago

might be a dumb question, but where can we access 1.28.0-alpha-oct-17-2022? (I see some improvement in v1.27, but would be happy to try out if it really fixed the original issue)

dgozman commented 2 years ago

@theDavidBarton run npm install --save-dev @playwright/test@1.28.0-alpha-oct-17-2022