Skip to content

Commit

Permalink
Merge pull request #60 from AliasBlue/master
Browse files Browse the repository at this point in the history
Test script changes & fix of timeouts
  • Loading branch information
pfederl committed Jul 14, 2015
2 parents e9c9d1b + 76ae05c commit d19a326
Show file tree
Hide file tree
Showing 18 changed files with 1,256 additions and 1,600 deletions.
174 changes: 87 additions & 87 deletions Skeleton3/html5/common/skel/source/class/skel/simulation/Util.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Allow user to select web browser
# Allow user to select web browser/timeout
# Create global variables
global browser
global sleep

# Allow user selection of global variable
print("Please select a browser 1. Firefox 2. Google Chrome")
global browser
browser = int(input("Browser selection: "))

print("Timeouts? 1. Yes 2. No")
sleep = int(input("Timeouts: "))

def _getBrowser():
return browser












def _getSleep():
if sleep == 1:
timeout = 2
else:
timeout = 0
return timeout
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
def suite():

test_suite = unittest.TestSuite()
test_suite.addTest( unittest.makeSuite(tLoadImage.tLoadImage))
test_suite.addTest( unittest.makeSuite(tWindow.tWindow))
test_suite.addTest( unittest.makeSuite(tLayout.tLayout))
test_suite.addTest( unittest.makeSuite(tView.tView))
test_suite.addTest( unittest.makeSuite(tLoadImage.tLoadImage))
test_suite.addTest( unittest.makeSuite(tMenuToolVisibility.tMenuToolVisibility))
test_suite.addTest( unittest.makeSuite(tWindow.tWindow))
test_suite.addTest( unittest.makeSuite(tAnimatorTapeDeck.tAnimatorTapeDeck))
test_suite.addTest( unittest.makeSuite(tAnimatorSettings.tAnimatorSettings))
test_suite.addTest( unittest.makeSuite(tAnimatorLinks.tAnimatorLinks))
test_suite.addTest( unittest.makeSuite(tHistogram.tHistogram))
test_suite.addTest( unittest.makeSuite(tStatistics.tStatistics))
test_suite.addTest( unittest.makeSuite(tHistogram.tHistogram))
#test_suite.addTest( unittest.makeSuite(tStatistics.tStatistics))
test_suite.addTest( unittest.makeSuite(tSnapshotData.tSnapshotData))
test_suite.addTest( unittest.makeSuite(tSnapshotLayout.tSnapshotLayout))
test_suite.addTest( unittest.makeSuite(tSnapshotPreferences.tSnapshotPreferences))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By


# Animator functions
class tAnimator(unittest.TestCase):
Expand All @@ -29,23 +33,24 @@ def _isChecked(self, checkButton ):
def _click(self, driver, checkButton):
channelParent = checkButton.find_element_by_xpath( '..')
ActionChains(driver).click( channelParent ).perform()
time.sleep(2)

# Go to the first channel value of the test image
def _getFirstValue(self, driver):
firstValueButton = driver.find_element_by_xpath( "//div[@class='qx-toolbar']/div[@qxclass='qx.ui.toolbar.Button'][1]")
timeout = selectBrowser._getSleep()
firstValueButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='qx-toolbar']/div[@qxclass='qx.ui.toolbar.Button'][1]")))
self.assertIsNotNone( firstValueButton, "Could not find button to go to the first valid value")
driver.execute_script( "arguments[0].scrollIntoView(true);", firstValueButton)
ActionChains(driver).click( firstValueButton ).perform()
time.sleep(2)
time.sleep( timeout )

# Go to the last channel value of the test image
def _getLastValue(self, driver):
lastValueButton = driver.find_element_by_xpath( "//div[@class='qx-toolbar']/div[@qxclass='qx.ui.toolbar.Button'][5]")
timeout = selectBrowser._getSleep()
lastValueButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='qx-toolbar']/div[@qxclass='qx.ui.toolbar.Button'][5]")))
self.assertIsNotNone( lastValueButton, "Could not find button to go to the last valid value")
driver.execute_script( "arguments[0].scrollIntoView(true);", lastValueButton)
ActionChains(driver).click( lastValueButton ).perform()
time.sleep(2)
time.sleep( timeout )

# Get the current channel value of the test image
def _getChannelValue(self, driver):
Expand All @@ -65,45 +70,32 @@ def _getImageValue(self, driver):

# Click the forward animation button
def _animateForward(self, driver):
forwardAnimateButton = driver.find_element_by_xpath("//div[@class='qx-toolbar']/div[@class='qx-button'][2]")
forwardAnimateButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='qx-toolbar']/div[@class='qx-button'][2]")))
self.assertIsNotNone( forwardAnimateButton, "Could not find forward animation button")
driver.execute_script( "arguments[0].scrollIntoView(true);", forwardAnimateButton)
ActionChains(driver).click( forwardAnimateButton ).perform()

# Change the Channel Animator to an Image Animator
def channel_to_image_animator(self, driver):
# Find and click on the animation window
animWindow = driver.find_element_by_xpath( "//div[@qxclass='skel.widgets.Window.DisplayWindowAnimation']")
timeout = selectBrowser._getSleep()
# Find and click on the animation window
animWindow = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowAnimation']")))
self.assertIsNotNone( animWindow, "Could not find animation window")
ActionChains(driver).click( animWindow ).perform()

# Make sure the animation window is enabled by clicking an element within the window
# From the context menu, uncheck the Channel Animator and check the Image Animator
channelText = driver.find_element_by_id( "ChannelIndexText")
driver.execute_script( "arguments[0].scrollIntoView(true);", channelText)
ActionChains(driver).click( channelText ).perform()
ActionChains(driver).context_click( channelText ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(
Keys.ARROW_DOWN ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_RIGHT).send_keys(Keys.SPACE).send_keys(
Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
time.sleep(2)
time.sleep(timeout)

# Set default settings
def _setDefaultSettings(self, driver):
# Open Settings
def _openSettings(self, driver):
# Click Settings to reveal animation settings
settingsCheckBox = driver.find_element_by_xpath( "//div[@qxclass='qx.ui.form.CheckBox']/div[text()='Settings...']")
settingsCheckBox = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.form.CheckBox']/div[text()='Settings...']")))
self.assertIsNotNone( settingsCheckBox, "Could not find settings check box")
ActionChains(driver).click( settingsCheckBox ).perform()

# Ensure the set increment is set to 1 and the rate is set to 20 (default settings)
stepText = driver.find_element_by_xpath( "//div[@qxclass='skel.boundWidgets.Animator']/div[4]/div[2]/input")
self.assertIsNotNone( stepText, "Could not find step increment text")
driver.execute_script( "arguments[0].scrollIntoView(true);", stepText)
stepValue = stepText.get_attribute("value")

if int(stepValue) != 1:
Util._changeElementText(self, driver, stepText, 1)

rateText = driver.find_element_by_xpath(" //div[@qxclass='skel.boundWidgets.Animator']/div[4]/div[7]/input")
self.assertIsNotNone( rateText, "Could not find rate text to set the speed of the animation")
rateValue = rateText.get_attribute("value")
if int(rateValue) != 20:
Util._changeElementText(self, driver, rateText, 20)
Loading

0 comments on commit d19a326

Please sign in to comment.