I have just installed playwright (v1.18.1) to try it out (Windows 11) and I feel like something is wrong. I can run the example.spec.ts script fine, but if I copy that file and then try to run the copy then I get a no tests found.
error.
The steps seem very basic...
First test run the C:\playwright\test\tests\example.spec.ts script....
C:\playwright\test\tests>npx playwright test example.spec.ts
Running 25 tests using 1 worker
- example.spec.ts:14:3 › New Todo › should allow me to add todo items
Terminate batch job (Y/N)?
25 skipped
[that worked so] then create a copy to start playing...
C:\playwright\test\tests>copy example.spec.ts test4.ts
1 file(s) copied.
but before editing test4.ts I check it will run...
C:\playwright\test\tests>npx playwright test test4.ts
=================
no tests found.
=================
npm ERR! code 1
npm ERR! path C:\playwright\test\tests
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c playwright test test4.ts
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxxxx\AppData\Local\npm-cache\_logs\2022-02-09T16_29_19_723Z-debug.log
If it helps the log reads:
C:\playwright\test\tests>type C:\Users\xxxxx\AppData\Local\npm-cache\_logs\2022-02-09T16_37_46_149Z-debug.log
0 verbose cli [
0 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli 'exec',
0 verbose cli '--',
0 verbose cli 'playwright',
0 verbose cli '-version'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 1ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:C:\playwright\test\.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\xxxxx\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\xxxxx\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session c0bee43e8701d230
20 timing npm:load Completed in 16ms
21 timing command:exec Completed in 633ms
22 verbose stack Error: command failed
22 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
22 verbose stack at ChildProcess.emit (node:events:376:20)
22 verbose stack at maybeClose (node:internal/child_process:1063:16)
22 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose pkgid [email protected]
24 verbose cwd C:\playwright\test\tests
25 verbose Windows_NT 10.0.22000
26 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "exec" "--" "playwright" "-version"
27 verbose node v15.4.0
28 verbose npm v7.0.15
29 error code 1
30 error path C:\playwright\test\tests
31 error command failed
32 error command C:\WINDOWS\system32\cmd.exe /d /s /c playwright -version
33 verbose exit 1
Why is it giving me an error when it is just a copy of an original that does work?
test4.ts
totest4.spec.ts
- but what if I don't want this? – ScheidertestDir
is set to the folder where you're storing your tests (as it may vary according to your needs and the default configuration playwright provides). It doesn't matter if you fully reference the test you want to execute, it'll anyway fail because of that. – Connally