Skip to content

Commit 61ad69e

Browse files
authored
fix: report not valid browser names as error (#3)
1 parent 2ecae21 commit 61ad69e

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

README.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ pip install pytest-playwright
2323
Basic example for more see the [examples sections](#examples) as a reference.
2424

2525
```py
26-
def test_is_chromium(page):
27-
page.goto("https://www.google.com")
28-
page.type("input[name=q]", "Playwright GitHub")
29-
page.click("input[type=submit]")
30-
page.waitForSelector("text=microsoft/Playwright")
26+
def test_example_is_working(page):
27+
page.goto("https://example.com")
28+
page.waitForSelector("text=Example Domain")
29+
page.click("text=More information")
3130
```
3231

3332
## Fixtures
@@ -80,8 +79,8 @@ By default, the tests run in headless mode. You can pass the `--headful` CLI fla
8079
import pytest
8180

8281
@pytest.mark.skip_browser("firefox")
83-
def test_is_chromium(page):
84-
page.goto("https://www.google.com")
82+
def test_visit_example(page):
83+
page.goto("https://example.com")
8584
# ...
8685
```
8786

@@ -91,8 +90,8 @@ def test_is_chromium(page):
9190
import pytest
9291

9392
@pytest.mark.only_browser("chromium")
94-
def test_is_chromium(page):
95-
page.goto("https://www.google.com")
93+
def test_visit_example(page):
94+
page.goto("https://example.com")
9695
# ...
9796
```
9897

@@ -101,7 +100,7 @@ def test_is_chromium(page):
101100
Start Pytest with the `base-url` argument. Example: `pytest --base-url http://localhost:8080`
102101

103102
```py
104-
def test_is_chromium(page):
103+
def test_visit_example(page):
105104
page.goto("/admin")
106105
# -> Will result in http://localhost:8080/admin
107106
```
@@ -111,7 +110,7 @@ def test_is_chromium(page):
111110
```py
112111
from playwright.sync_api import Page
113112

114-
def test_my_test(page: Page):
113+
def test_visit_admin_dashboard(page: Page):
115114
page.goto("/admin")
116115
# ...
117116
```
@@ -132,4 +131,4 @@ provided by the bot. You will only need to do this once across all repos using o
132131

133132
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
134133
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
135-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
134+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
url="https://github.com/microsoft/playwright-pytest",
1414
packages=["pytest_playwright"],
1515
include_package_data=True,
16-
install_requires=["playwright==0.0.4", "pytest", "pytest-base-url"],
16+
install_requires=["playwright>=0.0.4", "pytest", "pytest-base-url"],
1717
entry_points={"pytest11": ["playwright = pytest_playwright.pytest_playwright"]},
1818
classifiers=[
1919
"Programming Language :: Python :: 3",

tests/test_playwright.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def test_base_url(page, base_url):
115115
assert base_url == "https://example.com"
116116
page.goto("/foobar")
117117
assert page.url == "https://example.com/foobar"
118-
page.goto("https://www.google.com")
119-
assert page.url == "https://www.google.com/"
118+
page.goto("http://whatsmyuseragent.org")
119+
assert page.url == "http://whatsmyuseragent.org/"
120120
"""
121121
)
122122
result = testdir.runpytest("--base-url", "https://example.com")

0 commit comments

Comments
 (0)