Skip to content

Commit

Permalink
TEN-1552 / 13.3 / Fixed Google and Backblaze cloud sync test. (#10416)
Browse files Browse the repository at this point in the history
* Fixed some Google Drive xpath

* Fixed Backblaze login

* Fixed upper case in test function
  • Loading branch information
ericbsd authored Aug 8, 2024
1 parent 2d89398 commit 5b25fbf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
42 changes: 21 additions & 21 deletions tests/bdd/core/test_NAS_T1141.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ def verify_all_files_are_in_the_test_folder(driver):
"""verify all files are in the test folder."""
assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
assert wait_on_element(driver, 5, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]', 'clickable')
assert wait_on_element(driver, 5, xpaths.google_Drive.pdf_file, 'clickable')
assert wait_on_element(driver, 5, xpaths.google_Drive.image_file, 'clickable')
rsc.double_click(driver, xpaths.google_Drive.music_Folder)
assert wait_on_element(driver, 7, '//div[@data-tooltip="music" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', 'clickable')
assert wait_on_element(driver, 5, xpaths.google_Drive.mp3_file, 'clickable')
assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]').click()

Expand Down Expand Up @@ -365,11 +365,11 @@ def verify_all_files_are_moved_from_the_google_drive_test_folder_to_the_dataset(
assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable')
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]')
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]')
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.pdf_file)
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.image_file)
rsc.double_click(driver, xpaths.google_Drive.music_Folder)
assert wait_on_element(driver, 7, '//div[@data-tooltip="music" and @role="button"]')
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]')
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.mp3_file)
assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]').click()

Expand Down Expand Up @@ -418,12 +418,12 @@ def verify_all_files_are_moved_from_the_dataset_to_the_google_drive_test_folder(
driver.switch_to.window(driver.window_handles[1])
assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 15, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
assert wait_on_element(driver, 15, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]', 'clickable')
assert wait_on_element(driver, 15, xpaths.google_Drive.pdf_file, 'clickable')
assert wait_on_element(driver, 15, xpaths.google_Drive.image_file, 'clickable')
rsc.double_click(driver, xpaths.google_Drive.music_Folder)
assert wait_on_element(driver, 7, '//div[@data-tooltip="music" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 10, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', 'clickable')
assert wait_on_element(driver, 10, xpaths.google_Drive.mp3_file, 'clickable')
assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]').click()

Expand Down Expand Up @@ -476,14 +476,14 @@ def on_the_google_drive_test_folder_tab_delete_one_file(driver):
driver.switch_to.window(driver.window_handles[1])
assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 10, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]')
driver.find_element_by_xpath('//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]').click()
assert wait_on_element(driver, 10, xpaths.google_Drive.image_file)
driver.find_element_by_xpath(xpaths.google_Drive.image_file).click()
action = ActionChains(driver)
action.send_keys(Keys.DELETE).perform()
assert wait_on_element(driver, 5, xpaths.google_Drive.move_To_Trash)
assert wait_on_element(driver, 5, '//button[*/text()="Move to trash"]', 'clickable')
driver.find_element_by_xpath('//button[*/text()="Move to trash"]').click()
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]')
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.image_file)


@then('on the NAS cloud sync task tab, click Run Now')
Expand Down Expand Up @@ -542,15 +542,15 @@ def on_the_google_drive_test_folder_tab_delete_all_file(driver):
driver.find_element_by_xpath('//button[*/text()="Move to trash"]').click()
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.move_To_Trash)
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.music_Folder)
assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="PDF: Explaining_BSD.pdf"]').click()
assert wait_on_element(driver, 5, xpaths.google_Drive.pdf_file, 'clickable')
driver.find_element_by_xpath(xpaths.google_Drive.pdf_file).click()
action = ActionChains(driver)
action.send_keys(Keys.DELETE).perform()
assert wait_on_element(driver, 5, xpaths.google_Drive.move_To_Trash)
assert wait_on_element(driver, 5, '//button[*/text()="Move to trash"]', 'clickable')
driver.find_element_by_xpath('//button[*/text()="Move to trash"]').click()
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.move_To_Trash)
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]')
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.pdf_file)


