Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TE-1318 / Update and improve the UI test for 13.1 #9342

Merged
merged 11 commits into from
Dec 29, 2023
4 changes: 0 additions & 4 deletions tests/bdd/core/test_NAS_T1003.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 0 additions & 3 deletions tests/bdd/core/test_NAS_T1004.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 0 additions & 3 deletions tests/bdd/core/test_NAS_T1006.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 0 additions & 3 deletions tests/bdd/core/test_NAS_T1007.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 0 additions & 3 deletions tests/bdd/core/test_NAS_T1010.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 0 additions & 1 deletion tests/bdd/core/test_NAS_T1024.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
parsers
)


user = os.environ.get('USER')
mount_point = f'/tmp/iscsi_{"".join(random.choices(string.digits, k=2))}'

Expand Down
2 changes: 1 addition & 1 deletion tests/bdd/core/test_NAS_T1057.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
2 changes: 1 addition & 1 deletion tests/bdd/core/test_NAS_T1118.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(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()

Expand Down
2 changes: 2 additions & 0 deletions tests/bdd/core/test_NAS_T1121.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Empty file removed tests/bdd/core/test_NAS_T1135.py
Empty file.
Empty file removed tests/bdd/core/test_NAS_T1136.py
Empty file.
2 changes: 2 additions & 0 deletions tests/bdd/core/test_NAS_T1140.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
73 changes: 48 additions & 25 deletions tests/bdd/core/test_NAS_T1141.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -274,10 +277,14 @@ 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, 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, 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)
Expand All @@ -289,13 +296,15 @@ 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, 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, 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()
Expand Down Expand Up @@ -368,12 +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[@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')
Expand Down Expand Up @@ -426,12 +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, 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, 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()
Expand Down Expand Up @@ -483,12 +495,13 @@ 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, 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"]')
Expand All @@ -498,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')
Expand Down Expand Up @@ -538,22 +552,25 @@ 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, 5, '//div[@data-tooltip="Google Drive Folder: music"]')
driver.find_element_by_xpath('//div[@data-tooltip="Google Drive Folder: music"]').click()
assert wait_on_element(driver, 7, '//div[@data-tooltip="test" and @role="button"]')
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[@data-tooltip="Google Drive Folder: music"]')
assert wait_on_element(driver, 5, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]')
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, xpaths.google_Drive.move_To_Trash)
assert wait_on_element_disappear(driver, 10, '//div[@data-tooltip="PDF: Explaining_BSD.pdf"]')


Expand Down Expand Up @@ -587,12 +604,17 @@ 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, 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(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, 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()
Expand All @@ -615,19 +637,20 @@ 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, 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"]')
Expand Down
11 changes: 8 additions & 3 deletions tests/bdd/reusableSeleniumCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
6 changes: 6 additions & 0 deletions tests/bdd/xpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -37,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"]'
Expand Down
Loading