From 1b3967dabd3c27505e37512834f6149b8c43a012 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Thu, 7 Dec 2023 12:59:39 -0400 Subject: [PATCH 01/11] Did some minor change to fix some UI test issues --- tests/bdd/core/test_NAS_T1057.py | 2 +- tests/bdd/core/test_NAS_T1118.py | 2 +- tests/bdd/core/test_NAS_T1141.py | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1057.py b/tests/bdd/core/test_NAS_T1057.py index f74676284ca..4be55ac9d3d 100644 --- a/tests/bdd/core/test_NAS_T1057.py +++ b/tests/bdd/core/test_NAS_T1057.py @@ -75,6 +75,6 @@ def verify_that_the_login_popup_appears(driver): assert wait_on_element(driver, 7, '//span[@aria-label="Jira"]') assert wait_on_element(driver, 5, '//input[@id="username"]') assert wait_on_element(driver, 5, '//button[@id="login-submit"]', 'clickable') - assert wait_on_element(driver, 5, '//button[contains(.,"Continue with Google")]', 'clickable') + assert wait_on_element(driver, 5, '//button[@id="google-auth-button"]', 'clickable') driver.close() driver.switch_to.window(driver.window_handles[0]) diff --git a/tests/bdd/core/test_NAS_T1118.py b/tests/bdd/core/test_NAS_T1118.py index 07995f7048e..7f8b53f4801 100644 --- a/tests/bdd/core/test_NAS_T1118.py +++ b/tests/bdd/core/test_NAS_T1118.py @@ -135,7 +135,7 @@ def click_verify_credential_to_verify_the_key_id_is_invalid(driver): if wait_on_element(driver, 5, '//h1[contains(.,"Please wait")]'): assert wait_on_element_disappear(driver, 20, '//h1[contains(.,"Please wait")]') assert wait_on_element(driver, 10, '//h1[normalize-space(text())="Error"]') - assert wait_on_element(driver, 10, '//span[contains(.,"InvalidAccessKeyId:")]') + assert wait_on_element(driver, 10, '//span[contains(.,"NOTICE: s3: s3 provider "" not known - please set correctly")]') assert wait_on_element(driver, 5, '//button[@ix-auto="button__CLOSE"]', 'clickable') driver.find_element_by_xpath('//button[@ix-auto="button__CLOSE"]').click() diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index 743a258950b..477678d9474 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -274,13 +274,17 @@ def enter_the_user_name_click_Next_and_enter_the_password_click_Next(driver, use @then(parsers.parse('click on {folder1} then click on the test folder')) def click_on_folder1_then_click_on_the_test_folder(driver, folder1): """click on {folder1} then click on the test folder.""" + # Slow down the double click on the folder + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, f'//div[@data-tooltip="Google Drive Folder: {folder1}"]', 'clickable') + time.sleep(0.5) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath(f'//div[@data-tooltip="Google Drive Folder: {folder1}"]')).perform() assert wait_on_element(driver, 7, f'//div[@data-tooltip="{folder1}" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="Google Drive Folder: initial"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: test"]', 'clickable') - time.sleep(1) + time.sleep(0.5) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: test"]')).perform() time.sleep(1) @@ -290,12 +294,14 @@ def click_on_folder1_then_click_on_the_test_folder(driver, folder1): def verify_all_files_are_in_the_test_folder(driver): """verify all files are in the test folder.""" assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') 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, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -368,6 +374,7 @@ def verify_all_files_are_moved_from_the_google_drive_test_folder_to_the_dataset( driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') assert not is_element_present(driver, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]') assert not is_element_present(driver, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]') @@ -375,6 +382,7 @@ def verify_all_files_are_moved_from_the_google_drive_test_folder_to_the_dataset( action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert not is_element_present(driver, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]') 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() @@ -426,12 +434,14 @@ def verify_all_files_are_moved_from_the_dataset_to_the_google_drive_test_folder( driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') 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, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -484,6 +494,7 @@ def on_the_google_drive_test_folder_tab_delete_one_file(driver): """on the Google Drive test folder tab, delete one file.""" driver.switch_to.window(driver.window_handles[2]) assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]') driver.find_element_by_xpath('//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]').click() action = ActionChains(driver) @@ -588,11 +599,13 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver): driver.refresh() time.sleep(1) assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -616,6 +629,7 @@ def verify_the_file_is_removed_from_the_google_drive_test_folder_tab(driver): driver.refresh() time.sleep(1) assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') if not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]'): assert not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]') From 294a78595e6b226a3d03664dd441ec64afb4e8e2 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Fri, 8 Dec 2023 09:25:58 -0400 Subject: [PATCH 02/11] Added code to close aws popover also changed the error message to work with both message seen with AWS --- tests/bdd/core/test_NAS_T1118.py | 2 +- tests/bdd/core/test_NAS_T1121.py | 2 ++ tests/bdd/reusableSeleniumCode.py | 11 ++++++++--- tests/bdd/xpaths.py | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1118.py b/tests/bdd/core/test_NAS_T1118.py index 7f8b53f4801..6405187bdf3 100644 --- a/tests/bdd/core/test_NAS_T1118.py +++ b/tests/bdd/core/test_NAS_T1118.py @@ -135,7 +135,7 @@ def click_verify_credential_to_verify_the_key_id_is_invalid(driver): if wait_on_element(driver, 5, '//h1[contains(.,"Please wait")]'): assert wait_on_element_disappear(driver, 20, '//h1[contains(.,"Please wait")]') assert wait_on_element(driver, 10, '//h1[normalize-space(text())="Error"]') - assert wait_on_element(driver, 10, '//span[contains(.,"NOTICE: s3: s3 provider "" not known - please set correctly")]') + assert wait_on_element(driver, 10, '//span[contains(text(),"InvalidAccessKeyId:") or contains(text(),"NOTICE:")]') assert wait_on_element(driver, 5, '//button[@ix-auto="button__CLOSE"]', 'clickable') driver.find_element_by_xpath('//button[@ix-auto="button__CLOSE"]').click() diff --git a/tests/bdd/core/test_NAS_T1121.py b/tests/bdd/core/test_NAS_T1121.py index cb665980dbd..83313819249 100644 --- a/tests/bdd/core/test_NAS_T1121.py +++ b/tests/bdd/core/test_NAS_T1121.py @@ -196,6 +196,8 @@ def click_on_the_bucket_being_used_and_then_upload_a_file(driver): driver.find_element_by_xpath(f'//a[text()="{my_bucket}"]').click() assert wait_on_element(driver, 5, f'//h1[text()="{my_bucket}"]') assert wait_on_element(driver, 5, xpaths.aws.upload_Button, 'clickable') + rsc.click_If_Element_Exist(driver, xpaths.button.close_Popover) + s3_client = boto3.client('s3') s3_client.upload_file('cloud_test.txt', my_bucket, 'cloud_test.txt') driver.refresh() diff --git a/tests/bdd/reusableSeleniumCode.py b/tests/bdd/reusableSeleniumCode.py index b168c6473e4..3c8c48ff70a 100644 --- a/tests/bdd/reusableSeleniumCode.py +++ b/tests/bdd/reusableSeleniumCode.py @@ -6,12 +6,12 @@ ) -def click_The_Summit_Button(driver): +def click_The_Summit_Button(driver: classmethod): assert wait_on_element(driver, 7, xpaths.button.summit, 'clickable') driver.find_element_by_xpath(xpaths.button.summit).click() -def wait_For_The_Tab_To_Close(driver): +def wait_For_The_Tab_To_Close(driver: classmethod): for num in range(10): if len(driver.window_handles) == 1: return True @@ -20,8 +20,13 @@ def wait_For_The_Tab_To_Close(driver): return False -def scroll_To(driver, xpath): +def scroll_To(driver: classmethod, xpath: str): assert wait_on_element(driver, 5, xpath) element = driver.find_element_by_xpath(xpath) driver.execute_script("arguments[0].scrollIntoView();", element) time.sleep(0.2) + + +def click_If_Element_Exist(driver: classmethod, xpath: str): + if wait_on_element(driver, 5, xpath, 'clickable'): + driver.find_element_by_xpath(xpath).click() diff --git a/tests/bdd/xpaths.py b/tests/bdd/xpaths.py index 591f03dba90..a0fd68064df 100644 --- a/tests/bdd/xpaths.py +++ b/tests/bdd/xpaths.py @@ -21,6 +21,7 @@ class button: leave_Domain = '//button[@ix-auto="button__LEAVE DOMAIN"]' i_Agree = '//button[@ix-auto="button__I AGREE"]' summit = '//button[@ix-auto="button__SUBMIT"]' + close_Popover = '//button[@title="Close popover"]' class checkbox: From aa5e80ce7b827d3cca6c8bd44d18907d60d4d697 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 09:59:38 -0400 Subject: [PATCH 03/11] Change pytestmark to the google drive test to fix it Also to the iscsi test --- tests/bdd/core/test_NAS_T1003.py | 4 ---- tests/bdd/core/test_NAS_T1004.py | 3 --- tests/bdd/core/test_NAS_T1006.py | 3 --- tests/bdd/core/test_NAS_T1007.py | 3 --- tests/bdd/core/test_NAS_T1010.py | 3 --- tests/bdd/core/test_NAS_T1019.py | 2 ++ tests/bdd/core/test_NAS_T1020.py | 2 ++ tests/bdd/core/test_NAS_T1021.py | 2 ++ tests/bdd/core/test_NAS_T1022.py | 2 ++ tests/bdd/core/test_NAS_T1024.py | 3 ++- tests/bdd/core/test_NAS_T1025.py | 2 ++ tests/bdd/core/test_NAS_T1026.py | 2 ++ tests/bdd/core/test_NAS_T1027.py | 2 ++ tests/bdd/core/test_NAS_T1028.py | 2 ++ tests/bdd/core/test_NAS_T1140.py | 2 ++ tests/bdd/core/test_NAS_T1141.py | 4 +++- 16 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1003.py b/tests/bdd/core/test_NAS_T1003.py index 93ca1e67c6f..940536a5cf9 100644 --- a/tests/bdd/core/test_NAS_T1003.py +++ b/tests/bdd/core/test_NAS_T1003.py @@ -19,10 +19,6 @@ parsers ) -import pytest - -pytestmark = [pytest.mark.debug_test] - @scenario('features/NAS-T1003.feature', 'Setup AD and verify it is working') def test_setup_acl_and_verify_it_is_working(driver): diff --git a/tests/bdd/core/test_NAS_T1004.py b/tests/bdd/core/test_NAS_T1004.py index 39048e6488a..a9716206bb9 100644 --- a/tests/bdd/core/test_NAS_T1004.py +++ b/tests/bdd/core/test_NAS_T1004.py @@ -19,9 +19,6 @@ when, parsers ) -import pytest - -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1004.feature', 'Create an Active Directory dataset on a system dataset') diff --git a/tests/bdd/core/test_NAS_T1006.py b/tests/bdd/core/test_NAS_T1006.py index 6e94d217d66..7c38bf261be 100644 --- a/tests/bdd/core/test_NAS_T1006.py +++ b/tests/bdd/core/test_NAS_T1006.py @@ -19,9 +19,6 @@ when, parsers ) -import pytest - -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1006.feature', 'Create an Active Directory dataset on the tank pool') diff --git a/tests/bdd/core/test_NAS_T1007.py b/tests/bdd/core/test_NAS_T1007.py index a915fe19517..4f71f6d8d21 100644 --- a/tests/bdd/core/test_NAS_T1007.py +++ b/tests/bdd/core/test_NAS_T1007.py @@ -19,9 +19,6 @@ when, parsers ) -import pytest - -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1007.feature', 'Create an smb share with the tank AD permission dataset') diff --git a/tests/bdd/core/test_NAS_T1010.py b/tests/bdd/core/test_NAS_T1010.py index 47b07dad941..054c4156f7c 100644 --- a/tests/bdd/core/test_NAS_T1010.py +++ b/tests/bdd/core/test_NAS_T1010.py @@ -20,9 +20,6 @@ when, parsers ) -import pytest - -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1010.feature', 'Create an smb share with the system AD permission dataset') diff --git a/tests/bdd/core/test_NAS_T1019.py b/tests/bdd/core/test_NAS_T1019.py index 61773f8aacc..f1ca88e5b0a 100644 --- a/tests/bdd/core/test_NAS_T1019.py +++ b/tests/bdd/core/test_NAS_T1019.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1019.feature', 'Create a 1gb zvol call nopeer1 for the no peer iscsi test case') diff --git a/tests/bdd/core/test_NAS_T1020.py b/tests/bdd/core/test_NAS_T1020.py index 85b19cddd3c..7f965f5d26a 100644 --- a/tests/bdd/core/test_NAS_T1020.py +++ b/tests/bdd/core/test_NAS_T1020.py @@ -18,6 +18,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1020.feature', 'Create an iSCSI share without Authorized Access Peer with a zvol') diff --git a/tests/bdd/core/test_NAS_T1021.py b/tests/bdd/core/test_NAS_T1021.py index 4e8d8ecaf70..04305880b10 100644 --- a/tests/bdd/core/test_NAS_T1021.py +++ b/tests/bdd/core/test_NAS_T1021.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1021.feature', 'Create dataset name iscsi for iscsi file test cases') diff --git a/tests/bdd/core/test_NAS_T1022.py b/tests/bdd/core/test_NAS_T1022.py index 1ebb84ce242..4cf6b13d6c1 100644 --- a/tests/bdd/core/test_NAS_T1022.py +++ b/tests/bdd/core/test_NAS_T1022.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1022.feature', 'Create an iSCSI share without Authorized Access Peer with a file') diff --git a/tests/bdd/core/test_NAS_T1024.py b/tests/bdd/core/test_NAS_T1024.py index 78a3ebf849b..13dc0356274 100644 --- a/tests/bdd/core/test_NAS_T1024.py +++ b/tests/bdd/core/test_NAS_T1024.py @@ -21,7 +21,8 @@ when, parsers ) - +import pytest +pytestmark = [pytest.mark.debug_test] user = os.environ.get('USER') mount_point = f'/tmp/iscsi_{"".join(random.choices(string.digits, k=2))}' diff --git a/tests/bdd/core/test_NAS_T1025.py b/tests/bdd/core/test_NAS_T1025.py index eb3adbf2b8a..50e7ef9607a 100644 --- a/tests/bdd/core/test_NAS_T1025.py +++ b/tests/bdd/core/test_NAS_T1025.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1025.feature', 'Create a 1gb zvol call noauth1 for the no auth iscsi test case') diff --git a/tests/bdd/core/test_NAS_T1026.py b/tests/bdd/core/test_NAS_T1026.py index 3cfa19a50cc..bca06e3a6bc 100644 --- a/tests/bdd/core/test_NAS_T1026.py +++ b/tests/bdd/core/test_NAS_T1026.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1026.feature', 'Create an iSCSI share without Authorized Access with a zvol') diff --git a/tests/bdd/core/test_NAS_T1027.py b/tests/bdd/core/test_NAS_T1027.py index 4ad62c47ef5..37c9a027dc1 100644 --- a/tests/bdd/core/test_NAS_T1027.py +++ b/tests/bdd/core/test_NAS_T1027.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1027.feature', 'Create an iSCSI share without Authorized Access with a file') diff --git a/tests/bdd/core/test_NAS_T1028.py b/tests/bdd/core/test_NAS_T1028.py index 3259d5f5f31..73f0ee0ad68 100644 --- a/tests/bdd/core/test_NAS_T1028.py +++ b/tests/bdd/core/test_NAS_T1028.py @@ -21,6 +21,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] user = os.environ.get('USER') mount_point = f'/tmp/iscsi_{"".join(random.choices(string.digits, k=2))}' diff --git a/tests/bdd/core/test_NAS_T1140.py b/tests/bdd/core/test_NAS_T1140.py index ed9b8af4869..b2b55bf3d2b 100644 --- a/tests/bdd/core/test_NAS_T1140.py +++ b/tests/bdd/core/test_NAS_T1140.py @@ -16,6 +16,8 @@ when, parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1140.feature', 'Verify Google Drive credentials can be added') diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index 477678d9474..abdbb6143a0 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -20,6 +20,9 @@ parsers ) +import pytest +pytestmark = [pytest.mark.debug_test] + @scenario('features/NAS-T1141.feature', 'Verify Google Drive Cloud Sync task works') def test_verify_google_drive_cloud_sync_task_works(driver): @@ -382,7 +385,6 @@ def verify_all_files_are_moved_from_the_google_drive_test_folder_to_the_dataset( action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert not is_element_present(driver, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]') 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() From 0ac5538e0b535e0effd52ad8ebed2234fee93072 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 12:15:17 -0400 Subject: [PATCH 04/11] added longer wait for test folder --- tests/bdd/core/test_NAS_T1141.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index abdbb6143a0..9fd4272277b 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -296,7 +296,7 @@ def click_on_folder1_then_click_on_the_test_folder(driver, folder1): @then('verify all files are in the test folder') def verify_all_files_are_in_the_test_folder(driver): """verify all files are in the test folder.""" - assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') 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') @@ -495,7 +495,7 @@ def verify_all_files_are_sync_to_the_dataset_folder(driver, nas_ip): def on_the_google_drive_test_folder_tab_delete_one_file(driver): """on the Google Drive test folder tab, delete one file.""" driver.switch_to.window(driver.window_handles[2]) - assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]') driver.find_element_by_xpath('//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]').click() @@ -551,7 +551,7 @@ def verify_the_file_is_removed_from_the_dataset_folder(driver, nas_ip): def on_the_google_drive_test_folder_tab_delete_all_file(driver): """on the Google Drive test folder tab, delete all file.""" driver.switch_to.window(driver.window_handles[2]) - assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]') driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click() action = ActionChains(driver) @@ -600,7 +600,7 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver): time.sleep(1) driver.refresh() time.sleep(1) - assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') @@ -630,7 +630,7 @@ def verify_the_file_is_removed_from_the_google_drive_test_folder_tab(driver): while timeout > time.time(): driver.refresh() time.sleep(1) - assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @role="button"]') + assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') if not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]'): From 9b1eb651da7747943c2fb538eac236b9139b3cf1 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 13:23:06 -0400 Subject: [PATCH 05/11] change the sleep before click test folder to 1 second --- tests/bdd/core/test_NAS_T1141.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index 9fd4272277b..e3adbf68c22 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -287,7 +287,7 @@ def click_on_folder1_then_click_on_the_test_folder(driver, folder1): assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="Google Drive Folder: initial"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: test"]', 'clickable') - time.sleep(0.5) + time.sleep(1) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: test"]')).perform() time.sleep(1) From bb1dd3b52a52106f347667e80494e22d483307ec Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 13:34:24 -0400 Subject: [PATCH 06/11] sleep .5 before expending My Google Drive task --- tests/bdd/core/test_NAS_T1135.py | 0 tests/bdd/core/test_NAS_T1136.py | 0 tests/bdd/core/test_NAS_T1141.py | 1 + 3 files changed, 1 insertion(+) delete mode 100644 tests/bdd/core/test_NAS_T1135.py delete mode 100644 tests/bdd/core/test_NAS_T1136.py diff --git a/tests/bdd/core/test_NAS_T1135.py b/tests/bdd/core/test_NAS_T1135.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/bdd/core/test_NAS_T1136.py b/tests/bdd/core/test_NAS_T1136.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index e3adbf68c22..bfad3fcf6ea 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -511,6 +511,7 @@ def on_the_google_drive_test_folder_tab_delete_one_file(driver): def on_the_nas_cloud_sync_task_tab_click_run_now(driver): """on the NAS cloud sync task tab, click Run Now.""" driver.switch_to.window(driver.window_handles[0]) + time.sleep(0.5) assert wait_on_element(driver, 7, '//div[contains(.,"Cloud Sync Tasks")]') assert wait_on_element(driver, 10, '//div[contains(text(),"My Google Drive task")]') assert wait_on_element(driver, 5, '//a[@ix-auto="expander__My Google Drive task"]', 'clickable') From a7dd75628fcd5e6a41933db330f1421fc672f26c Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 14:10:43 -0400 Subject: [PATCH 07/11] only test Google drive cloud sync test --- tests/bdd/core/test_NAS_T1019.py | 2 -- tests/bdd/core/test_NAS_T1020.py | 2 -- tests/bdd/core/test_NAS_T1021.py | 2 -- tests/bdd/core/test_NAS_T1022.py | 2 -- tests/bdd/core/test_NAS_T1024.py | 2 -- tests/bdd/core/test_NAS_T1025.py | 2 -- tests/bdd/core/test_NAS_T1026.py | 2 -- tests/bdd/core/test_NAS_T1027.py | 2 -- tests/bdd/core/test_NAS_T1028.py | 2 -- 9 files changed, 18 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1019.py b/tests/bdd/core/test_NAS_T1019.py index f1ca88e5b0a..61773f8aacc 100644 --- a/tests/bdd/core/test_NAS_T1019.py +++ b/tests/bdd/core/test_NAS_T1019.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1019.feature', 'Create a 1gb zvol call nopeer1 for the no peer iscsi test case') diff --git a/tests/bdd/core/test_NAS_T1020.py b/tests/bdd/core/test_NAS_T1020.py index 7f965f5d26a..85b19cddd3c 100644 --- a/tests/bdd/core/test_NAS_T1020.py +++ b/tests/bdd/core/test_NAS_T1020.py @@ -18,8 +18,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1020.feature', 'Create an iSCSI share without Authorized Access Peer with a zvol') diff --git a/tests/bdd/core/test_NAS_T1021.py b/tests/bdd/core/test_NAS_T1021.py index 04305880b10..4e8d8ecaf70 100644 --- a/tests/bdd/core/test_NAS_T1021.py +++ b/tests/bdd/core/test_NAS_T1021.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1021.feature', 'Create dataset name iscsi for iscsi file test cases') diff --git a/tests/bdd/core/test_NAS_T1022.py b/tests/bdd/core/test_NAS_T1022.py index 4cf6b13d6c1..1ebb84ce242 100644 --- a/tests/bdd/core/test_NAS_T1022.py +++ b/tests/bdd/core/test_NAS_T1022.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1022.feature', 'Create an iSCSI share without Authorized Access Peer with a file') diff --git a/tests/bdd/core/test_NAS_T1024.py b/tests/bdd/core/test_NAS_T1024.py index 13dc0356274..409860a6276 100644 --- a/tests/bdd/core/test_NAS_T1024.py +++ b/tests/bdd/core/test_NAS_T1024.py @@ -21,8 +21,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] user = os.environ.get('USER') mount_point = f'/tmp/iscsi_{"".join(random.choices(string.digits, k=2))}' diff --git a/tests/bdd/core/test_NAS_T1025.py b/tests/bdd/core/test_NAS_T1025.py index 50e7ef9607a..eb3adbf2b8a 100644 --- a/tests/bdd/core/test_NAS_T1025.py +++ b/tests/bdd/core/test_NAS_T1025.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1025.feature', 'Create a 1gb zvol call noauth1 for the no auth iscsi test case') diff --git a/tests/bdd/core/test_NAS_T1026.py b/tests/bdd/core/test_NAS_T1026.py index bca06e3a6bc..3cfa19a50cc 100644 --- a/tests/bdd/core/test_NAS_T1026.py +++ b/tests/bdd/core/test_NAS_T1026.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1026.feature', 'Create an iSCSI share without Authorized Access with a zvol') diff --git a/tests/bdd/core/test_NAS_T1027.py b/tests/bdd/core/test_NAS_T1027.py index 37c9a027dc1..4ad62c47ef5 100644 --- a/tests/bdd/core/test_NAS_T1027.py +++ b/tests/bdd/core/test_NAS_T1027.py @@ -16,8 +16,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] @scenario('features/NAS-T1027.feature', 'Create an iSCSI share without Authorized Access with a file') diff --git a/tests/bdd/core/test_NAS_T1028.py b/tests/bdd/core/test_NAS_T1028.py index 73f0ee0ad68..3259d5f5f31 100644 --- a/tests/bdd/core/test_NAS_T1028.py +++ b/tests/bdd/core/test_NAS_T1028.py @@ -21,8 +21,6 @@ when, parsers ) -import pytest -pytestmark = [pytest.mark.debug_test] user = os.environ.get('USER') mount_point = f'/tmp/iscsi_{"".join(random.choices(string.digits, k=2))}' From 9add74e31f2ff37fc6bdd87beb2b405a9239d538 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 15:14:34 -0400 Subject: [PATCH 08/11] Adding second sleep after folder is found for google drive test cases --- tests/bdd/core/test_NAS_T1141.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index bfad3fcf6ea..a105a87aaac 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -280,7 +280,7 @@ def click_on_folder1_then_click_on_the_test_folder(driver, folder1): # Slow down the double click on the folder assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, f'//div[@data-tooltip="Google Drive Folder: {folder1}"]', 'clickable') - time.sleep(0.5) + time.sleep(1) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath(f'//div[@data-tooltip="Google Drive Folder: {folder1}"]')).perform() assert wait_on_element(driver, 7, f'//div[@data-tooltip="{folder1}" and @role="button"]') @@ -605,6 +605,7 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver): assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') + time.sleep(1) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') From 8748b1de277d563e32e8c9f5a88d03741f56ae67 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 15:56:19 -0400 Subject: [PATCH 09/11] See if selecting the folder before double clicking make a difference. --- tests/bdd/core/test_NAS_T1141.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index a105a87aaac..d56f8eaa97a 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -606,6 +606,8 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver): assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') time.sleep(1) + # Select + driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click() action = ActionChains(driver) action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') From 5eefbaeac19166d467de4601aa50c429eaddd42f Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 11 Dec 2023 16:30:49 -0400 Subject: [PATCH 10/11] Ensure the 'Move to trash?' dialog is out of the way --- tests/bdd/core/test_NAS_T1141.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index d56f8eaa97a..b0715fd3e62 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -553,21 +553,24 @@ def on_the_google_drive_test_folder_tab_delete_all_file(driver): """on the Google Drive test folder tab, delete all file.""" driver.switch_to.window(driver.window_handles[2]) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]') + assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() assert wait_on_element(driver, 5, '//div[text()="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[text()="Move to trash?"]') assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="Google Drive Folder: music"]') - assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]') + 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() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() assert wait_on_element(driver, 5, '//div[text()="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[text()="Move to trash?"]') assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]') From 59089f7f7a9de502d56c127922303f4dd709c170 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 18 Dec 2023 15:57:31 -0400 Subject: [PATCH 11/11] Changed Google Drive xpaths that touch --- tests/bdd/core/test_NAS_T1141.py | 68 ++++++++++++++++---------------- tests/bdd/xpaths.py | 5 +++ 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/tests/bdd/core/test_NAS_T1141.py b/tests/bdd/core/test_NAS_T1141.py index b0715fd3e62..fa5478c0e12 100644 --- a/tests/bdd/core/test_NAS_T1141.py +++ b/tests/bdd/core/test_NAS_T1141.py @@ -278,13 +278,13 @@ def enter_the_user_name_click_Next_and_enter_the_password_click_Next(driver, use def click_on_folder1_then_click_on_the_test_folder(driver, folder1): """click on {folder1} then click on the test folder.""" # Slow down the double click on the folder - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, f'//div[@data-tooltip="Google Drive Folder: {folder1}"]', 'clickable') time.sleep(1) action = ActionChains(driver) action.double_click(driver.find_element_by_xpath(f'//div[@data-tooltip="Google Drive Folder: {folder1}"]')).perform() assert wait_on_element(driver, 7, f'//div[@data-tooltip="{folder1}" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="Google Drive Folder: initial"]', 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: test"]', 'clickable') time.sleep(1) @@ -297,14 +297,14 @@ def click_on_folder1_then_click_on_the_test_folder(driver, folder1): 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, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') 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, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable') action = ActionChains(driver) - action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() + action.double_click(driver.find_element_by_xpath(xpaths.google_Drive.music_Folder)).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -377,13 +377,13 @@ def verify_all_files_are_moved_from_the_google_drive_test_folder_to_the_dataset( driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') - assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable') assert not is_element_present(driver, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]') assert not is_element_present(driver, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]') - assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder) action = ActionChains(driver) - action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() + action.double_click(driver.find_element_by_xpath(xpaths.google_Drive.music_Folder)).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') assert not is_element_present(driver, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]') assert wait_on_element(driver, 5, '//div[@data-tooltip="test" and @data-tooltip-unhoverable="true" and @role="link"]', 'clickable') @@ -436,14 +436,14 @@ def verify_all_files_are_moved_from_the_dataset_to_the_google_drive_test_folder( driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') 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, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable') action = ActionChains(driver) - action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() + action.double_click(driver.find_element_by_xpath(xpaths.google_Drive.music_Folder)).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -496,12 +496,12 @@ def on_the_google_drive_test_folder_tab_delete_one_file(driver): """on the Google Drive test folder tab, delete one file.""" driver.switch_to.window(driver.window_handles[2]) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]') driver.find_element_by_xpath('//div[@data-tooltip="Image: Gloomy_Forest_wallpaper_ForWallpapercom.jpg"]').click() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() - assert wait_on_element(driver, 5, '//div[text()="Move to trash?"]') + 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"]') @@ -553,24 +553,24 @@ def on_the_google_drive_test_folder_tab_delete_all_file(driver): """on the Google Drive test folder tab, delete all file.""" driver.switch_to.window(driver.window_handles[2]) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') - assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') - driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click() + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable') + driver.find_element_by_xpath(xpaths.google_Drive.music_Folder).click() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() - assert wait_on_element(driver, 5, '//div[text()="Move to trash?"]') + 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[text()="Move to trash?"]') - assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="Google Drive Folder: music"]') + 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() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() - assert wait_on_element(driver, 5, '//div[text()="Move to trash?"]') + 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[text()="Move to trash?"]') + 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"]') @@ -605,16 +605,16 @@ def verify_all_files_are_sync_to_the_google_drive_test_folder_tab(driver): driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') - assert wait_on_element(driver, 5, '//div[@data-tooltip="Google Drive Folder: music"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.music_Folder, 'clickable') time.sleep(1) # Select - driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click() + driver.find_element_by_xpath(xpaths.google_Drive.music_Folder).click() action = ActionChains(driver) - action.double_click(driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]')).perform() + action.double_click(driver.find_element_by_xpath(xpaths.google_Drive.music_Folder)).perform() assert wait_on_element(driver, 5, '//div[@data-tooltip="music" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 5, '//div[@data-tooltip="Audio: Mr_Smith_Pequeñas_Guitarras.mp3"]', '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() @@ -638,19 +638,19 @@ def verify_the_file_is_removed_from_the_google_drive_test_folder_tab(driver): driver.refresh() time.sleep(1) assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]') - assert wait_on_element(driver, 5, '//div[contains(text(),"Name") and @role="button"]', 'clickable') + assert wait_on_element(driver, 5, xpaths.google_Drive.name_Sort, 'clickable') assert wait_on_element(driver, 7, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]', 'clickable') - if not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]'): - assert not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]') + if not is_element_present(driver, xpaths.google_Drive.music_Folder): + assert not is_element_present(driver, xpaths.google_Drive.music_Folder) break else: - assert not is_element_present(driver, '//div[@data-tooltip="Google Drive Folder: music"]') + assert not is_element_present(driver, 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() action = ActionChains(driver) action.send_keys(Keys.DELETE).perform() - assert wait_on_element(driver, 5, '//div[text()="Move to trash?"]') + 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"]') diff --git a/tests/bdd/xpaths.py b/tests/bdd/xpaths.py index a0fd68064df..7409c9ce626 100644 --- a/tests/bdd/xpaths.py +++ b/tests/bdd/xpaths.py @@ -38,6 +38,11 @@ class domain_Credentials: title = '//h4[contains(.,"Domain Credentials")]' +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?"]' + class input: username = '//input[@ix-auto="input__Username"]' password = '//input[@ix-auto="input__Password"]'