TT#70901 selenium: choose call forwarding date more carefully

Previously when adding condition (date is) to a call forwarding, it was
hardcoded to be the 15th of every month. However this caused tests to fail
on this exact day every month. Now beeing more careful with date choosing.

Change-Id: I3e49f02230d5e6390f484e7d3864747c3437ecdf
mr10.0
Nico Schedel 4 years ago
parent 1b912b7471
commit f9f68817ba

@ -196,17 +196,22 @@ class testrun(unittest.TestCase):
"Second condition was not deleted") "Second condition was not deleted")
print("OK") print("OK")
print("Try to add second condition 'date is...'...", end="") print("Try to add second condition 'date is...'...", end="")
day = datetime.today().day
if day >= 28:
day -= 1
elif day < 28:
day += 1
driver.find_element_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "condition")]').click() driver.find_element_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "condition")]').click()
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div[3]/div[3]').click() driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div[3]/div[3]').click()
driver.find_element_by_xpath('/html/body//div/button[contains(., 15)]').click() driver.find_element_by_xpath('/html/body//div/button[contains(., ' + str(day) + ')]').click()
driver.find_element_by_xpath('/html/body//div//button[contains(., "Save")]').click() driver.find_element_by_xpath('/html/body//div//button[contains(., "Save")]').click()
wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg') wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg')
self.assertTrue( self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "' + datetime.today().strftime('%Y/%m') + '/15' + '")]')) > 0, len(driver.find_elements_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "' + datetime.today().strftime('%Y/%m/') + str(day) + '")]')) > 0,
"'Office hours are...' condition is not correct") "'Office hours are...' condition is not correct")
print("OK") print("OK")
print("Try to delete second condition...", end="") print("Try to delete second condition...", end="")
driver.find_element_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "' + datetime.today().strftime('%Y/%m') + '/15' + '")]').click() driver.find_element_by_xpath('//*[@id="csc-wrapper-call-forwarding"]//div/span[contains(., "' + datetime.today().strftime('%Y/%m/') + str(day) + '")]').click()
driver.find_element_by_xpath('/html/body//div//button[contains(., "Delete")]').click() driver.find_element_by_xpath('/html/body//div//button[contains(., "Delete")]').click()
wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg') wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg')
self.assertTrue( self.assertTrue(

Loading…
Cancel
Save