-
Notifications
You must be signed in to change notification settings - Fork 1k
tests: added keyboard tests #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,12 @@ | |
from playwright import async_playwright | ||
|
||
|
||
# Will mark all the tests as async | ||
def pytest_collection_modifyitems(items): | ||
for item in items: | ||
item.add_marker(pytest.mark.asyncio) | ||
|
||
Comment on lines
+21
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain to me why this is needed? (I'm new to async in Python.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before it was in the global This specific piece added asyncio support to the tests which was before available in all the tests. But since we split async and sync I limited the scope of it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! So async tests need to be explicitly (or programmatically) marked as async for pytest to run them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly with: https://github.com/pytest-dev/pytest-asyncio You can do it manually with the decorator per test or in our case just for all the tests in that directory. |
||
|
||
@pytest.fixture(scope="session") | ||
async def playwright(): | ||
async with async_playwright() as playwright_object: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ async def test_headless_should_be_able_to_read_cookies_written_by_headful( | |
): | ||
if is_chromium and is_win: | ||
pytest.skip("see https://github.com/microsoft/playwright/issues/717") | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to add the return in the two cookie tests from yesterday. Good catch! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I'm not sure if we need it! It was flaky so I added it. But seems like its not needed: https://www.programcreek.com/python/example/25423/pytest.skip There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✨ Magic! |
||
# Write a cookie in headful chrome | ||
headful_context = await browser_type.launchPersistentContext( | ||
tmpdir, **{**launch_arguments, "headless": False} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm so happy porting tests reveal this.