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