Browse Source

Merge branch 'feature/selenium' into develop

pull/1358/head
Safihre 5 years ago
parent
commit
c08dd7bdee
  1. 1
      .gitignore
  2. 18
      .travis.yml
  3. 1
      appveyor.yml
  4. 4
      sabnzbd/utils/happyeyeballs.py
  5. 2
      tests/conftest.py
  6. 1
      tests/test_functional_config.py
  7. 2
      tests/test_functional_downloads.py
  8. 6
      tests/test_functional_misc.py
  9. 2
      tests/test_getipaddress.py
  10. 2
      tests/test_misc.py
  11. 3
      tests/test_newsunpack.py
  12. 1
      tests/test_utils/test_cert_gen.py
  13. 2
      tests/test_utils/test_diskspeed.py
  14. 3
      tests/test_win_utils.py
  15. 24
      tests/testhelper.py

1
.gitignore

@ -1,5 +1,6 @@
# Compiled python
*.py[cod]
__pycache__
# Working folders for Win build
build/

18
.travis.yml

@ -6,32 +6,29 @@ env:
- secure: Cryq31K8wxt+q212/q7IHlLf4flH4riaiHssxR0/VfGACtMp3jOAVZ5RAOvX03LPYp+BuX2KAHFXDHeGHGzYmESkpzPCToZ3GpaOwP3ymc3RNeU6bd98yEQyQtM/wtY4uxPUWdwz5Uw5kkeynxw3y/QFsYceipB3u3oCvfB9n8SqWShjWpBFyFhSKS/SJjUqgNcAaA0pTP8l/crquZNhkug/J8Nlc/nC0H6ZSJKGu8UhkhZ0VSEY8dofZZkGG6YCIIEAqGasQqkra6x/D0uECfQnnDrTqekvklUG31/zy+awQXl+0NjLTIKyl2rHp5AUpSTlbPO2mDYdbWEWcRYmNsEEiGfvy3R9kGGbNijB5b57jvgsJapH8DkGRWseISdCBWqLH7C/OafNuMGzQ4s3UCN1aazqqN/IAJplVjSWiKA76Nbh385x88E8RaH7Gnvx1ZK88Lgf7Bz8Ar/O1dMviyP8WbM/vQQkVMdOk89y5O6G8ZwHFoj/v8w383irWMN2iU0Mf7GKW91ughpKrrKbXCmkT1bR9+tNYpKWU1O+1jgnGk65149GNC0K+9exWt0TK3pNSUa7b2nVzxeAqdCJjCoKBi2pLiRxYVI50V80M2p5Xw+5iiSiOhTLzFLT3YRi2VBjjBFa8BHJHBS9Pua4DaFc1w06XNej6K8rRV5We0s=
- secure: O/8jVULQmqOLHkvIW21IsVuL7/B+3MhgRFaT4wltxk/x7TarEsQyahXdStsQ+I53mMRbSfsArdCHXwgIm13wROXfcEdt7iM0f2tGWUsm32q73RrjBsKzb8SRTKZNkL1dOjpgkdEHejZdVckKlg0GlpJTTowOdfi+SYinj4Hj52vrV9waHk296njKw98W5Y35lEtSH3DcAU2NHrDi7YqQvjiBzj9MviG1qpJZJ1RMxKrTXXCqjlYcxr8FwO2kGpMnkTFIDywi4OspLQ1InEGhM9MdrY9tqGVzW631nX1uRV8aNhl+bLhtRs0i3QtOisWMWO5z5SQN6pOqUWx3nnwLPJzuoL+wGMDC2tdVRmH1+cuYCwq97curNq4hv9FBs7P/RS4e22WAoW0jtLWnx/5voVes1EsQE5iW/iG0z4ih3MIk3dHN6h8HcNr83DRxOW8JKmA79IbtcVFReZJ2AXQhx6VmvdUaIi3IKpW79K89ZzEuoEEO5Eyti2LLz9rti0iVknHejGYKWDCABflGaKjnj62tpUsAB9EsPPuwBegoKRd2bVy3kJ+RWGcMc4QfzsEq39z2ftQ8XJ800ZuuQvl7nsk86Dso+Hgr/T+5xU2wU6vFbwoDCWsxdnK2LXNpf3ci5PBZFhG9zLMRk+yFyAfh8OdQr19lxclay0X6na1K8i0=
addons:
chrome: stable
matrix:
include:
- os: linux
language: python
python: "3.5"
addons:
chrome: stable
- os: linux
language: python
python: "3.6"
addons:
chrome: stable
- os: linux
language: python
dist: "xenial"
python: "3.7"
addons:
chrome: stable
- os: linux
language: python
python: "3.8"
- os: osx
env:
- HOMEBREW_NO_AUTO_UPDATE=1
- secure: iMXx74c2eUhDPJrukvAFxCFNWYDk8JB2alQ89Hc3T1ckXfDS37vgUplTze1aGo+AefUkDSFmTreFk9hVJvd4SQTHz4wS+qp7HQJFWECjR16jZwobIbukNPNU1JamozZoOa2igoVIJ8/tVIdIpfcsGfzj9WogwUlpChWHIiI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qpNJ2sJTukeHT9z5yhkBEXHe9PatT0hiXZ7AxHsgX292k9Ti4se3pPxETkbR3r8iOklItMu1PViQsvfRyOFu+XloqMaPO31z48LmcPOps+/DYkbRyaTqBMdmPPRJghZ9lzvno=
- secure: RsFCZq/1Q6/++mgCZB6WsnIcbBsBwHFn6nfwC+vAomxbPtHevdiC930eIn8jKDza6Vmd4LoaMklvNOBEK1QpphbZXhKZIecakZOb+KyHVanSbQwErZCuVQdEo2p8cHJfuEh3guxmkE2OjAiBnSsgHlLmGiLAUF5GW5NPDLASPXIxXbBKOIKv7sTWj6tYYfVdUs1pQVz3Z+MkhRoS2uhVBOvQ14axtAtil1WmhgEJzuHAvjW29b1Q6l2goIuqoglqwKSna437CCt6mMFt6IVQqi36/lwXw0cYCLyJq3PURGDce6FdeQlwW0YfOXwT9k6BH+HcNuYmCSAbuL5hqC994avYbpemsBKKGfBK0Q8xZe0lQpS+R1C+iF3XXnPLU8B5TtALiBcFVRd3s291mxigxYqjkXbkgwVNAgkXKze+MhvrEQgoQwwhU3SbnmrZN8U6wW58MDYzjDxPaZdE5tUI+ROkfWeMRqtQrGNSJX6AwjkCrurW1/n0DXMlsUFnq4WGWF9nk8aHVzD8Y0cetQ+tLj3HxuxNqmAquewn+Z7pL41YTHlSTZ9+nHhI0GLQem6ANWL/4xJO8nBeOUETv1nULgbMyNOVaS9yBA7b2omE+Zuf8CMRCr9ID+Eeqtx1cUSMkWRymTdZvyPFPLjQ9KASTc7aCM7Cfc0aBceOoOOxMRw=
addons:
chrome: stable
install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
@ -80,4 +77,5 @@ script:
notifications:
email:
on_success: never
on_failure: always
on_cancel: never
on_failure: change

