TT#158401 selenium: fixup administrator and reseller tests

Change-Id: I5d02e7afeeac70f5e88888847b1b84354f3759d7
mr10.4
Nico Schedel 3 years ago
parent ccac7fd77f
commit a15445fbe4

@ -50,8 +50,6 @@ class testrun(unittest.TestCase):
resellercontract = "contract" + str(random.randint(1, 99999))
email = "test" + str(random.randint(1, 99999)) + "@test.com"
adminname2 = "admin" + str(random.randint(1, 99999))
resellername2 = "reseller" + str(random.randint(1, 99999))
resellercontract2 = "contract" + str(random.randint(1, 99999))
filename = "test_admin.png"
driver = self.driver
login_panel(driver)
@ -59,28 +57,20 @@ class testrun(unittest.TestCase):
create_reseller_contract(driver, resellercontract)
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
create_reseller(driver, resellername, resellercontract)
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
create_reseller_contract(driver, resellercontract2)
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
create_reseller(driver, resellername2, resellercontract2)
print("Go to 'Administrators'...", end="")
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//aside//div//a[contains(., "Administrators")]').click()
print("OK")
print("Try to create a new Administrator...", end="")
click_js(driver, '//*[@id="q-app"]/div//main//div/a[contains(., "add")]')
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', resellername)
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../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]')))
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Login")]/../div/input', adminname)
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password"]', 'administrato')
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password Retype"]', 'administrato')
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Superuser"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Superuser"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Master"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Master"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Customer Care"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Customer Care"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Active"]').get_attribute('aria-checked') == "false":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Active"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Read Only"]').get_attribute('aria-checked') == "true":
@ -93,10 +83,6 @@ class testrun(unittest.TestCase):
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Show CDRs"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Show Billing Info"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Show Billing Info"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Lawful Intercept"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="Lawful Intercept"]').click()
if driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="System"]').get_attribute('aria-checked') == "true":
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/form//div[@aria-label="System"]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
print("OK")
print("Check if Administrator was created...", end="")
@ -108,12 +94,14 @@ class testrun(unittest.TestCase):
print("OK")
print("Create a second Administrator...", end="")
click_js(driver, '//*[@id="q-app"]/div//main//div/a[contains(., "add")]')
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', resellername2)
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', resellername)
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Login")]/../div/input', adminname2)
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password"]', 'administrato')
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password Retype"]', 'administrato')
driver.find_element_by_xpath('//label[@data-cy="roles-list"]').click()
driver.find_element_by_xpath('//div[@data-cy="q-item--2"]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
print("OK")
print("Try to login and check if admin is prohibited from changing his permissions...", end="")
@ -124,22 +112,12 @@ class testrun(unittest.TestCase):
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"]')
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//table//tr/td[5]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//table//tr/td[8]').click()
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//table//tr[1]/td[6]//div[@aria-checked="false"]')) > 0, "'Master' permission was granted")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[7]//div[@aria-disabled="true"]')) > 0, "'Active' toggle is not disabled")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[8]//div[@aria-disabled="true"]')) > 0, "'Read-only' toggle is not disabled")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[9]//div[@aria-disabled="true"]')) > 0, "'Show passwords' toggle is not disabled")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[10]//div[@aria-disabled="true"]')) > 0, "'Show CDRs' toggle is not disabled")
len(driver.find_elements_by_xpath('/html/body//div[@role="alert"][contains(., "User cannot modify own permissions")]')) > 0, "Notification showed up")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[11]//div[@aria-disabled="true"]')) > 0, "'Show billing' info toggle is not disabled")
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[12]//div[@aria-disabled="true"]')) > 0, "'Can reset password' toggle is not disabled")
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//table//tr[1]/td[8]//div[@aria-checked="false"]')) > 0, "'Active' toggle is not disabled")
print("OK")
print("Go back to administrator login...", end="")
logout_panel(driver)
@ -148,28 +126,7 @@ class testrun(unittest.TestCase):
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 'Superuser' for administrator...", 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', adminname)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 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/div[2]/div/div[1]')))
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/form/div/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 'Superuser' can edit admins from other resellers...", end="")
logout_panel(driver)
login_panel(driver, adminname, '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"]')
@ -196,20 +153,18 @@ class testrun(unittest.TestCase):
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("Disable 'Superuser' and enable 'master'...", end="")
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', adminname)
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(., "' + adminname + '")]')) > 0, "Administrator was not found")
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/div[2]/div/div[1]')))
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/form/div/div[2]/div/div[1]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/form/div/div[2]/div/div[2]')))
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/form/div/div[2]/div/div[2]').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"]')
@ -218,14 +173,15 @@ class testrun(unittest.TestCase):
print("OK")
print("Check if 'master' is not allowed to edit admins from other resellers...", end="")
logout_panel(driver)
login_panel(driver, adminname, 'administrato')
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', adminname2)
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")
@ -246,7 +202,8 @@ class testrun(unittest.TestCase):
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()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//form//div[@data-cy="ccare-flag"]').click()
driver.find_element_by_xpath('//label[@data-cy="roles-list"]').click()
driver.find_element_by_xpath('//div[@data-cy="q-item--3"]').click()
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()
@ -274,7 +231,7 @@ class testrun(unittest.TestCase):
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr[1]/td[9]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr[1]/td[10]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
print("OK")
print("Check if 'Read-only' was enabled...", end="")
@ -302,7 +259,7 @@ class testrun(unittest.TestCase):
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table//tr[1]/td[8]/div').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table//tr[1]/td[9]/div').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
print("OK")
print("Check if admin was deactivated...", end="")
@ -324,11 +281,11 @@ class testrun(unittest.TestCase):
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
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[4]/div/div')))
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[2]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//div[@data-cy="aui-popup-menu-item--delete"]')))
driver.find_element_by_xpath('//div[@data-cy="aui-popup-menu-item--delete"]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//button[@data-cy="btn-confirm"]')))
driver.find_element_by_xpath('//button[@data-cy="btn-confirm"]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
self.assertTrue(
@ -338,18 +295,17 @@ class testrun(unittest.TestCase):
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")
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[4]/div/div')))
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[2]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//div[@data-cy="aui-popup-menu-item--delete"]')))
driver.find_element_by_xpath('//div[@data-cy="aui-popup-menu-item--delete"]').click()
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//button[@data-cy="btn-confirm"]')))
driver.find_element_by_xpath('//button[@data-cy="btn-confirm"]').click()
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
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/i[contains(., "warning")]')) > 0, "Admin was not deleted")
print("OK")
delete_reseller(driver, resellername)
delete_reseller(driver, resellername2)
filename = 0
"""
@ -969,34 +925,8 @@ class testrun(unittest.TestCase):
filename = "test_reseller.png"
driver = self.driver
login_panel(driver)
print("Go to 'Reseller'...", end="")
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(., "Resellers")]')))
driver.find_element_by_xpath('//*[@id="q-app"]//div//aside//div//a[contains(., "Resellers")]').click()
print("OK")
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/a[contains(., "Add")]').click()
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div/label//button[contains(., "Create")]').click()
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').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)
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]/div[1]')
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
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)
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Billing Profile")]').click()
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)
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', resellercontract)
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
self.assertTrue(
len(driver.find_elements_by_xpath('/html/body//div[@role="alert"][contains(., "Contract created successfully")]')) > 0, "Message 'Contract created successfully' didnt show up")
print("OK")
create_reseller_contract(driver, resellercontract)
print("Try to create a new Reseller...", end="")
driver.find_element_by_xpath('//*[@id="q-app"]//div//aside//div//a[contains(., "Resellers")]').click()
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]').click()

Loading…
Cancel
Save