playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Chromium page crashes when using expect(locator).toHaveScreenshot

Open ghost opened this issue 2 years ago • 2 comments

Context:

  • Playwright Version: 1.22.2
  • Operating System: Mac
  • Node.js version: 18.3.0
  • Browser: Chromium

Code Snippet

import { expect, test } from '@playwright/test';

test.only('Test', async ({ page }) => {
    const email = '[email protected]';
    const password = 'test1234';
    const ptrt = 'https://account.test.bbc.com/account/settings';

    await page.goto(
        `https://session.test.bbc.co.uk/session?lang=en-GB&ptrt=${ptrt}`
    );
    await page.fill('text=Email or username', email);
    await page.fill('text=Password', password);
    await page.click('role=button[name="Sign in"]');

    const locator = page.locator('data-testid=app-container');
    await expect(locator).toHaveScreenshot('app-container.png');
});

Describe the bug

Chromium page crashes: Screenshot 2022-07-12 at 11 00 05

Playwright Test output is:

 Error: Timeout 10000ms exceeded.


    Call log:
      - expect.toHaveScreenshot with timeout 10000ms
      -   generating new stable screenshot expectation
      - waiting for selector "data-testid=app-container"
      -   selector resolved to visible <div id="app-container" class="profile light" data-te…>…</div>
      - taking element screenshot
      -   disabled all CSS animations
      -   waiting for element to be visible and stable
      -     element is not stable - waiting...
      -   element is visible and stable
      - waiting 100ms before taking screenshot
      - waiting for selector "data-testid=app-container"
      -   selector resolved to visible <div id="app-container" class="profile light" data-te…>…</div>
      - Timeout 10000ms exceeded.


      14 |
      15 |     const locator = page.locator('data-testid=app-container');
    > 16 |     await expect(locator).toHaveScreenshot('app-container.png');
         |                           ^
      17 | });
      18 |

ghost avatar Jul 12 '22 10:07 ghost

I can repro with Chromium ToT (105.0.5165.0) as well as normal chromium on macOS and linux. Its connected to the logic that animations are getting disabled.