1
appveyor.yml

@ -11,6 +11,7 @@ environment:
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"
- PYTHON: "C:\\Python38-x64"
install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

4
sabnzbd/utils/happyeyeballs.py

@ -117,9 +117,7 @@ def happyeyeballs(HOST, **kwargs):
if DEBUG:
logging.debug("IPv6 address found for %s", HOST)
if preferipv6:
ipv4delay = (
0.1
) # preferipv6, AND at least one IPv6 found, so give IPv4 (!) a delay so that IPv6 has a head start and is preferred
ipv4delay = 0.1 # preferipv6, AND at least one IPv6 found, so give IPv4 (!) a delay so that IPv6 has a head start and is preferred
except:
if DEBUG:
logging.debug("No IPv6 address found for %s", HOST)

2
tests/conftest.py

@ -19,9 +19,9 @@
tests.conftest - Setup pytest fixtures
These have to be separate otherwise SABnzbd is started multiple times!
"""
import shutil
import subprocess
import sys
import shutil
from tests.testhelper import *

1
tests/test_functional_config.py

@ -20,6 +20,7 @@ tests.test_functional_config - Basic testing if Config pages work
"""
from selenium.common.exceptions import NoSuchElementException, UnexpectedAlertPresentException, NoAlertPresentException
from tests.testhelper import *

