Joshua Muheim
Joshua Muheim

Reputation: 13195

Playwright: TypeError: Cannot read property 'retry' of undefined

I'm currently in the process of writing tests in Playwright.

What I notice is a strange output in the console:

TypeError: Cannot read property 'retry' of undefined

Even though all the tests pass, I get this, and it leads to ugly additional output:

screenshot

Here is the content of the debug.log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/josua/.nvm/versions/node/v12.18.4/bin/node',
1 verbose cli   '/Users/josua/.nvm/versions/node/v12.18.4/bin/npm',
1 verbose cli   'run',
1 verbose cli   'test:run'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:run', 'test:run', 'posttest:run' ]
5 info lifecycle [email protected]~pretest:run: [email protected]
6 info lifecycle [email protected]~test:run: [email protected]
7 verbose lifecycle [email protected]~test:run: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:run: PATH: /Users/josua/.nvm/versions/node/v12.18.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/josua/Projects/adg-components-ramon/node_modules/.bin:/Users/josua/.rvm/gems/ruby-2.4.10/bin:/Users/josua/.rvm/gems/ruby-2.4.10@global/bin:/Users/josua/.rvm/rubies/ruby-2.4.10/bin:/Users/josua/.nvm/versions/node/v12.18.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/josua/.rvm/bin
9 verbose lifecycle [email protected]~test:run: CWD: /Users/josua/Projects/adg-components-ramon
10 silly lifecycle [email protected]~test:run: Args: [ '-c', 'playwright test' ]
11 silly lifecycle [email protected]~test:run: Returned: code: 1  signal: null
12 info lifecycle [email protected]~test:run: Failed to exec test:run script
13 verbose stack Error: [email protected] test:run: `playwright test`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/josua/.nvm/versions/node/v12.18.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/Users/josua/.nvm/versions/node/v12.18.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/josua/Projects/adg-components-ramon
16 verbose Darwin 21.2.0
17 verbose argv "/Users/josua/.nvm/versions/node/v12.18.4/bin/node" "/Users/josua/.nvm/versions/node/v12.18.4/bin/npm" "run" "test:run"
18 verbose node v12.18.4
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test:run: `playwright test`
22 error Exit status 1
23 error Failed at the [email protected] test:run script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Can't find any reference to retry in there though. And in my whole project, looking for retry, I only find this:

screenshot2

What confuses me most is that it only happens with several tests: when I attach .only to a test, for some it happens, for some it doesn't. Couldn't find a difference between those tests though: I even copy&pasted the content of some test from a non-failing one to a failing one (replace the failing one), and it still failed. Very strange.

Upvotes: 0

Views: 2826

Answers (1)

Jonas
Jonas

Reputation: 21

This can be caused by having two tests of the same name when one of them is set as test.only

It seem there is an issue opened for this in playwright. https://github.com/microsoft/playwright/issues/14034

Upvotes: 2

Related Questions