TT#70901 selenium: more tests and fixes for call_forward_always

- create a second source set
- test creation of destinations in second source set
- test if second source can be created and deleted
- test if deletion fails when only one source is left in list
- wait until EC.element_is_clickable has been replaced with
invisibility_of_element_located, to drop many time.sleep statements and
actually check if loading animation has gone away.

Change-Id: I192159c15c62554b6a34a3dacc447a31ff83f8ac
changes/17/36717/5
Nico Schedel 6 years ago
parent 667a70a7cf
commit 12bf595e89

@ -143,7 +143,7 @@ class testrun(unittest.TestCase):
elem = driver.find_element_by_xpath( elem = driver.find_element_by_xpath(
'//*[@id="q-app"]//div//i[text()="check"]') '//*[@id="q-app"]//div//i[text()="check"]')
driver.execute_script("arguments[0].click();", elem) driver.execute_script("arguments[0].click();", elem)
driver.implicitly_wait(1) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element(( WebDriverWait(driver, 10).until(EC.invisibility_of_element((
By.XPATH, '//*[@id="q-app"]//div[@class="csc-spinner"]/svg'))) By.XPATH, '//*[@id="q-app"]//div[@class="csc-spinner"]/svg')))
driver.implicitly_wait(10) driver.implicitly_wait(10)
@ -294,20 +294,24 @@ class testrun(unittest.TestCase):
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="add-destination-form"]//button' '//*[@id="q-app"]//div[@class="add-destination-form"]//button'
'/span[contains(text(), "Save")]').click() '/span[contains(text(), "Save")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[1]/div' By.XPATH, '//div[class="q-loading animate-fade fullscreen column '
'[@class="add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[1]/div[@class="add-destination-form"]' '//*[@id="q-app"]//div[1]/div[@class="add-destination-form"]'
'/button').click() '/button').click()
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//div[@class="q-popover animate-scale"]//div[contains(text(),' '//div[@class="q-popover animate-scale"]//div[contains(text(),'
' "Add Voicemail")]').click() ' "Add Voicemail")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[2]/div[@class=' By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'"add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[2]/div[@class="add-destination-form"]' '//*[@id="q-app"]//div[2]/div[@class="add-destination-form"]'
'/button').click() '/button').click()
@ -323,20 +327,24 @@ class testrun(unittest.TestCase):
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="add-destination-form"]//button/' '//*[@id="q-app"]//div[@class="add-destination-form"]//button/'
'span[contains(text(), "Save")]').click() 'span[contains(text(), "Save")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[2]/div' By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'[@class="add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[2]/div[@class="add-destination-form"]' '//*[@id="q-app"]//div[2]/div[@class="add-destination-form"]'
'/button').click() '/button').click()
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//div[@class="q-popover animate-scale"]//div[contains(text(),' '//div[@class="q-popover animate-scale"]//div[contains(text(),'
' "Add Voicemail")]').click() ' "Add Voicemail")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[3]/div' By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'[@class="add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.execute_script( driver.execute_script(
"window.scrollTo(0, document.body.scrollHeight);") "window.scrollTo(0, document.body.scrollHeight);")
driver.find_element_by_xpath( driver.find_element_by_xpath(
@ -354,20 +362,24 @@ class testrun(unittest.TestCase):
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="add-destination-form"]//button/' '//*[@id="q-app"]//div[@class="add-destination-form"]//button/'
'span[contains(text(), "Save")]').click() 'span[contains(text(), "Save")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[3]/div' By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'[@class="add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[3]/div[@class="add-destination-form"]' '//*[@id="q-app"]//div[3]/div[@class="add-destination-form"]'
'/button').click() '/button').click()
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//div[@class="q-popover animate-scale"]//div[contains(text(),' '//div[@class="q-popover animate-scale"]//div[contains(text(),'
' "Add Voicemail")]').click() ' "Add Voicemail")]').click()
time.sleep(2) driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(( WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[3]/div' By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'[@class="add-destination-form"]/button'))) 'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath( driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="q-field-content col-xs-12 col-sm"]' '//*[@id="q-app"]//div[@class="q-field-content col-xs-12 col-sm"]'
'/div[@tabindex="0"]').click() '/div[@tabindex="0"]').click()
@ -381,8 +393,8 @@ class testrun(unittest.TestCase):
"enabled") "enabled")
self.assertEqual(driver.find_element_by_xpath( self.assertEqual(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="dest-row own-phone-desktop"]/span' '//*[@id="q-app"]//div[@class="dest-row own-phone-desktop"]/span'
).text, 'first ring own phone for 15 secs', "Option 'Ring own Phone' " ).text, 'first ring own phone for 15 secs', "Option 'first ring ' "
"was not enabled") "own Phone for 15 secs' is missing")
self.assertEqual(driver.find_element_by_xpath( self.assertEqual(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@groupname="cfu"]/div[1]//div[@class="dest-' '//*[@id="q-app"]//div[@groupname="cfu"]/div[1]//div[@class="dest-'
'row"]').text, 'then ring testdestination for 100 secs', "Option " 'row"]').text, 'then ring testdestination for 100 secs', "Option "
@ -407,6 +419,136 @@ class testrun(unittest.TestCase):
'//*[@id="q-app"]//div[@groupname="cfna"]/div[2]//div[@class="dest' '//*[@id="q-app"]//div[@groupname="cfna"]/div[2]//div[@class="dest'
'-row"]').text, 'then ring Voicebox', "Option 'Ring Voicebox when " '-row"]').text, 'then ring Voicebox', "Option 'Ring Voicebox when "
"im offline' is missing") "im offline' is missing")
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="q-tab column flex-center '
'relative-position icon-and-label"]//span[@class="q-tab-label"]'
).click()
Functions.fill_element(
driver, '//*[@id="q-app"]//div[@class="q-item- row no-wrap"]/'
'div[1]//input', 'testsourceset')
Functions.fill_element(
driver, '//*[@id="q-app"]//div[@class="q-item- row no-wrap"]/'
'div[2]//input', 'testsource')
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="q-item- row no-wrap"]/div'
'[@tabindex=0]').click()
driver.find_element_by_xpath(
'/html/body//div[@class="q-popover animate-scale column no-wrap"]'
'/div[2]').click()
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="q-item-"]/button').click()
driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath(
'//*[@id="q-app"]//div/span[contains(text(), "testsourceset")]'
).click()
self.assertTrue(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "testsource")]'
).is_displayed(), "Source was not found")
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="sources-section"]/button').click()
Functions.fill_element(
driver, '//*[@id="q-app"]//div[@class="add-source-form"]//input',
'newtestsource')
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="add-source-form"]/button[2]'
).click()
driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
self.assertTrue(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "newtestsource")]'
).is_displayed(), "Second Source was not found")
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "newtestsource")]/../'
'div[2]').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((
By.XPATH, '/html/body//div[@class="modal-buttons row"]/'
'button[2]')))
driver.find_element_by_xpath(
'/html/body//div[@class="modal-buttons row"]/button[2]').click()
driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//*[@id="q-app"]//div[@class="sources-section"]/div'
'[@class="q-list no-border q-list-striped-odd"]/div[2]')))
self.assertFalse(driver.find_elements_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "newtestsource")]'),
"Second Source was not deleted")
driver.implicitly_wait(10)
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "testsource")]/../'
'div[2]').click()
self.assertTrue(driver.find_element_by_xpath(
'/html/body//div[@class="q-alert row no-wrap shadow-2 '
'bg-negative"]').is_displayed(), "Error Message 'Removing the "
"last source entry is not allowed' did not appear")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((
By.XPATH, '//*[@id="q-app"]//div[1]/div'
'[@class="add-destination-form"]/button')))
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[1]/div[@class="add-destination-form"]'
'/button').click()
driver.find_element_by_xpath(
'//div[@class="q-popover animate-scale"]//'
'div[contains(text(), "Add Number")]').click()
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[contains(text(), "Destination")]/..'
'/input').send_keys('testdestination')
Functions.fill_element(
driver, '//*[@id="q-app"]//div[contains(text(), "Timeout")]/'
'../input', "100")
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="add-destination-form"]//button'
'/span[contains(text(), "Save")]').click()
driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
driver.implicitly_wait(10)
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[1]/div[@class="add-destination-form"]'
'/button').click()
driver.find_element_by_xpath(
'//div[@class="q-popover animate-scale"]//div[contains(text(),'
' "Add Voicemail")]').click()
self.assertEqual(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="dest-row own-phone-desktop"]/span'
).text, 'do not ring own phone', "Option 'do not ring own phone' "
"is missing")
self.assertEqual(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@groupname="cfu"]/div[1]//div[@class="dest-'
'row"]').text, 'first ring testdestination for 100 secs', "Option "
"'Ring testdestination for 100 secs' is missing")
self.assertEqual(driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@groupname="cfu"]/div[2]//div[@class="dest-'
'row"]').text, 'then ring Voicebox', "Option 'Ring Voicebox when "
"im online' is missing")
driver.find_element_by_xpath(
'//*[@id="q-app"]//div[@class="sources-section"]/div/button'
'[@align="right"]').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((
By.XPATH, '/html/body//div[@class="modal-buttons row"]/'
'button[2]')))
driver.find_element_by_xpath(
'/html/body//div[@class="modal-buttons row"]/button[2]').click()
driver.implicitly_wait(2)
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((
By.XPATH, '//div[@class="q-loading animate-fade fullscreen column '
'flex-center z-maxundefined"]/svg[@class="q-spinner q-spinner-mat '
'text-white"]')))
time.sleep(1)
self.assertFalse(driver.find_elements_by_xpath(
'//*[@id="q-app"]//div/span[contains(text(), "testsourceset")]'),
"Second Source Set was not deleted")
driver.implicitly_wait(10)
Collections.logout(driver) Collections.logout(driver)
self.assertEqual( self.assertEqual(
driver.current_url, os.environ['CATALYST_SERVER'] + driver.current_url, os.environ['CATALYST_SERVER'] +
@ -770,6 +912,7 @@ class testrun(unittest.TestCase):
def tearDown(self): def tearDown(self):
global filename global filename
driver = self.driver driver = self.driver
driver.implicitly_wait(10)
if filename: if filename:
driver.save_screenshot('/results/' + filename) driver.save_screenshot('/results/' + filename)
filename = 0 filename = 0

Loading…
Cancel
Save