@then('select PUSH as the Direction then under Transfer Mode, select SYNC')
Expand Down Expand Up @@ -582,13 +582,13 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver):
driver.switch_to.window(driver.window_handles[1])
assert wait_on_element(driver, 10, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 15, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
assert wait_on_element(driver, 10, xpaths.google_Drive.pdf_file, 'clickable')
assert wait_on_element(driver, 10, xpaths.google_Drive.music_Folder, 'clickable')
driver.find_element_by_xpath(xpaths.google_Drive.music_Folder).click()
rsc.double_click(driver, xpaths.google_Drive.music_Folder)
assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]')
assert wait_on_element(driver, 7, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', 'clickable')
assert wait_on_element(driver, 5, xpaths.google_Drive.mp3_file, 'clickable')
assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]').click()

Expand All @@ -607,16 +607,16 @@ def verify_the_file_is_removed_from_the_google_drive_test_folder_tab(driver):
driver.switch_to.window(driver.window_handles[1])
assert wait_on_element(driver, 10, '//div[@data-tooltip="test" and @role="button"]')
assert wait_on_element(driver, 15, xpaths.google_Drive.name_Sort)
assert wait_on_element(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
assert wait_on_element(driver, 10, xpaths.google_Drive.pdf_file, 'clickable')
assert wait_on_element_disappear(driver, 15, xpaths.google_Drive.music_Folder)
# clean the test folder on box tab before closing the tab.
assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable')
driver.find_element_by_xpath('//div[@data-tooltip="PDF: Explaining_BSD.pdf"]').click()
assert wait_on_element(driver, 5, xpaths.google_Drive.pdf_file, 'clickable')
driver.find_element_by_xpath(xpaths.google_Drive.pdf_file).click()
action = ActionChains(driver)
action.send_keys(Keys.DELETE).perform()
assert wait_on_element(driver, 5, xpaths.google_Drive.move_To_Trash)
assert wait_on_element(driver, 5, '//button[*/text()="Move to trash"]', 'clickable')
driver.find_element_by_xpath('//button[*/text()="Move to trash"]').click()
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]')
assert wait_on_element_disappear(driver, 10, xpaths.google_Drive.pdf_file)
driver.close()
driver.switch_to.window(driver.window_handles[0])
7 changes: 3 additions & 4 deletions tests/bdd/core/test_NAS_T1143.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ def open_a_new_tab_navigate_to_backblaze_url_click_sign_in(driver, backblaze_url
driver.get(backblaze_url)
time.sleep(1)
assert wait_on_element(driver, 7, '//img[@alt="Backblaze Logo"]')
assert wait_on_element(driver, 5, '//a[text()="Sign In"]', 'clickable')


@then('enter the <user_name> click Next and enter the <password> click Next')
def enter_the_user_name_click_Next_and_enter_the_password_click_Next(driver, user_name, password):
def enter_the_user_name_click_next_and_enter_the_password_click_next(driver, user_name, password):
"""enter the <user_name> click Next and enter the <password> click Next."""
assert wait_on_element(driver, 5, '//h3[text()="Welcome Back"]')
assert wait_on_element(driver, 5, '//h1[text()="Welcome Back"]')
time.sleep(1)
assert wait_on_element(driver, 5, '//input[@name="email-field"]', 'inputable')
driver.find_element_by_xpath('//input[@name="email-field"]').send_keys(user_name)
Expand All @@ -121,7 +120,7 @@ def enter_the_user_name_click_Next_and_enter_the_password_click_Next(driver, use


@then(parsers.parse('click on Browser Files, click on {bucket} bucket'))
def click_on_Browser_Files_click_on_bucket_then_click_on_the_test_folder(driver, bucket):
def click_on_browser_files_click_on_bucket_then_click_on_the_test_folder(driver, bucket):
"""click on Browser Files, click on {bucket}, then click on the bucket."""
global my_bucket
my_bucket = bucket
Expand Down
3 changes: 3 additions & 0 deletions tests/bdd/xpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class google_Drive:
name_Sort = '//div[contains(text(),"Name") and @role="button"]'
music_Folder = '//div[@data-tooltip="Google Drive Folder: music"]'
move_To_Trash = '//div[text()="Move to trash?"]'
pdf_file = '//div[@aria-label="Explaining_BSD.pdf PDF"]'
image_file = '//div[@aria-label="Gloomy_Forest_wallpaper_ForWallpapercom.jpg Image"]'
mp3_file = '//div[@aria-label="Mr_Smith_Pequeñas_Guitarras.mp3 Audio"]'


class input:
Expand Down

0 comments on commit 5b25fbf

Please sign in to comment.