TT#122872 selenium: add new superuser test

Set Administrator as Superuser while also leaving "Read-Only" enabled
and make sure that Administrator cant read any entries, despite beeing
a superuser

Change-Id: Id4d3cea2b54120dd4bfe39e2b6fbcfbd40dbf492
mr10.0
Nico Schedel 4 years ago
parent 2a1ab7a73f
commit 0906ca2e5f

@ -82,7 +82,7 @@ class testrun(unittest.TestCase):
logout_panel(driver)
login_panel(driver, adminname, 'administrato')
print("OK")
print("Go back to administrator login", end="")
print("Go back to administrator login...", end="")
logout_panel(driver)
login_panel(driver)
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
@ -118,6 +118,51 @@ class testrun(unittest.TestCase):
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
driver.implicitly_wait(10)
print("OK")
print("Go back to administrator login...", end="")
logout_panel(driver)
login_panel(driver)
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
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//div//table/tbody/tr[1]/td[16]/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]/div/div/div[1]')))
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/form/div/div[2]/div/div[1]/div/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 still see entries with 'Read-only' also enabled...", end="")
logout_panel(driver)
login_panel(driver, adminname, 'administrato')
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Customers")]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
driver.implicitly_wait(1)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Contacts")]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
driver.implicitly_wait(1)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Domains")]').click()
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
driver.implicitly_wait(1)
self.assertTrue(
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
driver.implicitly_wait(10)
print("OK")
print("Go back to administrator login", end="")
logout_panel(driver)
login_panel(driver)

Loading…
Cancel
Save