[BUG] "subtree intercepts pointer events" when clicking component with scheduled rotation

See original GitHub issue

Context:

  • Playwright Version: [1.19.1]
  • Operating System: [Win 10]
  • Node.js version: [14.18.3]
  • Browser: [Desktop Chromium, Desktop Firefox]
  • Extra: [any specific details about your environment]

Code Snippet

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

test.describe('pc smoke', () => {
  let page: Page

  test.beforeEach(async ({ browser }) => {
    const context = await browser.newContext();
    page = await context.newPage();
    await page.goto('https://www.ikea.cn/cn/zh');
    await page.evaluate(() => window.localStorage.setItem('dismissedSurveyActivityIds', '["survey-activity-for-covid19"]'));
    await page.evaluate(() => window.localStorage.setItem('footerCookie', '0'));
    await page.locator('button.ikeacn-consent-modal__button').nth(1).click();
  });

  test('home-search-add', async () => {
    await page.locator('input.s-input').click();
    await page.locator('input.inputSearch').fill('pax');
    await page.keyboard.press('Enter');
    await page.waitForNavigation();
  });
});

Describe the bug

We are starting to test https://www.ikea.cn/cn/zh with playwright. One feature is that recommended search keyword will be rotating in the search input. (For /cn/zh Chinese version only, but you don’t need to understand Chinese) And we hit below error frequently when trying to click “input.s-input”. Not every time, but I’m sure if you try 5 - 10 times you will definitely hit it. Any advise will be appreciated. Thank you.

Similar to https://github.com/microsoft/playwright/issues/10638 but PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK seems not helpful.

C:\Users\totao\Downloads\playwright>npx playwright test tests/search.spec.ts --headed

Running 1 test using 1 worker

  1. [chromium] › search.spec.ts:18:3 › pc smoke › home-search-add =================================
Timeout of 30000ms exceeded.

locator.click: Target closed
=========================== logs ===========================
waiting for selector "input.s-input"
  selector resolved to visible <input value="" class="s-input" data-v-e937ae80="" aria…/>
attempting click action
  waiting for element to be visible, enabled and stable
  element is visible, enabled and stable
  scrolling into view if needed
  done scrolling
  checking that element receives pointer events at (877.25,71)
  <div class="notice" data-v-925d6144="">…</div> from <div data-v-925d6144="" data-v-e937ae80="" class="not…>…</div> subtree intercepts pointer events

… ============================================================

  17 |
  18 |   test('home-search-add', async () => {
> 19 |     await page.locator('input.s-input').click();
     |                                         ^
  20 |     await page.locator('input.inputSearch').fill('pax');
  21 |     await page.keyboard.press('Enter');
  22 |     await page.waitForNavigation();

    at C:\Users\totao\Downloads\playwright\tests\search.spec.ts:19:41
    at C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:373:13
    at TestInfoImpl._runFn (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\testInfo.js:164:7)        at WorkerRunner._runTestWithBeforeHooks (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:348:24)
    at TestInfoImpl._runWithTimeout (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\testInfo.js:152:7)
    at WorkerRunner._runTestOrAllHook (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:308:5)
    at WorkerRunner._runSuite (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:221:43)
    at WorkerRunner._runSuite (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:217:9)
    at WorkerRunner.run (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\workerRunner.js:163:9)
    at process.<anonymous> (C:\Users\totao\Downloads\playwright\node_modules\@playwright\test\lib\worker.js:94:5)

attachment #1: screenshot (image/png) ----------------------------------------------------------
test-results\search-pc-smoke-home-search-add-chromium\test-failed-1.png
------------------------------------------------------------------------------------------------

Slow test file: [chromium] › search.spec.ts (30s) Consider splitting slow test files to speed up parallel execution

1 failed [chromium] › search.spec.ts:18:3 › pc smoke › home-search-add ==================================

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
dgozmancommented, Feb 25, 2022

@mypchas6fans Thank you for the issue!

I ran the snippet 15 times and it passed every time. I’d suggest to record a trace and see yourself whether <div class="notice" data-v-925d6144="">…</div> does indeed overlay the element you are trying to click. If it does, you have a few options:

  • Use force: true click option and hope that this element does not interfere with clicking, although it most likely does.
  • Fix the actual page so that rotating keyword does not block the input, for example add pointer-events: none to it.
  • Disable this rotation feature when testing.
3reactions
regnoucommented, Jun 29, 2022

Hi, I have a bug there : https://stackoverflow.com/questions/72795146/how-to-inject-a-script-using-playwright-that-will-create-an-unique-attribute-o

It is related to the ‘pointer intercept’ error… the click does not happen. I cannot get a trace because the click instruction loops.

Fix the actual page so that rotating keyword does not block the input, for example add pointer-events: none to it.
Disable this rotation feature when testing.

How I could do that when I am scrapping a page (I do not own the HTML to modify it). I should do it with playwright maybe ? If yes, I am also looking for an example how to do it. More precisely, a little bit out of topic, I would like to know how to inject a script, that would add a data-id-attribute to all buttons, so that I could easily guess the locator.

Tks,

“playwright”: “^1.22.2”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Seeing some weird behavior with an element intercepting a click
I have a button I want to interact with on a page, but the button is apart of a parent element that houses...
Read more >
Solved: Report testing Automation (using Playwright) - una...
[api] element does not receive pointer events [api] retrying click action [api] waiting for element to be visible, enabled and not moving
Read more >
FrameLayout - Android Developers
android:soundEffectsEnabled, Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching.
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug :1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance to ... Bug:53897 - "dev-java/jdic - The JDesktop Integration Components (JDIC)" ...
Read more >
QGraphicsItem — Qt for Python - Qt Documentation
def setRotation (angle) ... QGraphicsItem is part of the Graphics View Framework ... handles mouse press, move, release, click and double-click events.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found