Initial commit.

This commit is contained in:
Hazen Babcock committed 2018-02-28 22:19:56 -05:00
1 parent 505eaf6320
commit 7e74f0ce78
2 files changed
+107 -2

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#
# This installs the html and javascript. It does not install the
# parts. It is primarily designed to make it easy to update the
# server code during development.
#
readonly www_dir=/var/www/html/brigl
cp -r web/*.html $www_dir/.
cp -r web/js/*.js $www_dir/js/.
cp -r test/p $www_dir/test/.
cp -r test/parts $www_dir/test/.
cp -r test/*.html $www_dir/test/.
+94 -2
View File
@@ -6,7 +6,10 @@ import time
import sys
import selenium
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
import configure as configure
import driver as driver
@@ -115,6 +118,92 @@ def test_animation():
www_driver.close()
def test_load_by_url():
www_driver = driver.getDriver()
www_driver.get(configure.www_root + "url.html")
log = www_driver.find_element_by_id("logarea")
worked = False
for i in range(20):
if ("Model loaded successfully" in log.text):
worked = True
break
time.sleep(0.5)
assert(worked)
driver.noSevereErrors(www_driver)
www_driver.close()
def test_rotating():
www_driver = driver.getDriver()
www_driver.get(configure.www_root + "rotate.html")
log = www_driver.find_element_by_id("logarea")
worked = False
for i in range(20):
if ("Model loaded successfully" in log.text):
worked = True
break
time.sleep(0.5)
assert(worked)
driver.noSevereErrors(www_driver)
time.sleep(1.0)
www_driver.close()
def test_jquery():
www_driver = driver.getDriver()
www_driver.get(configure.www_root + "jquery.html")
log = www_driver.find_element_by_id("logarea")
worked = False
for i in range(20):
if ("Model loaded successfully" in log.text):
worked = True
break
time.sleep(0.5)
assert(worked)
driver.noSevereErrors(www_driver)
www_driver.close()
def test_error_handling():
www_driver = driver.getDriver()
www_driver.get(configure.www_root + "error.html")
worked = False
try:
WebDriverWait(www_driver, 3).until(EC.alert_is_present(),
'Timed out waiting for PA creation ' +
'confirmation popup to appear.')
alert = www_driver.switch_to.alert
alert.accept()
worked = True
except TimeoutException:
pass
assert worked, "Alert handling failed."
www_driver.close()
def test_upload():
www_driver = driver.getDriver()
www_driver.get(configure.www_root + "upload.html")
log = www_driver.find_element_by_id("log")
worked = False
for i in range(20):
if ("Model loaded successfully" in log.text):
worked = True
break
time.sleep(0.5)
assert(worked)
driver.noSevereErrors(www_driver)
www_driver.close()
if (__name__ == "__main__"):
test_simple()
test_multiple()
@@ -122,5 +211,8 @@ if (__name__ == "__main__"):
test_steps()
test_lines()
test_animation()
test_load_by_url()
test_rotating()
test_jquery()
test_error_handling()
test_upload()