Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pwt): compatibility in CWD with wrong casing #16636

Merged
merged 2 commits into from Aug 22, 2022

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Aug 18, 2022

Fixes #16347
Fixes #9193

This bug only affects PowerShell 5.X and 6.X experience, when using PowerShell 7.X its not possible anymore to enter a directory with incorrect casing. PowerShell/PowerShell#9250 was fixing it upstream - this patch workarounds it and normalizes paths before requiring them.

@mxschmitt mxschmitt force-pushed the mxschmitt/fix-windows-cwd-casing branch from 51fbb9f to bb062f7 Compare August 18, 2022 12:46
@mxschmitt mxschmitt changed the title fix(pwt): use pwt in cwd which is different to real cwd fix(pwt): compatibility in CWD with wrong casing Aug 18, 2022
@mxschmitt mxschmitt marked this pull request as ready for review August 18, 2022 12:47
@mxschmitt mxschmitt force-pushed the mxschmitt/fix-windows-cwd-casing branch from bb062f7 to ee6d28f Compare August 18, 2022 13:12
@@ -27,7 +27,7 @@ const config: PlaywrightTestConfig = {
timeout: 5 * 60 * 1000,
retries: 0,
reporter: process.env.CI ? [
['dot'],
['list'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only have a small number of long running tests, so list is better there.

@mxschmitt mxschmitt force-pushed the mxschmitt/fix-windows-cwd-casing branch from ee6d28f to 77884e2 Compare August 18, 2022 13:20
@mxschmitt mxschmitt force-pushed the mxschmitt/fix-windows-cwd-casing branch from 1fe567f to c080a45 Compare August 18, 2022 17:55
@pavelfeldman
Copy link
Member

I'm still fuzzy on what it going on here.

@mxschmitt
Copy link
Member Author

Abstract problem: @playwright\test\src\globals.ts gets loaded two times:

  • expectedcasing\node_modules@playwright\test\src\globals.ts (2) (from pwt worker)
  • eXpEcTeDcAsInG\node_modules@playwright\test\src\globals.ts (1) (from test inside worker)

this ends up that the state inside is different, since these are different instances.

  1. gets loaded NPX -> pw-core CLI -> PWT CLI -> Worker-> globals.ts - that this one has the expected casing, which is good.

  2. gets loaded from inside the test, since we load the test with an absolute path, which is different to what the 1) base path is in terms of casing, we end up loading the globals inside the runner two times.

e.g. C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-incorrect-cwd-casing-installation-tests\eXpEcTeDcAsInG\sample.spec.js

to it, so @playwright\test\src\globals.ts resolved into eXpEcTeDcAsInG.


1): setCurrentlyLoadingFileSuite

 itest:exec:stdout Error:
  itest:exec:stdout     at setCurrentlyLoadingFileSuite (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-
should-handle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\globals.ts:30:15)
  itest:exec:stdout     at Loader.loadTestFile (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-ha
ndle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\loader.ts:180:5)
  itest:exec:stdout     at Runner._run (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-inc
orrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\runner.ts:282:44)
  itest:exec:stdout     at TimeoutRunner.run (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-hand
le-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\playwright-core\lib\utils\timeoutRunner.js:53:14)
  itest:exec:stdout     at raceAgainstTimeout (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-han
dle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\playwright-core\lib\utils\timeoutRunner.js:113:15)
  itest:exec:stdout     at Runner.runAllTests (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-han
dle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\runner.ts:190:20)
  itest:exec:stdout     at runTests (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-incorr
ect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\cli.ts:163:18)
  itest:exec:stdout     at Gi.<anonymous> (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-
incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\cli.ts:65:7)
  itest:exec:stdout  +3s
  itest:exec:stdout requireOrImport: C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-incorr
ect-cwd-casing-installation-tests\eXpEcTeDcAsInG\sample.spec.js
  itest:exec:stdout  +0ms

2): currentlyLoadingFileSuite

  itest:exec:stdout Error:
  itest:exec:stdout     at currentlyLoadingFileSuite (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-sho
uld-handle-incorrect-cwd-casing-installation-tests\eXpEcTeDcAsInG\node_modules\@playwright\test\src\globals.ts:34:15)
  itest:exec:stdout     at TestTypeImpl._ensureCurrentSuite (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-t
est-should-handle-incorrect-cwd-casing-installation-tests\eXpEcTeDcAsInG\node_modules\@playwright\test\src\testType.ts:69:19)
  itest:exec:stdout     at TestTypeImpl._createTest (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-shou
ld-handle-incorrect-cwd-casing-installation-tests\eXpEcTeDcAsInG\node_modules\@playwright\test\src\testType.ts:85:24)
  itest:exec:stdout     at C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-handle-incorrect-cwd-ca
sing-installation-tests\eXpEcTeDcAsInG\node_modules\@playwright\test\src\transform.ts:244:12
  itest:exec:stdout     at Object.<anonymous> (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-han
dle-incorrect-cwd-casing-installation-tests\eXpEcTeDcAsInG\sample.spec.js:8:1)
  itest:exec:stdout     at Module._compile (node:internal/modules/cjs/loader:1103:14)
  itest:exec:stdout     at Module.A._compile (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-hand
le-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\lib\utilsBundleImpl.js:16:994)
  itest:exec:stdout     at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
  itest:exec:stdout     at Object.t.<computed>.tu._extensions.<computed> [as .js] (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-
cwd-ca-88ebc-ywright-test-should-handle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\lib\utilsBundleImpl.js:16:1010)
  itest:exec:stdout     at Module.load (node:internal/modules/cjs/loader:981:32)
  itest:exec:stdout     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
  itest:exec:stdout     at Module.require (node:internal/modules/cjs/loader:1005:19)
  itest:exec:stdout     at require (node:internal/modules/cjs/helpers:102:18)
  itest:exec:stdout     at Loader._requireOrImport (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-shoul
d-handle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\loader.ts:305:14)
  itest:exec:stdout     at Loader.loadTestFile (C:\Users\maxschmitt\AppData\Local\Temp\pwt\workspaces\playwright-test-should-handle-incorrect-cwd-ca-88ebc-ywright-test-should-ha
ndle-incorrect-cwd-casing-installation-tests\expectedcasing\node_modules\@playwright\test\src\loader.ts:182:18)
  itest:exec:stdout  +648ms

@mxschmitt mxschmitt merged commit e344fe6 into microsoft:main Aug 22, 2022
pavelfeldman added a commit to pavelfeldman/playwright that referenced this pull request Sep 27, 2022
pavelfeldman added a commit to pavelfeldman/playwright that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants