jest-playwright: Error when using custom Jest runner with selector engine: "shadow" selector engine has been already registered

UPDATED

Getting an error when using custom Jest runner with selector engine: "shadow" selector engine has been already registered. See repro in comments below.

Original problem below. After update, solved by upgrading also Playwright.

Just upgraded to latest jest-playwright (0.1.1) and get this when running:

FAIL   E2E  tests/e2e/suite/login/login.e2e.test.js
  ● Test suite failed to run

    Cannot evaluate a string with arguments

      at assert (../../node_modules/playwright-core/lib/helper.js:196:15)
      at Function.evaluationString (../../node_modules/playwright-core/lib/helper.js:25:13)
      at Selectors.register (../../node_modules/playwright-core/lib/selectors.js:31:40)
      at Selectors.<anonymous> (../../node_modules/playwright-core/lib/helper.js:55:31)
      at ../../node_modules/jest-playwright-preset/lib/utils.js:69:88
          at Array.map (<anonymous>)
      at Object.exports.getPlaywrightInstance (../../node_modules/jest-playwright-preset/lib/utils.js:69:41)
      at PlaywrightEnvironment.setup (../../node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:75:36)

My jest-playwright.config.js:

const {
  selectorEngine,
} = require('query-selector-shadow-dom/plugins/playwright');

module.exports = {
  selectors: [{ name: 'shadow', script: selectorEngine }],
  server: {
    command: 'npm run start',
  },
};

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I will keep it open, cause now it’s kind of hacky solution

@thernstig ok, I’ll put PR to fix this soon and publish version with fix

Oh, you did! Then all good, we can close this one. Thanks!!

(upgrading worked)