microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[Bug]: playwright.ps1 won't run on 1.43 #2917

Closed luizhcrocha closed 6 months ago

luizhcrocha commented 6 months ago

Version

1.43

Steps to reproduce

Example steps (replace with your own):

  1. run installation as in https://playwright.dev/dotnet/docs/intro
  2. try to run playwright.ps1, with or without deps
  3. You should see the error come up

Expected behavior

Brosers should install.

Actual behavior

pwsh bin/Debug/net8.0/playwright.ps1 install --with-deps
E:\Project\bin\Debug\net8.0\.playwright\package\lib\server\recorder\java.js:126
        return `assertThat(${subject}.${this._asLocator(action.selector, Is.EqualTo(inFrameLocator)}).${action.substring ? 'containsText' : 'hasText'}(${quote(action.text)}));`;
                                                                                              ^
SyntaxError: missing ) after argument list
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (E:\Github\wrike-integration\LawsuitManager.Downloader.Core\bin\Debug\net8.0\.playwright\package\lib\server\recorder.js:13:13)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)

Node.js v20.11.0

Additional context

No response

Environment

- Operating System: Windows 11
- CPU: x64
- Browser: All
- .NET Version (TFM): net8.0
- Other info:
mxschmitt commented 6 months ago

Looks like our source in your build directory got modified, it should be:

return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)}).${action.substring ? 'containsText' : 'hasText'}(${quote(action.text)});`;

but in your case its:

return `assertThat(${subject}.${this._asLocator(action.selector, Is.EqualTo(inFrameLocator)}).${action.substring ? 'containsText' : 'hasText'}(${quote(action.text)}));`;

Is.EqualTo looks like NUnit, maybe some NUnit analyser or something around that? Workaround might be: delete the bin directory and build the project again, maybe remove NUnit dependencies to see which one caused it.

luizhcrocha commented 6 months ago

Hi, @mxschmitt. Thank you for the help. I've downgraded to 1.42, ran the install script normally, then upgraded to 1.43. Coulnd't replicate it on the other machine, but I think this workaround is good enough for now.