cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.49k stars 339 forks source link

Support playwright #1540

Open bbigras opened 1 month ago

bbigras commented 1 month ago

Playwright support would be nice.

Currently I'm using:

  inputs = {
    nix-playwright-browsers.url = "github:voidus/nix-playwright-browsers";
    nix-playwright-browsers.inputs = { nixpkgs.follows = "nixpkgs"; };
  };

# [...]
devenv.shells.default =
          let
            browsers = nix-playwright-browsers.packages.${system}.playwright-browsers_v1_47_0;
          in
          {
            packages = with pkgs; [
              playwright-driver.browsers
            ];

            env = {
              PLAYWRIGHT_NODEJS_PATH = "${pkgs.nodejs}/bin/node";
              PLAYWRIGHT_BROWSERS_PATH = "${(browsers)}";
              PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1;
              PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = 1;
            };
rvveber commented 1 month ago

You shouldn't need this complicated arrangement.

Remove playwright from your packages.json And simply do this:

  packages = with pkgs; [
    playwright-test
    playwright-driver
  ];

And you have playwright installed with browsers. Just execute playwright test in the same directory where you would execute the npx script

domenkozar commented 5 days ago

I'm happy to accept a PR.