2
tests/test_functional_downloads.py

@ -20,7 +20,9 @@ tests.test_functional_downloads - Test the downloading flow
"""
import random
from selenium.common.exceptions import NoSuchElementException
from tests.testhelper import *

6
tests/test_functional_misc.py

@ -18,11 +18,11 @@
"""
tests.test_functional_misc - Functional tests of various functions
"""
import sys
import subprocess
import shutil
import sabnzbd.encoding
import subprocess
import sys
import sabnzbd.encoding
from tests.testhelper import *

2
tests/test_getipaddress.py

@ -19,8 +19,8 @@
tests.test_utils.test_check_dir - Testing SABnzbd checkdir util
"""
from sabnzbd.getipaddress import *
from sabnzbd.cfg import selftest_host
from sabnzbd.getipaddress import *
from sabnzbd.misc import probablyipv4, probablyipv6

2
tests/test_misc.py

@ -21,8 +21,8 @@ tests.test_misc - Testing functions in misc.py
import datetime
from sabnzbd import misc
from sabnzbd import lang
from sabnzbd import misc
from sabnzbd.config import ConfigCat
from tests.testhelper import *

3
tests/test_newsunpack.py

@ -19,9 +19,10 @@
tests.test_newsunpack - Tests of various functions in newspack
"""
from sabnzbd.newsunpack import *
import pytest
from sabnzbd.newsunpack import *
class TestNewsUnpack:
@pytest.mark.parametrize(

1
tests/test_utils/test_cert_gen.py

@ -20,6 +20,7 @@ tests.test_cert_gen - Testing Certificate generation
"""
import datetime
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa

2
tests/test_utils/test_diskspeed.py

@ -19,8 +19,8 @@
tests.test_utils.test_diskspeed - Testing SABnzbd diskspeed
"""
from tests.testhelper import *
from sabnzbd.utils.diskspeed import diskspeedmeasure
from tests.testhelper import *
class TestDiskSpeed:

3
tests/test_win_utils.py

@ -19,9 +19,10 @@
tests.test_misc - Testing mailslot communiction on Windows
"""
import sys
import subprocess
import sys
import time
import pytest
if not sys.platform.startswith("win"):

24
tests/testhelper.py

@ -22,15 +22,15 @@ tests.testhelper - Basic helper functions
import os
import time
import unittest
from http.client import RemoteDisconnected
import pytest
import requests
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from urllib3.exceptions import ProtocolError
import sabnzbd
import sabnzbd.cfg as cfg
@ -140,8 +140,12 @@ class SABnzbdBaseTest(unittest.TestCase):
@classmethod
def tearDownClass(cls):
cls.driver.close()
cls.driver.quit()
try:
cls.driver.close()
cls.driver.quit()
except:
# If something else fails, this can cause very non-informative long tracebacks
pass
def no_page_crash(self):
# Do a base test if CherryPy did not report test
@ -157,6 +161,10 @@ class SABnzbdBaseTest(unittest.TestCase):
time.sleep(2)
def wait_for_ajax(self):
wait = WebDriverWait(self.driver, 15)
wait.until(lambda driver_wait: self.driver.execute_script("return jQuery.active") == 0)
wait.until(lambda driver_wait: self.driver.execute_script("return document.readyState") == "complete")
# We catch common nonsense errors from Selenium
try:
wait = WebDriverWait(self.driver, 15)
wait.until(lambda driver_wait: self.driver.execute_script("return jQuery.active") == 0)
wait.until(lambda driver_wait: self.driver.execute_script("return document.readyState") == "complete")
except (RemoteDisconnected, ProtocolError):
pass

Loading…
Cancel
Save