about summary refs log tree commit diff
path: root/pkgs/development/web/playwright-test/wrapped.nix
blob: 1557b80765f72d2400387f8b15c9d25f9cd7a3f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ lib
, callPackage
, buildNpmPackage
, fetchurl
, python3
, playwright-driver
, makeWrapper
}:
let
  driver = playwright-driver;
  browsers = playwright-driver.browsers;


  # nodeDependencies / package / shell
  playwright-test-raw = (callPackage ./default.nix { })."@playwright/test-${driver.version}";

  playwright-test = playwright-test-raw.overrideAttrs (oa: {
    nativeBuildInputs = oa.nativeBuildInputs or [ ] ++ [
      makeWrapper
    ];
    postInstall = ''
      # you need to set both the path and version else playwright looks into the wrong one
      wrapProgram $out/bin/playwright \
          --set-default PLAYWRIGHT_BROWSERS_PATH "${browsers}" \
          --prefix NODE_PATH : ${placeholder "out"}/lib/node_modules
    '';
  });
in
  playwright-test