1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 playwright,
6 playwright-driver,
7 pytest,
8 pytest-base-url,
9 python-slugify,
10 pythonOlder,
11 setuptools-scm,
12}:
13
14buildPythonPackage rec {
15 pname = "pytest-playwright";
16 version = "0.5.0";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "microsoft";
23 repo = "playwright-pytest";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-HS0Qpr5R4dAoXe0bpPGU7JABB7CmwugReRD75XeJ8l4=";
26 };
27
28 nativeBuildInputs = [ setuptools-scm ];
29
30 buildInputs = [ pytest ];
31
32 propagatedBuildInputs = [
33 playwright
34 pytest-base-url
35 python-slugify
36 ];
37
38 # Most of the tests rely on network access, or on unavailable browsers such as
39 # msedge, chrome or webkit
40 doCheck = false;
41
42 preCheck = ''
43 export PLAYWRIGHT_BROWSERS_PATH=${playwright-driver.browsers}
44 '';
45
46 pythonImportsCheck = [ "pytest_playwright" ];
47
48 meta = with lib; {
49 description = "Pytest plugin to write end-to-end browser tests with Playwright";
50 homepage = "https://github.com/microsoft/playwright-pytest";
51 changelog = "https://github.com/microsoft/playwright-pytest/releases/tag/v${version}";
52 license = licenses.asl20;
53 maintainers = with maintainers; [ sephi ];
54 };
55}