added first browser test, tests if circles opens out of ot the box
This commit is contained in:
parent
b62e613e8e
commit
02fa6dd558
@ -1,2 +1,3 @@
|
||||
pdoc3==0.7.4
|
||||
pip-tools==4.5.0
|
||||
helium==3.0.1
|
||||
|
@ -8,6 +8,8 @@ click==7.0 \
|
||||
--hash=sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13 \
|
||||
--hash=sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7 \
|
||||
# via pip-tools
|
||||
helium==3.0.1 \
|
||||
--hash=sha256:a7be1ad48702a38e11e9ee9b262459cde3c986d2dcbd79fcf8d6f5b54c5f5d9e
|
||||
mako==1.1.1 \
|
||||
--hash=sha256:2984a6733e1d472796ceef37ad48c26f4a984bb18119bb2dbc37a44d8f6e75a4 \
|
||||
# via pdoc3
|
||||
@ -55,10 +57,18 @@ pdoc3==0.7.4 \
|
||||
pip-tools==4.5.0 \
|
||||
--hash=sha256:144fbd764e88f761246f832370721dccabfefbbc4ce3aa8468f6802ac6519217 \
|
||||
--hash=sha256:61455cfdaa183930eefd8259f393812d94005fb9f8249edb640ed1b66f678116
|
||||
selenium==3.141.0 \
|
||||
--hash=sha256:2d7131d7bc5a5b99a2d9b04aaf2612c411b03b8ca1b1ee8d3de5845a9be2cb3c \
|
||||
--hash=sha256:deaf32b60ad91a4611b98d8002757f29e6f2c2d5fcaf202e1c9ad06d6772300d \
|
||||
# via helium
|
||||
six==1.14.0 \
|
||||
--hash=sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a \
|
||||
--hash=sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c \
|
||||
# via pip-tools
|
||||
urllib3==1.25.8 \
|
||||
--hash=sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc \
|
||||
--hash=sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc \
|
||||
# via selenium
|
||||
|
||||
# WARNING: The following packages were not pinned, but pip requires them to be
|
||||
# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag.
|
||||
|
10
run_tests.sh
10
run_tests.sh
@ -20,5 +20,13 @@ for f in tests/integration-tests/*.py; do
|
||||
python3 "$f" || close # if needed
|
||||
let "ran++"
|
||||
done
|
||||
echo "ran $ran integration test tests."
|
||||
echo "ran $ran integration tests."
|
||||
echo "total test time $SECONDS"
|
||||
ran=0;
|
||||
|
||||
for f in tests/browser-tests/*.py; do
|
||||
python3 "$f" || close # if needed
|
||||
let "ran++"
|
||||
done
|
||||
echo "ran $ran browser tests."
|
||||
echo "total test time $SECONDS"
|
@ -78,7 +78,7 @@ def enable(name, start_event = True):
|
||||
else:
|
||||
enabled_plugins.append(name)
|
||||
config.set('plugins.enabled', enabled_plugins, savefile=True)
|
||||
|
||||
|
||||
if start_event is True:
|
||||
start(name)
|
||||
return True
|
||||
@ -174,7 +174,7 @@ def import_module_from_file(full_path_to_module):
|
||||
module_name, module_ext = os.path.splitext(module_file)
|
||||
|
||||
module_name = module_dir # Module name must be unique otherwise it will get written in other imports
|
||||
|
||||
|
||||
# Get module "spec" from filename
|
||||
spec = importlib.util.spec_from_file_location(module_name,full_path_to_module)
|
||||
|
||||
@ -215,6 +215,7 @@ def get_enabled_plugins():
|
||||
'''
|
||||
|
||||
check()
|
||||
config.reload()
|
||||
|
||||
return list(config.get('plugins.enabled', list()))
|
||||
|
||||
|
@ -4,6 +4,7 @@ Identify a data directory for Onionr
|
||||
"""
|
||||
import os
|
||||
import platform
|
||||
import uuid
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -27,6 +28,7 @@ def identify_home() -> str:
|
||||
"""
|
||||
path = os.environ.get('ONIONR_HOME', None)
|
||||
|
||||
|
||||
if path is not None and not os.getcwd().endswith('src') \
|
||||
and 'test' not in path:
|
||||
path = 'src/' + path
|
||||
|
47
tests/browser-tests/test-circles.py
Normal file
47
tests/browser-tests/test-circles.py
Normal file
@ -0,0 +1,47 @@
|
||||
from unittest.mock import patch
|
||||
import sys, os
|
||||
sys.path.append(".")
|
||||
sys.path.append("src/")
|
||||
import unittest, uuid
|
||||
TEST_DIR = 'testdata/-%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
||||
os.environ["ONIONR_HOME"] = TEST_DIR
|
||||
|
||||
from utils import createdirs
|
||||
|
||||
from subprocess import Popen
|
||||
import subprocess
|
||||
from time import sleep
|
||||
|
||||
from helium import start_firefox, click, Text
|
||||
|
||||
|
||||
from onionrcommands.openwebinterface import get_url
|
||||
from onionrutils import escapeansi
|
||||
BROWSER_HEADLESS = os.getenv('ONIONR_TEST_HEADLESS')
|
||||
|
||||
def start_onionr():
|
||||
testargs = ["onionr.py", "start"]
|
||||
with patch.object(sys, 'argv', testargs):
|
||||
parser.register()
|
||||
|
||||
|
||||
class OnionrTests(unittest.TestCase):
|
||||
def test_circles_home_load(self):
|
||||
Popen(['./onionr.sh', 'start'])
|
||||
while b'http' not in Popen(['./onionr.sh', 'url'], stdout=subprocess.PIPE).communicate()[0]:
|
||||
sleep(1)
|
||||
url = 'http' + escapeansi.escape_ANSI(Popen(['./onionr.sh', 'url'], stdout=subprocess.PIPE).communicate()[0].decode().split('http')[1])
|
||||
web_driver = start_firefox(url=url, headless=BROWSER_HEADLESS)
|
||||
if Text('Get Started').exists():
|
||||
click('Get Started')
|
||||
click('Circles')
|
||||
if not Text('Circle Name').exists():
|
||||
Popen(['./onionr.sh', 'stop']).wait()
|
||||
web_driver.quit()
|
||||
raise ValueError
|
||||
Popen(['./onionr.sh', 'stop']).wait()
|
||||
web_driver.quit()
|
||||
|
||||
|
||||
|
||||
unittest.main()
|
@ -1 +1 @@
|
||||
1582445602
|
||||
1582883307
|
Loading…
Reference in New Issue
Block a user