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

WIP: tests for page waitForX methods #87

Open
wants to merge 14 commits into
base: pup2.1.1
Choose a base branch
from
Open

Conversation

Granitosaurus
Copy link
Contributor

No description provided.

@Granitosaurus Granitosaurus changed the base branch from dev to pup2.1.1 April 20, 2020 04:42
Copy link
Member

@Mattwmaster58 Mattwmaster58 left a 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

Comment on lines 1 to 8
from asyncio import ensure_future
import asyncio
from time import time

import pytest
from syncer import sync

from pyppeteer.errors import NetworkError, ElementHandleError, BrowserError
Copy link
Member

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

tests/test_waittask.py Outdated Show resolved Hide resolved
# wait for xpath
assert await p.waitFor('//div')
# should not work for for single-slash xpaths
await p.setContent("""<div>some text</div>""")
Copy link
Member

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 Show resolved Hide resolved
async def test_waitfor_timeout(isolated_page, server):
p = isolated_page
# should time out
# this fails because of issue with syncer
Copy link
Member

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

tests/test_waittask.py Outdated Show resolved Hide resolved
tests/test_waittask.py Outdated Show resolved Hide resolved
tests/test_waittask.py Outdated Show resolved Hide resolved
tests/test_waittask.py Outdated Show resolved Hide resolved
tests/test_waittask.py Outdated Show resolved Hide resolved
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.

None yet

2 participants