TT#122872 selenium: fixup admin, contact and login tests

remove master flag tests - master flag doesnt exist anymore
fix "element not existent in dom" error in contacts
fix nonsense in login test
update spanish translation

Change-Id: I6157b83e021b8be2ba0dbec3004f3f596354ec9b
mr11.0
Nico Schedel 3 years ago
parent f27f58f0c1
commit 70ce9d364e

@ -78,7 +78,7 @@ def create_reseller_contract(driver, contractname):
print("Try to create a new Reseller Contract...", end="")
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').click()
driver.find_element_by_xpath('//*[@data-cy="aui-list-action-menu-item--contract-create-reseller"]').click()
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
time.sleep(1)

@ -152,46 +152,6 @@ class testrun(unittest.TestCase):
driver.find_element_by_xpath('//div[@data-cy="aui-main-menu-items--settings"]').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]')))
driver.find_element_by_xpath('//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]').click()
print("OK")
print("Enable 'master'...", end="")
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname2)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname2 + '")]')) > 0, "Administrator was not found")
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//table//tr[1]//td/button').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/a[contains(., "Edit")]')))
driver.find_element_by_xpath('/html/body//div/a[contains(., "Edit")]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/form/div[2]/div[2]/div/div[1]')))
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/form/div[2]/div[2]/div/div[1]').click()
time.sleep(1)
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Close")]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
print("OK")
print("Check if 'master' is not allowed to edit admins from other resellers...", end="")
logout_panel(driver)
login_panel(driver, adminname2, 'administrato')
driver.find_element_by_xpath('//div[@data-cy="aui-main-menu-items--settings"]').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]')))
driver.find_element_by_xpath('//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div/i[contains(., "warning")]')) > 0, "Second administrator should not appear")
print("OK")
print("Go back to administrator login...", end="")
logout_panel(driver)
login_panel(driver)
driver.find_element_by_xpath('//div[@data-cy="aui-main-menu-items--settings"]').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]')))
driver.find_element_by_xpath('//*[@id="q-app"]//div//aside//div//a[contains(., "Administrators")]').click()
print("OK")
print("Try to enable 'Customer Care'...", end="")
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
@ -400,14 +360,14 @@ class testrun(unittest.TestCase):
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + contactmail + '")]')) > 0, "Contact was not found")
print("OK")
print("Try to add first and last name to contact...", end="")
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[5]/span').click()
driver.find_element_by_xpath('//*[@data-cy="q-td--firstname"]/span').click()
fill_element(driver, '/html/body//div//label//div//input[@aria-label="First Name"]', firstname)
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + firstname + '")]')) > 0, "Contact first name was not changed")
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[6]/span').click()
driver.find_element_by_xpath('//*[@data-cy="q-td--lastname"]/span').click()
fill_element(driver, '/html/body//div//label//div//input[@aria-label="Last Name"]', lasttname)
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
@ -449,14 +409,14 @@ class testrun(unittest.TestCase):
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + contactmail + '")]')) > 0, "Contact was not found")
print("OK")
print("Try to add first and last name to contact...", end="")
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[5]/span').click()
driver.find_element_by_xpath('//*[@data-cy="q-td--firstname"]/span').click()
fill_element(driver, '/html/body//div//label//div//input[@aria-label="First Name"]', firstname)
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + firstname + '")]')) > 0, "Contact first name was not changed")
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[6]/span').click()
driver.find_element_by_xpath('//*[@data-cy="q-td--lastname"]/span').click()
fill_element(driver, '/html/body//div//label//div//input[@aria-label="Last Name"]', lasttname)
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
@ -864,7 +824,7 @@ class testrun(unittest.TestCase):
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[4]').click()
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside//div//a[contains(., "Tablón")]')) > 0, "Language wasn't changed")
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside//div//a[contains(., "Tablero")]')) > 0, "Language wasn't changed")
print("OK")
print("Try to change language to French...", end="")
driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[3]').click()

Loading…
Cancel
Save