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,
12 setuptools-scm,
13}:
14
15buildPythonPackage rec {
16 pname = "pytest-playwright";
17 version = "0.7.1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "microsoft";
24 repo = "playwright-pytest";
25 tag = "v${version}";
26 hash = "sha256-5QkqOTS8+wMMJ3U8oKX9aQ6hwIChCYNojLqWpZVluXw=";
27 };
28
29 postPatch = ''
30 pushd pytest-playwright
31
32 substituteInPlace pyproject.toml --replace-fail "==" ">="
33 '';
34
35 build-system = [
36 setuptools
37 setuptools-scm
38 ];
39
40 buildInputs = [ pytest ];
41
42 dependencies = [
43 playwright
44 pytest-base-url
45 python-slugify
46 ];
47
48 # Most of the tests rely on network access, or on unavailable browsers such as
49 # msedge, chrome or webkit
50 doCheck = false;
51
52 preCheck = ''
53 popd
54 export PLAYWRIGHT_BROWSERS_PATH=${playwright-driver.browsers}
55 '';
56
57 pythonImportsCheck = [ "pytest_playwright" ];
58
59 meta = with lib; {
60 description = "Pytest plugin to write end-to-end browser tests with Playwright";
61 homepage = "https://github.com/microsoft/playwright-pytest";
62 changelog = "https://github.com/microsoft/playwright-pytest/releases/tag/${src.tag}";
63 license = licenses.asl20;
64 maintainers = with maintainers; [ sephi ];
65 };
66}