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] Ajax testing with capybara #48

Open
wants to merge 3 commits into
base: ajax
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytest-cov==2.6.0
freezegun==0.3.11
coveralls==1.5.1
wheel==0.32.3
capybara-py==0.1.6
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from pathlib import Path

import capybara
import pytest

from trendlines import db
Expand All @@ -12,6 +13,8 @@
from trendlines.orm import DataPoint
from trendlines.orm import Metric

pytest_plugins = ["capybara.pytest_plugin"]


@pytest.fixture
def app():
Expand All @@ -30,6 +33,8 @@ def app():
pass

app = create_app()
capybara.app = app
capybara.default_max_wait_time = 5

# Since the `create_db` function modifies orm.db directly, we can simply
# call it here. I guess *technically* what's happening is whatever
Expand Down
6 changes: 6 additions & 0 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ def test_index(client):
assert rv.status_code == 200


@pytest.mark.xfail(reason="Need to figure out the AJAX testing.")
def test_index_with_data_(app, page, populated_db):
page.visit("/")
assert page.has_text("empty_metric")


@pytest.mark.xfail(reason="Need to figure out the AJAX testing.")
def test_index_with_data(client, populated_db):
rv = client.get('/')
Expand Down