vercel / turbo

Incremental bundler and build system optimized for JavaScript and TypeScript, written in Rust – including Turbopack and Turborepo.
https://turbo.build
MIT License
25.53k stars 1.74k forks source link

Docs: Turborepo 2.0 and playwright docker container #8386

Open citypaul opened 3 weeks ago

citypaul commented 3 weeks ago

What is the improvement or update you wish to see?

I'm just adding this here so people can find it on Google, because my Playwright docker container started failing when I tried to upgrade to turborepo 2.0.

For those who are experiencing this issue:

  1) [chromium] › login.spec.ts:6:5 › user can login with correct details ──────────────────────────

    Error: browserType.launch: Executable doesn't exist at /github/home/.cache/ms-playwright/chromium-1117/chrome-linux/chrome
    ╔═════════════════════════════════════════════════════════════════════════╗
    ║ Looks like Playwright Test or Playwright was just installed or updated. ║
    ║ Please run the following command to download new browsers:              ║
    ║                                                                         ║
    ║     pnpm exec playwright install                                        ║
    ║                                                                         ║
    ║ <3 Playwright Team                                                      ║
    ╚═════════════════════════════════════════════════════════════════════════╝

When running with a setup using the playwright docker container (in my instance, running with mcr.microsoft.com/playwright:v1.44.1-jammy), the solution was to add:

PLAYWRIGHT_BROWSERS_PATH to globalEnv in your turbo.json file.

I'm not sure this needs to be added to the docs specifically or not, but I figured making a post here would make it easier for people who are googling to find a solution to the same issue.

Is there any context that might help us understand?

I'm just adding the above to make this issue googleable. If this isn't the right place, please let me know and I'll move it.

Does the docs page already exist? Please link to it.

No response

anthonyshew commented 3 weeks ago

Quick note: globalEnv will cause cache misses for all tasks when PLAYWRIGHT_BROWSERS_PATH changes. You might want to use the task's env or passThroughEnv instead.

Additional context: There's a Playwright doc that still needs to be written that will include this information. Thanks for putting the fix you found into the open for now. 🙌

citypaul commented 3 weeks ago

@anthonyshew ah, thanks for that, I'll update my own setup accordingly :)

taylorfsteele commented 1 week ago

@citypaul @anthonyshew Just ran into this and was able to fix this pretty quickly thanks to your posts here. For anyone else, all I had to do was add the PLAYWRIGHT_BROWSERS_PATH to the env of the task, just like @anthonyshew said.

    "test:playwright": {
      "dependsOn": ["build"],
      "env": ["PLAYWRIGHT_BROWSERS_PATH"]
    }

Thank you!!