Skip to content
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ env:
- "BROWSERSTACK_USERNAME=jiridanek1"
# BROWSERSTACK_ACCESS_KEY
- secure: "T5Wz7agc8sE8RZiwcMa9ndU5/YaFJqGrmvrhDOgJb7BQ5V4i6z9K+5VayESxn0HF52GX+y6vzSNqOZ5umNorETJAiaaejKfrF7dzcoB6QIx5qur1YA8nb0Tl1wfxieAOwOCSRn8Ybe2pNJ0cUTVTGMBsXyGwbPdBr4LIrPGayyv7a0YqL979zAgpN70VjCuUUZVWCo6QjsadRkS8oo6eBNDTOT6F1g58eRh5A1HW++mU7Bq3/JCoCw+dqGNoE4M/E0QT/6hHuWd5HHoJK5eyPWwXpjdYB1G4v1K8bAArgH4gOZSfbMjvYUj746ko7gCRZR3ctkK3qWeH5V7CPvENK3xBj47ui0+MqbV9KBKoW5S02DZ3rUA54PqNzCwUT2lWasUkMeLpkd8/Nk2nbdCJEz7c271oaDuDKv0ka5gb8eSmFJN4r1GwyVQdAj1Y0rNdYCwh+22mtFJSNQ42F+F9N7V19+qgRLNQUqY6yPQsARPsUBwrR8z638QXCoC8b8VBMZ4MY4qNRXlLFC+mRVxWD8r4LyXxVBSrJZMa9JB9JK9G7944gFlF8fKgzOW/8M80mn+OmvaXGK+AAyOBlFMQOut01lJEVCoIxMGh9eAGjbBgzxBMnOQCFcI8RRFd/2DrxVRjyj5OZ7JgRpPmTBtokGlYWgt22Gj90qKpip+7eFM="
- "IMAGE_TAG=11-47724c7c"
- "IMAGE_TAG=13-4dd8764b3"
matrix:
- "CONSOLE=hawtio DRIVER=Chrome PLATFORM=any BROWSER_NAME=any VERSION=any"
- "CONSOLE=hawtio DRIVER=Firefox PLATFORM=any BROWSER_NAME=firefox VERSION=any"
Expand Down
14 changes: 11 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# under the License.
#

from typing import Any, Dict

import pytest
from _pytest.fixtures import FixtureRequest
from selenium import webdriver
Expand All @@ -34,16 +36,22 @@ def pytest_addoption(parser):
help="type of console, either hawtio or stand-alone")


@pytest.fixture(scope='session')
def session_capabilities(session_capabilities: Dict[str, Any]):
if 'browserName' in session_capabilities and session_capabilities['browserName'] == 'internet explorer':
session_capabilities['ie.ensureCleanSession'] = True
return session_capabilities


@pytest.fixture
def selenium(request: FixtureRequest) -> webdriver.Remote:
if request.config.getoption('--local-chrome'):
driver = initialize_local_chrome()
request.addfinalizer(lambda: deinitialize_selenium(driver))
return driver

driver = request.getfixturevalue('selenium') # type: webdriver.Remote
yield driver
# https://github.com/SeleniumHQ/docker-selenium/issues/87#issuecomment-286231268
driver.close()
return driver


@pytest.fixture(scope="module")
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
#

ipython
pytest-selenium==1.9.1
pytest-xdist==1.15
pytest-selenium==1.11.0
12 changes: 6 additions & 6 deletions webdriver/page_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from unittest.mock import Mock

import pytest
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, WebDriverException
from typing import Type, List

from selenium import webdriver
Expand All @@ -40,7 +40,7 @@ def __init__(self, selenium: webdriver.Remote):
self.selenium = selenium

def wait_locate_visible_element(self, locator) -> WebElement:
timeout = 10
timeout = 20
return WebDriverWait(self.selenium, timeout).until(EC.presence_of_element_located(locator))

def wait_for_frameworks(self):
Expand Down Expand Up @@ -93,12 +93,11 @@ def wait_for_frameworks(self):
return false;
}
"""
self.wait_for(lambda: self.selenium.execute_script(script))
self.wait_for(lambda: self.selenium.execute_script(script), timeout=20)
self.wait_for_angular()

@staticmethod
def wait_for(condition):
timeout = 10
def wait_for(condition, timeout=10):
t = 0
d = 0.3
while True:
Expand Down Expand Up @@ -217,6 +216,7 @@ def expand_tree(self, node_count):
def loop():
self.wait_for_frameworks()
for expander in self.expanders: # type: WebElement
_ = expander.location_once_scrolled_into_view # this is supposed to scroll the element into view
node = self.retry_on_exception(NoSuchElementException, lambda: expander.find_element(By.XPATH, './..'))
if self.is_expanded(node):
continue
Expand Down Expand Up @@ -244,7 +244,7 @@ def expanders(self) -> List[WebElement]:
def expanded_nodes(self) -> List[WebElement]:
return self.selenium.find_elements(By.CSS_SELECTOR, '.dynatree-node.dynatree-expanded')

def retry_on_exception(self, exception, test_function, retries=50):
def retry_on_exception(self, exception, test_function, retries=100):
for _ in range(retries):
try:
return test_function()
Expand Down