playwright-community / jest-playwright

Running tests using Jest & Playwright
MIT License
532 stars 75 forks source link

Got the error >>TypeError: this[(intermediate value)(intermediate value)(intermediate value)] is not a function #795

Closed voravuthbo closed 2 years ago

voravuthbo commented 2 years ago

Describe the bug Found the error TypeError: this[(intermediate value)(intermediate value)(intermediate value)] is not a function after executed the test

jest -c jest.e2e.config.js --runInBand --json --outputFile=testresults/report.json "testcases/test102.test.js"

Not sure what happened, the test was working fine 3 days ago but when executed it again after npm update the error occurred even I'm trying to downgrade all versions libraries related but i had no luck.

Screenshots image

Desktop (please complete the following information):

  "dependencies": {
    "playwright": "^1.16.3"
  },
  "devDependencies": {
    "chrome-paths": "^1.0.1",
    "convert-excel-to-json": "^1.7.0",
    "dotenv": "^10.0.0",
    "dotenv-flow": "^3.2.0",
    "eslint-plugin-jest-playwright": "^0.2.1",
    "exceljs": "^4.3.0",
    "expect-playwright": "^0.8.0",
    "form-data": "^2.3.3",
    "jest": "^27.3.1",
    "jest-html-reporters": "3.0.3",
    "jest-junit": "^13.0.0",
    "jest-playwright-preset": "^1.7.0",
    "moment": "^2.29.1",
    "mongodb": "^4.1.4",
    "mysql": "^2.18.1",
    "node-fetch": "^2.6.6",
    "playwright-core": "^1.16.3",
    "rimraf": "^3.0.2",
    "testrail-integration": "^0.1.7",
    "ws": "^8.2.3",
    "xml2json": "^0.12.0"
  }

image

voravuthbo commented 2 years ago

After updated jest version to 28.0.2 the error has changed to

TypeError: Cannot read properties of undefined (reading 'serial')
    at PlaywrightRunner.runTests (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:127:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async TestScheduler.scheduleTests (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/@jest/core/build/TestScheduler.js:317:13)
    at async runJest (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/@jest/core/build/runJest.js:407:19)
    at async _run10000 (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/@jest/core/build/cli/index.js:338:7)
    at async runCLI (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/@jest/core/build/cli/index.js:190:3)
    at async Object.run (/Users/voravuth.b/PycharmProjects/qa-playwright-nest/node_modules/jest-cli/build/cli/index.js:155:37)

It seems serial is unable to use in new jest / playwright version ?

Kessir commented 2 years ago

Explicitely setting "jest": "^27.5.1", "jest-runner": "^27.5.1", "jest-environment-node": "27.5.1" in your package.json should solve this issue for now. At least until this PR is merged https://github.com/playwright-community/jest-playwright/pull/794.

I got the hint from another issue: https://github.com/playwright-community/jest-playwright/issues/793#issuecomment-1109812771

voravuthbo commented 2 years ago

@Kessir It back to work now. Thank you, you made my day.