diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2017-02-14 12:08:41 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2017-02-14 12:08:41 +0300 |
commit | 6d198768d65025541c91aa3843a75079ae8cba55 (patch) | |
tree | a80d6bdca1bd0b947386d7d915cd0193d91b3aac /guiTests | |
parent | ad75c24255e2bf012702f57352e72437af9f8538 (diff) |
Fixed some issues with the gui tests
Diffstat (limited to 'guiTests')
-rw-r--r-- | guiTests/guiTest.py | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/guiTests/guiTest.py b/guiTests/guiTest.py index 4158c588e..4900ea93f 100644 --- a/guiTests/guiTest.py +++ b/guiTests/guiTest.py @@ -77,11 +77,11 @@ def wait_for_text(time, xpath, text): BACKUP_NAME = "BackupName" PASSWORD = "the_backup_password_is_really_long_and_safe" -SOURCE_FOLDER = "duplicati_gui_test_source" -DESTINATION_FOLDER = "duplicati_gui_test_destination" -DESTINATION_FOLDER_DIRECT_RESTORE = "duplicati_gui_test_destination_direct_restore" -RESTORE_FOLDER = "duplicati_gui_test_restore" -DIRECT_RESTORE_FOLDER = "duplicati_gui_test_direct_restore" +SOURCE_FOLDER = os.path.abspath("duplicati_gui_test_source") +DESTINATION_FOLDER = os.path.abspath("duplicati_gui_test_destination") +DESTINATION_FOLDER_DIRECT_RESTORE = os.path.abspath("duplicati_gui_test_destination_direct_restore") +RESTORE_FOLDER = os.path.abspath("duplicati_gui_test_restore") +DIRECT_RESTORE_FOLDER = os.path.abspath("duplicati_gui_test_direct_restore") # wait 5 seconds for duplicati server to start time.sleep(5) @@ -131,16 +131,20 @@ driver.find_element_by_id("nextStep4").click() driver.find_element_by_id("save").click() # Run the backup job and wait for finish -driver.find_element_by_link_text("Run now").click() +driver.find_element_by_link_text(BACKUP_NAME).click() +[n for n in driver.find_elements_by_xpath("//dl[@class='taskmenu']/dd/p/span[contains(text(),'Run now')]") if n.is_displayed()][0].click() wait_for_text(60, "//div[@class='task ng-scope']/dl[2]/dd[1]", "(took ") # Restore -driver.find_element_by_link_text(BACKUP_NAME).click() +if len([n for n in driver.find_elements_by_xpath("//span[contains(text(),'Restore files ...')]") if n.is_displayed()]) == 0: + driver.find_element_by_link_text(BACKUP_NAME).click() + [n for n in driver.find_elements_by_xpath("//span[contains(text(),'Restore files ...')]") if n.is_displayed()][0].click() driver.find_element_by_xpath("//span[contains(text(),'" + SOURCE_FOLDER + "')]") # wait for filelist time.sleep(1) driver.find_element_by_xpath("//restore-file-picker/ul/li/div/a[2]").click() # select root folder checkbox -driver.find_element_by_link_text("Continue").click() + +driver.find_element_by_xpath("//form[@id='restore']/div[1]/div[@class='buttons']/a/span[contains(text(), 'Continue')]").click() driver.find_element_by_id("restoretonewpath").click() driver.find_element_by_id("restore_path").send_keys(RESTORE_FOLDER) driver.find_element_by_xpath("//form[@id='restore']/div/div[@class='buttons']/a/span[contains(text(),'Restore')]").click() @@ -157,7 +161,12 @@ shutil.rmtree(RESTORE_FOLDER) os.rename(DESTINATION_FOLDER, DESTINATION_FOLDER_DIRECT_RESTORE) # direct restore -driver.find_element_by_link_text("Restore backup").click() +driver.find_element_by_link_text("Restore").click() + +# Choose the "restore direct" option +driver.find_element_by_id("direct").click() +driver.find_element_by_xpath("//input[@class='submit next']").click() + time.sleep(1) driver.find_element_by_link_text("Manually type path").click() driver.find_element_by_id("file_path").send_keys(DESTINATION_FOLDER_DIRECT_RESTORE) @@ -168,10 +177,13 @@ driver.find_element_by_id("connect").click() driver.find_element_by_xpath("//span[contains(text(),'" + SOURCE_FOLDER + "')]") # wait for filelist time.sleep(1) driver.find_element_by_xpath("//restore-file-picker/ul/li/div/a[2]").click() # select root folder checkbox -driver.find_element_by_link_text("Continue").click() +time.sleep(1) +driver.find_element_by_xpath("//form[@id='restore']/div[1]/div[@class='buttons']/a/span[contains(text(), 'Continue')]").click() + driver.find_element_by_id("restoretonewpath").click() driver.find_element_by_id("restore_path").send_keys(DIRECT_RESTORE_FOLDER) -driver.find_element_by_link_text("Restore").click() +driver.find_element_by_xpath("//form[@id='restore']/div/div[@class='buttons']/a/span[contains(text(),'Restore')]").click() + # wait for restore to finish wait_for_text(60, "//form[@id='restore']/div[3]/h3/div[1]", "Your files and folders have been restored successfully.") |