Stack trace:

  pw:browser [pid=162][err] Received signal 11 SEGV_MAPERR 000000000000 +4ms
  pw:browser [pid=162][err] #0 0x56135088d439 base::debug::CollectStackTrace() +27ms
  pw:browser [pid=162][err] #1 0x561350802253 base::debug::StackTrace::StackTrace() +16ms
  pw:browser [pid=162][err] #2 0x56135088cf41 base::debug::(anonymous namespace)::StackDumpSignalHandler() +13ms
  pw:browser [pid=162][err] #3 0x7efee61523c0 (/usr/lib/x86_64-linux-gnu/libpthread-2.31.so+0x143bf) +1ms
  pw:browser [pid=162][err] #4 0x561354f6753c blink::ScriptedAnimationController::EnqueueEvent() +26ms
  pw:browser [pid=162][err] #5 0x5613550986b8 blink::CSSAnimations::AnimationEventDelegate::MaybeDispatch() +25ms
  pw:browser [pid=162][err] #6 0x5613550988bb blink::CSSAnimations::AnimationEventDelegate::OnEventCondition() +19ms
  pw:browser [pid=162][err] #7 0x56135508194e blink::AnimationEffect::UpdateInheritedTime() +19ms
  pw:browser [pid=162][err] #8 0x56135507c78b blink::Animation::Update() +19ms
  pw:browser [pid=162][err] #9 0x56135508248a blink::AnimationTimeline::ServiceAnimations() +20ms
  pw:browser [pid=162][err] #10 0x5613550c870c blink::DocumentAnimations::UpdateAnimationTimingForAnimationFrame() +33ms
  pw:browser [pid=162][err] #11 0x56135422c55e blink::LocalFrameView::ServiceScriptedAnimations() +33ms
  pw:browser [pid=162][err] #12 0x561354aca472 blink::PageAnimator::ServiceScriptedAnimations() +56ms
  pw:browser [pid=162][err] #13 0x561354ac7182 blink::Page::Animate() +47ms
  pw:browser [pid=162][err] #14 0x561354589fee blink::WebFrameWidgetImpl::BeginMainFrame() +28ms
  pw:browser [pid=162][err] #15 0x561351ed659c cc::ProxyMain::BeginMainFrame() +19ms
  pw:browser [pid=162][err] #16 0x56134cf23060 base::internal::Invoker<>::RunOnce() +0ms
  pw:browser [pid=162][err] #17 0x56135084a3d0 base::TaskAnnotator::RunTaskImpl() +24ms
  pw:browser [pid=162][err] #18 0x56135085dde0 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl() +26ms
  pw:browser [pid=162][err] #19 0x56135085daec base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() +13ms
  pw:browser [pid=162][err] #20 0x56135085e362 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() +14ms
  pw:browser [pid=162][err] #21 0x5613508087eb base::MessagePumpDefault::Run() +18ms
  pw:browser [pid=162][err] #22 0x56135085e5e6 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run() +9ms
  pw:browser [pid=162][err] #23 0x561350827bad base::RunLoop::Run() +12ms
  pw:browser [pid=162][err] #24 0x561355f726eb content::RendererMain() +42ms
  pw:browser [pid=162][err] #25 0x56135037d5ea content::RunZygote() +18ms
  pw:browser [pid=162][err] #26 0x56135037ddd9 content::RunOtherNamedProcessTypeMain() +12ms
  pw:browser [pid=162][err] #27 0x56135037eb3b content::ContentMainRunnerImpl::Run() +12ms
  pw:browser [pid=162][err] #28 0x56135037bdfe content::RunContentProcess() +11ms
  pw:browser [pid=162][err] #29 0x56135037c7be content::ContentMain() +11ms
  pw:browser [pid=162][err] #30 0x56134cd80227 ChromeMain +32ms
  pw:browser [pid=162][err] #31 0x7efee527d0b3 __libc_start_main +0ms
  pw:browser [pid=162][err] #32 0x56134cd8002a _start +33ms
  pw:browser [pid=162][err]   r8: 0000000000000001  r9: 0000000000000020 r10: 00007ffe5cbcd080 r11: 0000000000000286 +0ms
  pw:browser [pid=162][err]  r12: 0000099d0043cd18 r13: 00000db8003503c0 r14: 0000099d002d2140 r15: 0000099d00eaf488 +0ms
  pw:browser [pid=162][err]   di: 0000000000000000  si: 0000099d00eaf460  bp: 00007ffe5cac11c0  bx: 0000099d00eaf460 +0ms
  pw:browser [pid=162][err]   dx: 0000000000000003  ax: 054ae9260d87fe00  cx: 0000000000000083  sp: 00007ffe5cac1180 +1ms
  pw:browser [pid=162][err]   ip: 0000561354f6753c efl: 0000000000010202 cgf: 002b000000000033 erf: 0000000000000004 +0ms
  pw:browser [pid=162][err]  trp: 000000000000000e msk: 0000000000000000 cr2: 0000000000000000 +0ms
  pw:browser [pid=162][err] [end of stack trace] +0ms

mxschmitt avatar Jul 12 '22 10:07 mxschmitt

This does indeed repro for me with Playwright, but I was not able to create a standalone repro that uses just evaluate.

dgozman avatar Jul 25 '22 23:07 dgozman

I've just run into the same problem using the mcr.microsoft.com/playwright:v1.32.1-focal image, producing the same stack trace. Disabling the CSS animation mitigates the issue.

thewilkybarkid avatar Apr 11 '23 13:04 thewilkybarkid

Having the same issue on Chromium. After spending many hours on this, it was enabling CSS animation that solved it for me. :( I hope this gets fixed soon since we rely a lot on screenshot testing.

sashankaryal avatar Jul 28 '23 22:07 sashankaryal