Skip to content
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

tests: added keyboard tests #146

Merged
merged 1 commit into from
Aug 5, 2020
Merged

Conversation

mxschmitt
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Aug 5, 2020

Pull Request Test Coverage Report for Build 196497422

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 89.901%

Totals Coverage Status
Change from base Build 196428812: 0.2%
Covered Lines: 3632
Relevant Lines: 4040

💛 - Coveralls

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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!

Copy link
Member Author

Choose a reason for hiding this comment

The 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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ Magic!

Comment on lines +21 to +24
def pytest_collection_modifyitems(items):
for item in items:
item.add_marker(pytest.mark.asyncio)

Copy link
Member

Choose a reason for hiding this comment

The 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.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before it was in the global conftest.py. A conftest.py will be executed through the directory three and by that they can overwrite each other (which is nearest to the actual test).

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.

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

@@ -151,7 +151,7 @@ async def type(
timeout: int = None,
noWaitAfter: bool = None,
) -> None:
await self._channel.send("text", locals_to_params(locals()))
await self._channel.send("type", locals_to_params(locals()))
Copy link
Member

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.

@mxschmitt mxschmitt merged commit d913f1d into microsoft:master Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants