Initial code to transition tests to dash[testing] from pytest-dash.

Note, tests are skipped and don't yet work with dash[testing] - this is to allow for CI builds to pass
remotes/upstream/doubtfire
derekpierre 2019-09-11 15:20:46 -04:00 committed by Kieran R. Prasch
parent c6814ec996
commit 7daedf4bf6
4 changed files with 18 additions and 20 deletions

View File

@ -58,7 +58,6 @@ sphinx = "*"
recommonmark = "*"
sphinx_rtd_theme = "*"
aafigure = "*"
pytest-dash = "*"
[scripts]
install-solc = "scripts/installation/install_solc.sh"

View File

@ -2,4 +2,5 @@
addopts = -v --runslow --junitxml=./reports/pytest-results.xml --strict-markers --durations=0 --cov=nucypher --cov-report xml:reports/coverage.xml
markers =
slow: marks tests as slow (skipped by default, use '--runslow' to include these tests)
webdriver = Chrome

View File

@ -128,8 +128,8 @@ def pytest_collection_modifyitems(config, items):
GlobalLoggerSettings.start_json_file_logging()
# pytest-dash selenium hook
def pytest_setup_selenium(driver_name):
# dash[testing] hook
def pytest_setup_options():
options = Options()
options.add_argument('--window-size=1920,1080') # required to make elements visible to selenium
options.add_argument('--start-maximized')

View File

@ -1,13 +1,12 @@
import pytest
from flask import Flask
from pytest_dash import wait_for
from nucypher.config.characters import UrsulaConfiguration
from nucypher.network.status.status_page import UrsulaStatusPage
# TODO: Current issue: https://github.com/InstaPy/instapy-quickstart/issues/63
@pytest.mark.skip("Issues with compatibility with latest Chrome version")
def test_render_lonely_ursula_status_page(tmpdir, dash_threaded):
def test_render_lonely_ursula_status_page(dash_duo):
ursula_config = UrsulaConfiguration(dev_mode=True, federated_only=True)
ursula = ursula_config()
@ -17,16 +16,15 @@ def test_render_lonely_ursula_status_page(tmpdir, dash_threaded):
flask_server=server,
route_url='/')
dash_threaded(status_page.dash_app, start_timeout=30)
dash_driver = dash_threaded.driver
dash_duo.start_server(status_page.dash_app)
title = dash_driver.find_element_by_id("status-title").text
title = dash_duo.find_element_by_id("status-title").text
assert title == ursula.nickname
# TODO: Current issue: https://github.com/InstaPy/instapy-quickstart/issues/63
@pytest.mark.skip("Issues with compatibility with latest Chrome version")
def test_render_ursula_status_page_with_known_nodes(tmpdir, federated_ursulas, dash_threaded):
def test_render_ursula_status_page_with_known_nodes(federated_ursulas, dash_duo):
ursula_config = UrsulaConfiguration(dev_mode=True, federated_only=True, known_nodes=federated_ursulas)
ursula = ursula_config()
@ -35,16 +33,16 @@ def test_render_ursula_status_page_with_known_nodes(tmpdir, federated_ursulas, d
title=ursula.nickname,
flask_server=server,
route_url='/')
dash_threaded(status_page.dash_app, start_timeout=30)
dash_driver = dash_threaded.driver
title = dash_driver.find_element_by_id("status-title").text
dash_duo.start_server(status_page.dash_app)
title = dash_duo.find_element_by_id("status-title").text
assert title == ursula.nickname
node_table = wait_for.wait_for_element_by_id(dash_driver, 'node-table', 10) # wait for maximum 10s
node_table_info = node_table.get_attribute('innerHTML')
# Every known nodes address is rendered
for known_ursula in federated_ursulas:
assert known_ursula.checksum_address[:10] in node_table_info
assert known_ursula.nickname in node_table_info
assert known_ursula.rest_url() in node_table_info
# TODO: fix ui testing to use dash[testing]
# node_table = dash_duo.wait_for_element_by_id(dash_driver, 'node-table', 10) # wait for maximum 10s
# node_table_info = node_table.get_attribute('innerHTML')
#
# # Every known nodes address is rendered
# for known_ursula in federated_ursulas:
# assert known_ursula.checksum_address[:10] in node_table_info
# assert known_ursula.nickname in node_table_info
# assert known_ursula.rest_url() in node_table_info