From 0bcdc84fc37e6712a649fd45349e0b67d47b165a Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Thu, 15 Jul 2021 10:22:01 +0200 Subject: [PATCH] TT#122872 selenium: add test "add page to favourites" Add two pages to favourites and check if those pages were actually added and are accessable Change-Id: I795d3067bc3fffea548d0449b09398a460fb800c --- t/selenium/testrun.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/t/selenium/testrun.py b/t/selenium/testrun.py index 2b23bf4395..5ae6dd6db5 100644 --- a/t/selenium/testrun.py +++ b/t/selenium/testrun.py @@ -163,7 +163,7 @@ 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="") + 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() @@ -713,36 +713,64 @@ class testrun(unittest.TestCase): driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[3]').click() self.assertTrue( len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside/div/div[2]/a[contains(., "Übersicht")]')) > 0, "Languave wasn't changed") + print("OK") print("Try to change language to Spanish...", end="") driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[3]').click() 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/div[2]/a[contains(., "Tablón")]')) > 0, "Languave 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() time.sleep(1) driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[5]').click() self.assertTrue( len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside/div/div[2]/a[contains(., "Tableau de bord")]')) > 0, "Languave wasn't changed") + print("OK") print("Try to change language to Italian...", end="") driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[3]').click() time.sleep(1) driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[6]').click() self.assertTrue( len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside/div/div[2]/a[contains(., "Dashboard")]')) > 0, "Languave wasn't changed") + print("OK") print("Try to change language to Russian...", end="") driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[3]').click() time.sleep(1) driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[7]').click() self.assertTrue( len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside/div/div[2]/a[contains(., "Главная")]')) > 0, "Languave wasn't changed") + print("OK") print("Try to change language back to English...", end="") driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[3]').click() time.sleep(1) driver.find_element_by_xpath('/html/body/div[@class="q-menu q-position-engine scroll"]/div[2]').click() self.assertTrue( len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//aside/div/div[2]/a[contains(., "Dashboard")]')) > 0, "Languave wasn't changed") + print("OK") + print("Try to add Administrators and Resellers to favourites...", end="") + 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() + wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]') + driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[2]').click() + driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Resellers")]').click() + wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]') + driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[2]').click() + driver.find_element_by_xpath('//*[@id="q-app"]/div//aside//div[@class="q-expansion-item__container relative-position"]/div[1]').click() + time.sleep(1) + print("OK") + print("Check if webpages were added to favourites and unfavourite them afterwards...", end="") + driver.find_element_by_xpath('//*[@id="q-app"]/div//aside//div[@class="bg-secondary q-mb-lg q-list"]/a[@href="#/administrator"]').click() + wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]') + self.assertTrue( + len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Administrators")]')) > 0, "Wrong webpage was opened") + driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[2]').click() + driver.find_element_by_xpath('//*[@id="q-app"]/div//aside//div[@class="bg-secondary q-mb-lg q-list"]/a[@href="#/reseller"]').click() + wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]') + self.assertTrue( + len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Resellers")]')) > 0, "Wrong webpage was opened") + driver.find_element_by_xpath('//*[@id="q-app"]/div/header/div/button[2]').click() """ print("Try to open the handbook...", end="") driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Documentation")]').click() @@ -755,6 +783,7 @@ class testrun(unittest.TestCase): self.assertTrue( len(driver.find_elements_by_xpath('/html/body//div//article/h1[contains(., "Architecture")]')) > 0, "Page 'Architecture' wasnt opened") """ + print("OK") print("Try to logout...", end="") driver.find_element_by_xpath('//*[@id="q-app"]//div/button[@aria-label="UserMenu"]').click() driver.find_element_by_xpath('/html/body//div[@class="q-list"]/div[1]').click()