-
Notifications
You must be signed in to change notification settings - Fork 316
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
WIP: tests for page waitForX methods #87
base: pup2.1.1
Are you sure you want to change the base?
Conversation
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 not sure why the source allows down to half of the timeout (eg timeout / 2
, polling /2
), I have a feeling it has to do with the intricacies of setTimeout. Anyways, in my testing we don't need to allow that, perf_counter_ms() - start >= timeout
(or polling
) works just fine and doesn't leave the reader of the code confused as to why the we're accepting down to half of what's expected
tests/test_waittask.py
Outdated
from asyncio import ensure_future | ||
import asyncio | ||
from time import time | ||
|
||
import pytest | ||
from syncer import sync | ||
|
||
from pyppeteer.errors import NetworkError, ElementHandleError, BrowserError |
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.
This is where the isort pre-commit hook would come in handy #82
NetworkError appears to be unused
# wait for xpath | ||
assert await p.waitFor('//div') | ||
# should not work for for single-slash xpaths | ||
await p.setContent("""<div>some text</div>""") |
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.
triple """
is needlessly verbose
tests/test_waittask.py
Outdated
async def test_waitfor_timeout(isolated_page, server): | ||
p = isolated_page | ||
# should time out | ||
# this fails because of issue with syncer |
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.
This times out b/c the test timeout value is set to 10s, after that we assume it's hanging
Co-authored-by: Mattwmaster58 <26337069+Mattwmaster58@users.noreply.github.com>
No description provided.