Skip to content

Commit

Permalink
Add wait factor
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwdunham authored and sevein committed Oct 11, 2018
1 parent 4df180d commit 1519dc6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ RUN CD_VERSION=$(if [ ${CHROME_DRIVER_VERSION:-latest} = "latest" ]; then echo $
# Firefox
#

ARG FIREFOX_VERSION=latest
ARG FIREFOX_VERSION=62.0.3
RUN FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "latest" ] || [ $FIREFOX_VERSION = "nightly-latest" ] || [ $FIREFOX_VERSION = "devedition-latest" ]; then echo "https://download.mozilla.org/?product=firefox-$FIREFOX_VERSION-ssl&os=linux64&lang=en-US"; else echo "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2"; fi) \
&& apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install firefox \
Expand All @@ -79,7 +79,7 @@ RUN FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "latest" ] || [ $FIREFOX_VERS
&& mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
&& ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox

ARG GECKODRIVER_VERSION=latest
ARG GECKODRIVER_VERSION=0.23.0
RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo $(wget -qO- "https://api.github.com/repos/mozilla/geckodriver/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([0-9.]+)".*/\1/'); else echo $GECKODRIVER_VERSION; fi) \
&& echo "Using GeckoDriver version: "$GK_VERSION \
&& wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GK_VERSION/geckodriver-v$GK_VERSION-linux64.tar.gz \
Expand Down
16 changes: 9 additions & 7 deletions amuser/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,16 @@ def varvn(varname, vn):
# when using ``behave`` is to use Behave "user data" flags, e.g.,
# ``behave -D nihilistic_wait=30``.

WAIT_FACTOR = 4

# Generable, reusable wait times, in seconds
NIHILISTIC_WAIT = 20
APATHETIC_WAIT = 10
PESSIMISTIC_WAIT = 5
MEDIUM_WAIT = 3
OPTIMISTIC_WAIT = 1
QUICK_WAIT = 0.5
MICRO_WAIT = 0.25
NIHILISTIC_WAIT = WAIT_FACTOR * 20
APATHETIC_WAIT = WAIT_FACTOR * 10
PESSIMISTIC_WAIT = WAIT_FACTOR * 5
MEDIUM_WAIT = WAIT_FACTOR * 3
OPTIMISTIC_WAIT = WAIT_FACTOR * 1
QUICK_WAIT = WAIT_FACTOR * 0.5
MICRO_WAIT = WAIT_FACTOR * 0.25

# Use-case-specific maximum attempt counters
MAX_CLICK_TRANSFER_DIRECTORY_ATTEMPTS = 5
Expand Down
6 changes: 5 additions & 1 deletion amuser/selenium_ability.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
Expand Down Expand Up @@ -52,8 +53,11 @@ def get_driver(self):
options = webdriver.FirefoxOptions()
if headless:
options.add_argument('-headless')
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities["moz:webdriverClick"] = False
driver = webdriver.Firefox(firefox_profile=fp,
firefox_options=options)
firefox_options=options,
desired_capabilities=capabilities)
else:
driver = getattr(webdriver, self.driver_name)()
driver.set_script_timeout(self.apathetic_wait)
Expand Down
18 changes: 9 additions & 9 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
import os

import amuser
from amuser.constants import (
NIHILISTIC_WAIT,
APATHETIC_WAIT,
PESSIMISTIC_WAIT,
MEDIUM_WAIT,
OPTIMISTIC_WAIT,
QUICK_WAIT,
MICRO_WAIT,
)
import utils


Expand Down Expand Up @@ -38,15 +47,6 @@
SERVER_USER = 'vagrant'
SERVER_PASSWORD = 'vagrant'

# Generable, reusable wait times, in seconds
NIHILISTIC_WAIT = 20
APATHETIC_WAIT = 10
PESSIMISTIC_WAIT = 5
MEDIUM_WAIT = 3
OPTIMISTIC_WAIT = 1
QUICK_WAIT = 0.5
MICRO_WAIT = 0.25

# Use-case-specific maximum attempt counters
MAX_CLICK_TRANSFER_DIRECTORY_ATTEMPTS = 5
MAX_CLICK_AIP_DIRECTORY_ATTEMPTS = 5
Expand Down

0 comments on commit 1519dc6

Please sign in to comment.