Skip to content

Commit afcf39e

Browse files
authored
tests: added network tests and refactored test server (#44)
1 parent 050f785 commit afcf39e

File tree

21 files changed

+638
-61
lines changed

21 files changed

+638
-61
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# text files must be lf for golden file tests to work
2+
*.txt eol=lf
3+
*.json eol=lf

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ master ]
77
jobs:
88
build:
9+
timeout-minutes: 30
910
strategy:
1011
fail-fast: false
1112
matrix:
@@ -51,4 +52,4 @@ jobs:
5152
- name: Build package
5253
run: python build_package.py
5354
- name: Test
54-
run: pytest --browser=${{ matrix.browser }}
55+
run: pytest -vv --browser=${{ matrix.browser }}

playwright/serializers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from typing import List, Union
2-
from playwright.helper import FilePayload
3-
from os import path
2+
import os
43
import mimetypes
54
import base64
65

6+
from playwright.helper import FilePayload
7+
78

89
def normalize_file_payloads(
910
files: Union[str, FilePayload, List[Union[str, FilePayload]]]
@@ -18,7 +19,7 @@ def normalize_file_payloads(
1819
if isinstance(item, str):
1920
with open(item, mode="rb") as fd:
2021
file: FilePayload = {
21-
"name": path.basename(item),
22+
"name": os.path.basename(item),
2223
"mimeType": mimetypes.guess_type(item)[0]
2324
or "application/octet-stream",
2425
"buffer": base64.b64encode(fd.read()).decode(),

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
markers =
33
skip_browser
44
only_browser
5+
skip_platform
6+
only_platform
57
[mypy]
68
ignore_missing_imports = True
79
[flake8]

tests/assets/one-style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-color: pink;
3+
}

tests/assets/one-style.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<link rel='stylesheet' href='./one-style.css'>
2+
<div>hello, world!</div>

tests/assets/pptr.png

5.99 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
window.registrationPromise = navigator.serviceWorker.register('sw.js');
3+
</script>

tests/assets/serviceworkers/empty/sw.js

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-color: pink;
3+
}

0 commit comments

Comments
 (0)