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