From ac09caafb89ae677d9a7fa90a8ca786b906a8bde Mon Sep 17 00:00:00 2001 From: ericbsd Date: Fri, 19 Apr 2024 10:05:14 -0300 Subject: [PATCH 01/14] Fixed HA enable SSH test. --- tests/bdd/ha-bhyve02/test_NAS_T0904.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0904.py b/tests/bdd/ha-bhyve02/test_NAS_T0904.py index b9e37fa2808..6583f88f95e 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0904.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0904.py @@ -72,11 +72,7 @@ def the_service_page_should_open(driver): @then('press on configure(pencil) SSH') def press_on_configure_ssh(driver): """press on configure(pencil) SSH.""" - assert wait_on_element(driver, 5, '//button[@ix-auto="button__S3_Actions"]') - # Scroll to SSH service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) + assert wait_on_element(driver, 5, '//button[@ix-auto="button__SSH_Actions"]', 'clickable') driver.find_element_by_xpath('//button[@ix-auto="button__SSH_Actions"]').click() @@ -107,11 +103,6 @@ def click_save(driver): def click_start_automatically_ssh_checkbox_and_enable_the_ssh_service(driver): """click Start Automatically SSH checkbox and enable the SSH service.""" assert wait_on_element(driver, 5, '//services') - assert wait_on_element(driver, 5, '//button[@ix-auto="button__S3_Actions"]') - # Scroll to SSH service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) assert wait_on_element(driver, 5, '//mat-checkbox[@ix-auto="checkbox__SSH_Start Automatically"]', 'clickable') value_exist = attribute_value_exist(driver, '//mat-checkbox[@ix-auto="checkbox__SSH_Start Automatically"]', 'class', 'mat-checkbox-checked') if not value_exist: From a21cc3ec1085c76fd92bb1f28fbbcaa1e6812daa Mon Sep 17 00:00:00 2001 From: ericbsd Date: Fri, 19 Apr 2024 16:45:08 -0300 Subject: [PATCH 02/14] fixed test_NAS_T0988.py with sudo function --- tests/bdd/ha-bhyve02/test_NAS_T0910.py | 30 +++++++++----------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0910.py b/tests/bdd/ha-bhyve02/test_NAS_T0910.py index 46567c15797..9d86e171907 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0910.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0910.py @@ -3,9 +3,12 @@ import reusableSeleniumCode as rsc import xpaths -from function import wait_on_element, is_element_present, wait_on_element_disappear -from selenium.webdriver.common.action_chains import ActionChains -from selenium.webdriver.common.keys import Keys +from function import ( + wait_on_element, + is_element_present, + wait_on_element_disappear, + ssh_sudo +) import time from pytest_bdd import ( given, @@ -150,25 +153,12 @@ def updated_value_should_be_visible(driver): @then('Open shell and run su user to become that user') def open_shell_and_run_su_user(driver): """Open shell and run su user to become that user.""" - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Shell"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - assert wait_on_element(driver, 7, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(5) - actions = ActionChains(driver) - actions.send_keys('su ericbsd', Keys.ENTER) - actions.perform() + global sudo_results + cmd = 'ls /var/db/sudo' + sudo_results = ssh_sudo(cmd, nas_ip, 'ericbsd', 'testing') @then('User should be able to use Sudo') def user_should_be_able_to_use_sudo(driver): """User should be able to use Sudo.""" - time.sleep(1) - actions = ActionChains(driver) - actions.send_keys('sudo ls /var/db/sudo', Keys.ENTER) - actions.perform() - time.sleep(1) - assert wait_on_element(driver, 7, '//span[contains(.,"Password:")]') - actions.send_keys('testing', Keys.ENTER) - actions.perform() - assert wait_on_element(driver, 7, '//span[contains(.,"lectured")]') - driver.find_element_by_xpath('//span[contains(.,"lectured")]') + assert "lectured" in sudo_results, str(sudo_results) From c92076f67ef4837392e6519e6c91ab5e72fa12fa Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 15:24:11 -0300 Subject: [PATCH 03/14] Replaced shell UI code in NAS-T914 by ssh_cmd. --- tests/bdd/ha-bhyve02/test_NAS_T0914.py | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0914.py b/tests/bdd/ha-bhyve02/test_NAS_T0914.py index 509f8a5d35c..5395c39d43f 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0914.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0914.py @@ -4,7 +4,12 @@ import reusableSeleniumCode as rsc import xpaths import time -from function import wait_on_element, is_element_present, wait_on_element_disappear +from function import ( + wait_on_element, + is_element_present, + wait_on_element_disappear, + ssh_cmd +) from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from pytest_bdd import ( @@ -161,24 +166,12 @@ def try_login_with_ssh(driver): class_attribute = element.get_attribute('class') if 'mat-checked' not in class_attribute: driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Shell"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - assert wait_on_element(driver, 7, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(4) - actions = ActionChains(driver) - actions.send_keys('ssh ericbsd@127.0.0.1', Keys.ENTER) - actions.perform() - if wait_on_element(driver, 4, '//span[contains(text(),"(yes/no/[fingerprint])?")]'): - actions = ActionChains(driver) - actions.send_keys('yes', Keys.ENTER) - actions.perform() - assert wait_on_element(driver, 4, '//span[contains(.,"password:")]') - actions = ActionChains(driver) - actions.send_keys('testing', Keys.ENTER) - actions.perform() + global ssh_result + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) @then('User should not be able to login') def user_should_not_be_able_to_login(driver): """User should not be able to login.""" - assert wait_on_element(driver, 5, '//span[contains(.,"Permission") and contains(.,"denied,")]') + assert not ssh_result['result'], ssh_result['output'] + assert 'default' not in ssh_result['output'], ssh_result['output'] From a0249d58e2b9ce5b9ff1d1ae66ef183b5b9bcfe2 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 15:43:36 -0300 Subject: [PATCH 04/14] Replaced shell UI code in NAS-T915 and NAS-T916 by ssh_cmd. --- tests/bdd/ha-bhyve02/test_NAS_T0914.py | 2 -- tests/bdd/ha-bhyve02/test_NAS_T0915.py | 31 ++++++------------- tests/bdd/ha-bhyve02/test_NAS_T0916.py | 42 +++++++++----------------- 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0914.py b/tests/bdd/ha-bhyve02/test_NAS_T0914.py index 5395c39d43f..2fe86d1bfbd 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0914.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0914.py @@ -10,8 +10,6 @@ wait_on_element_disappear, ssh_cmd ) -from selenium.webdriver.common.action_chains import ActionChains -from selenium.webdriver.common.keys import Keys from pytest_bdd import ( given, scenario, diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0915.py b/tests/bdd/ha-bhyve02/test_NAS_T0915.py index fe8cf1b72cc..6c480471e1d 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0915.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0915.py @@ -4,9 +4,12 @@ import reusableSeleniumCode as rsc import xpaths import time -from function import wait_on_element, is_element_present, wait_on_element_disappear -from selenium.webdriver.common.action_chains import ActionChains -from selenium.webdriver.common.keys import Keys +from function import ( + wait_on_element, + is_element_present, + wait_on_element_disappear, + ssh_cmd +) from pytest_bdd import ( given, scenario, @@ -161,26 +164,12 @@ def try_login_with_ssh(driver): if 'mat-checked' not in class_attribute: driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() time.sleep(4) - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Shell"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - assert wait_on_element(driver, 7, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(5) - actions = ActionChains(driver) - actions.send_keys('ssh ericbsd@127.0.0.1', Keys.ENTER) - actions.perform() - time.sleep(1) - if wait_on_element(driver, 4, '//span[contains(text(),"(yes/no/[fingerprint])?")]'): - actions = ActionChains(driver) - actions.send_keys('yes', Keys.ENTER) - actions.perform() - time.sleep(1) - assert wait_on_element(driver, 4, '//span[contains(.,"password:")]') - actions = ActionChains(driver) - actions.send_keys('testing', Keys.ENTER) - actions.perform() + global ssh_result + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) @then('User should be able to login') def user_should_be_able_to_login(driver): """User should be able to login.""" - assert wait_on_element(driver, 5, '//span[contains(.,"Welcome")]') + assert ssh_result['result'], ssh_result['output'] + assert 'default' in ssh_result['output'], ssh_result['output'] diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0916.py b/tests/bdd/ha-bhyve02/test_NAS_T0916.py index 6f5b847765b..c50a87f80a2 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0916.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0916.py @@ -4,9 +4,12 @@ import reusableSeleniumCode as rsc import xpaths import time -from function import wait_on_element, is_element_present, wait_on_element_disappear -from selenium.webdriver.common.action_chains import ActionChains -from selenium.webdriver.common.keys import Keys +from function import ( + wait_on_element, + is_element_present, + wait_on_element_disappear, + ssh_cmd +) from pytest_bdd import ( given, scenario, @@ -133,43 +136,26 @@ def change_should_be_saved(driver): @then('Log out and try to log back in with the old password for that user') def log_out_and_try_to_log_back_in_with_the_old_password_for_that_user(driver): """Log out and try to log back in with the old password for that user.""" - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Shell"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - assert wait_on_element(driver, 7, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(4) - actions = ActionChains(driver) - actions.send_keys('ssh ericbsd@127.0.0.1', Keys.ENTER) - actions.perform() - assert wait_on_element(driver, 4, '//span[contains(.,"password:")]') - actions = ActionChains(driver) - actions.send_keys('testing', Keys.ENTER) - actions.perform() + global ssh_result + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) @then('User should not be able to log in ssh with the old password') def user_should_not_be_able_to_log_in_ssh_with_the_old_password(driver): """User should not be able to log in ssh with the old password.""" - assert wait_on_element(driver, 5, '//span[contains(.,"Permission") and contains(.,"denied,")]') + assert not ssh_result['result'], ssh_result['output'] + assert 'default' not in ssh_result['output'], ssh_result['output'] @then('Try to log back in ssh with the new password for that user') def try_to_log_back_in_ssh_with_the_new_password_for_that_user(driver): """Try to log back in ssh with the new password for that user.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Dashboard"]').click() - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Shell"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - assert wait_on_element(driver, 7, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(4) - actions = ActionChains(driver) - actions.send_keys('ssh ericbsd@127.0.0.1', Keys.ENTER) - actions.perform() - assert wait_on_element(driver, 4, '//span[contains(.,"password:")]') - actions = ActionChains(driver) - actions.send_keys('testing1', Keys.ENTER) - actions.perform() + global ssh_result + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing1234', nas_ip) @then('User should be able to log in with new password') def user_should_be_able_to_log_in_with_new_password(driver): """User should be able to log in with new password.""" - assert not wait_on_element(driver, 2, '//span[contains(.,"Permission") and contains(.,"denied,")]') + assert ssh_result['result'], ssh_result['output'] + assert 'default' in ssh_result['output'], ssh_result['output'] From ccf1eb525c1a0ea790f45f3db47fc1031756e713 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 16:06:52 -0300 Subject: [PATCH 05/14] Fixed nas_ip in NAS-T915 and NAS-T916 --- tests/bdd/ha-bhyve02/test_NAS_T0915.py | 4 +++- tests/bdd/ha-bhyve02/test_NAS_T0916.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0915.py b/tests/bdd/ha-bhyve02/test_NAS_T0915.py index 6c480471e1d..d84339e9a6d 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0915.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0915.py @@ -27,6 +27,8 @@ def test_edit_user_enable_password(driver): @given(parsers.parse('The browser is open navigate to "{nas_url}"')) def the_browser_is_open_navigate_to_nas_url(driver, nas_url): """The browser is open navigate to "{nas_user}".""" + global nas_host + nas_host = nas_url if nas_url not in driver.current_url: driver.get(f"http://{nas_url}/ui/dashboard/") time.sleep(1) @@ -165,7 +167,7 @@ def try_login_with_ssh(driver): driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() time.sleep(4) global ssh_result - ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_host) @then('User should be able to login') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0916.py b/tests/bdd/ha-bhyve02/test_NAS_T0916.py index c50a87f80a2..30e87688da1 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0916.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0916.py @@ -27,6 +27,8 @@ def test_edit_user_change_password(driver): @given(parsers.parse('The browser is open navigate to "{nas_url}"')) def the_browser_is_open_navigate_to_nas_url(driver, nas_url): """The browser is open navigate to "{nas_user}".""" + global nas_host + nas_host = nas_url if nas_url not in driver.current_url: driver.get(f"http://{nas_url}/ui/dashboard/") time.sleep(1) @@ -137,7 +139,7 @@ def change_should_be_saved(driver): def log_out_and_try_to_log_back_in_with_the_old_password_for_that_user(driver): """Log out and try to log back in with the old password for that user.""" global ssh_result - ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_host) @then('User should not be able to log in ssh with the old password') @@ -151,7 +153,7 @@ def user_should_not_be_able_to_log_in_ssh_with_the_old_password(driver): def try_to_log_back_in_ssh_with_the_new_password_for_that_user(driver): """Try to log back in ssh with the new password for that user.""" global ssh_result - ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing1234', nas_ip) + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing1234', nas_host) @then('User should be able to log in with new password') From 752d7703f6cebccb9fa54ecfb0eabdec58982c90 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 16:09:29 -0300 Subject: [PATCH 06/14] Fixed nas_ip in NAS-T910. --- tests/bdd/ha-bhyve02/test_NAS_T0910.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0910.py b/tests/bdd/ha-bhyve02/test_NAS_T0910.py index 9d86e171907..f4983ba7a9a 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0910.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0910.py @@ -27,6 +27,8 @@ def test_edit_user_enable_permit_sudo(driver): @given(parsers.parse('The browser is open navigate to "{nas_url}"')) def the_browser_is_open_navigate_to_nas_url(driver, nas_url): """The browser is open navigate to "{nas_url}".""" + global nas_host + nas_host = nas_url if nas_url not in driver.current_url: driver.get(f"http://{nas_url}/ui/dashboard/") time.sleep(1) @@ -155,7 +157,7 @@ def open_shell_and_run_su_user(driver): """Open shell and run su user to become that user.""" global sudo_results cmd = 'ls /var/db/sudo' - sudo_results = ssh_sudo(cmd, nas_ip, 'ericbsd', 'testing') + sudo_results = ssh_sudo(cmd, nas_host, 'ericbsd', 'testing') @then('User should be able to use Sudo') From f903fbf9711cf354d89e7bde166d2c888c257e7f Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 16:11:32 -0300 Subject: [PATCH 07/14] Fixed nas_ip in NAS-T914. --- tests/bdd/ha-bhyve02/test_NAS_T0914.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0914.py b/tests/bdd/ha-bhyve02/test_NAS_T0914.py index 2fe86d1bfbd..dcf25bb2f29 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0914.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0914.py @@ -27,6 +27,8 @@ def test_edit_user_disable_password(driver): @given(parsers.parse('The browser is open navigate to "{nas_url}"')) def the_browser_is_open_navigate_to_nas_url(driver, nas_url): """The browser is open navigate to "{nas_user}".""" + global nas_host + nas_host = nas_url if nas_url not in driver.current_url: driver.get(f"http://{nas_url}/ui/dashboard/") time.sleep(1) @@ -165,7 +167,7 @@ def try_login_with_ssh(driver): if 'mat-checked' not in class_attribute: driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() global ssh_result - ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_ip) + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_host) @then('User should not be able to login') From e9659636a480a71f58e9548700f96fae6b928bf1 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Mon, 22 Apr 2024 17:33:27 -0300 Subject: [PATCH 08/14] Change the Shell UI code for ssh command in AD setup test. --- tests/bdd/ha-bhyve02/test_NAS_T0933.py | 80 +++++++++++--------------- 1 file changed, 32 insertions(+), 48 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0933.py b/tests/bdd/ha-bhyve02/test_NAS_T0933.py index 9eb5ada404e..420d661235f 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0933.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0933.py @@ -170,64 +170,48 @@ def active_directory_should_successfully_save_and_start_without_an_error(driver) time.sleep(5) -@then('Navigate to Shell') -def navigate_to_shell(driver): - """Navigate to Shell.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Reporting"]') - driver.execute_script("arguments[0].scrollIntoView();", element) +@then(parsers.parse('run "{cmd}" on the NAS with ssh')) +def run_wbinfo_u_on_the_nas_with_ssh(driver, nas_ip, cmd): + """run "wbinfo -u" on the NAS with ssh.""" + global results + results = ssh_cmd(cmd, 'root', 'testing', nas_ip) + assert results['result'], results['output'] + + +@then(parsers.parse('verify that "{ad_object}" is in wbinfo -u output')) +def verify_that_ad_object_is_in_wbinfo_u_output(driver, ad_object): + """verify that "{ad_object}" is in wbinfo -u output.""" + assert ad_object in results['output'], results['output'] time.sleep(1) - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Shell"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Shell"]').click() - - -@then('The Shell page should open') -def the_shell_should_should_open(driver): - """The Shell page should open.""" - assert wait_on_element(driver, 5, '//span[@class="reverse-video terminal-cursor"]') - time.sleep(10) - -@then(parsers.parse('input "{cmd}"')) -def input_wbinfo_u(driver, cmd): - """Input "wbinfo -u".""" - actions = ActionChains(driver) - actions.send_keys(cmd, Keys.ENTER) - actions.perform() +@then(parsers.parse('run "{cmd}" on the NAS with ssh')) +def run_wbinfo_g_on_the_nas_with_ssh(driver, nas_ip, cmd): + """run "wbinfo -g" on the NAS with ssh.""" + global results + results = ssh_cmd(cmd, 'root', 'testing', nas_ip) + assert results['result'], results['output'] -@then(parsers.parse('Verify that "{ad_object}" is in wbinfo -u output')) -def verify_that_ad_object_is_in__wbinfo_u_output(driver, ad_object): - """Verify that "{ad_object}" is in wbinfo -u output.""" - assert wait_on_element(driver, 15, f'//span[contains(.,"{ad_object}")]') - -@then(parsers.parse('Input "{cmd}"')) -def input_wbinfo_g(driver, cmd): - """Input "wwbinfo -g".""" - actions = ActionChains(driver) - actions.send_keys(cmd, Keys.ENTER) - actions.perform() - - -@then(parsers.parse('Verify that "{ad_object}" is in wbinfo -g output')) -def verify_that_ad01domain_admin_is_in_wbinfo_g_output(driver, ad_object): - """Verify that "{ad_object}" is in wbinfo -g output.""" - split_ad_object = ad_object.split() - assert wait_on_element(driver, 5, f'//span[contains(.,"{split_ad_object[0]}") and contains(.,"{split_ad_object[1]}")]') +@then(parsers.parse('verify that "{ad_object}" is in wbinfo -g output')) +def verify_that_ad_object_is_in_wbinfo_g_output(driver, ad_object): + """verify that "{ad_object}" is in wbinfo -g output.""" + assert ad_object in results['output'], results['output'] + time.sleep(1) -@then(parsers.parse('Input "{cmd}"')) -def input_wbinfo_t(driver, cmd): - """Input "wbinfo -t".""" - actions = ActionChains(driver) - actions.send_keys(cmd, Keys.ENTER) - actions.perform() +@then(parsers.parse('run "{cmd}" on the NAS with ssh')) +def run_wbinfo_t_on_the_nas_with_ssh(driver, nas_ip, cmd): + """run "wbinfo -t" on the NAS with ssh.""" + global results + results = ssh_cmd(cmd, 'root', 'testing', nas_ip) + assert results['result'], results['output'] -@then('Verify that the trust secret succeeded') +@then('verify that the trust secret succeeded') def verify_that_the_trust_secret_succeeded(driver): - """Verify that the trust secret succeeded.""" - assert wait_on_element(driver, 5, '//span[contains(.,"succeeded")]') + """verify that the trust secret succeeded.""" + assert 'via RPC calls succeeded' in results['output'], results['output'] @then(parsers.parse('ssh and input {tdbdump_command} before failover')) From 829c75f570b7decafc0522a0c1d4f5f0c2a0c208 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Tue, 23 Apr 2024 10:19:37 -0300 Subject: [PATCH 09/14] Fixed Test related to user password. --- tests/bdd/ha-bhyve02/test_NAS_T0914.py | 11 ----------- tests/bdd/ha-bhyve02/test_NAS_T0915.py | 12 ------------ tests/bdd/ha-bhyve02/test_NAS_T0916.py | 2 +- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0914.py b/tests/bdd/ha-bhyve02/test_NAS_T0914.py index dcf25bb2f29..b41f4b1e388 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0914.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0914.py @@ -155,17 +155,6 @@ def updated_value_should_be_visible(driver): @then('Try login with ssh') def try_login_with_ssh(driver): """Try login with ssh.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Services"]').click() - assert wait_on_element(driver, 10, '//services') - # Scroll to SSH service - assert wait_on_element(driver, 10, '//button[@ix-auto="button__S3_Actions"]') - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) - element = driver.find_element_by_xpath('//mat-slide-toggle[@ix-auto="slider__SSH_Running"]') - class_attribute = element.get_attribute('class') - if 'mat-checked' not in class_attribute: - driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() global ssh_result ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_host) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0915.py b/tests/bdd/ha-bhyve02/test_NAS_T0915.py index d84339e9a6d..2dd1c09cdaa 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0915.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0915.py @@ -154,18 +154,6 @@ def updated_value_should_be_visible(driver): @then('Try login with ssh') def try_login_with_ssh(driver): """Try login with ssh.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Services"]').click() - assert wait_on_element(driver, 10, '//services') - # Scroll to SSH service - assert wait_on_element(driver, 10, '//button[@ix-auto="button__S3_Actions"]') - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) - element = driver.find_element_by_xpath('//mat-slide-toggle[@ix-auto="slider__SSH_Running"]') - class_attribute = element.get_attribute('class') - if 'mat-checked' not in class_attribute: - driver.find_element_by_xpath('//div[@ix-auto="overlay__SSH_Running"]').click() - time.sleep(4) global ssh_result ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing', nas_host) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0916.py b/tests/bdd/ha-bhyve02/test_NAS_T0916.py index 30e87688da1..7073cb12674 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0916.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0916.py @@ -153,7 +153,7 @@ def user_should_not_be_able_to_log_in_ssh_with_the_old_password(driver): def try_to_log_back_in_ssh_with_the_new_password_for_that_user(driver): """Try to log back in ssh with the new password for that user.""" global ssh_result - ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing1234', nas_host) + ssh_result = ssh_cmd('beadm list', 'ericbsd', 'testing1', nas_host) @then('User should be able to log in with new password') From 34fc0de4d0d3fc62c052a99ea92763277e9c5bc1 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Tue, 23 Apr 2024 10:59:32 -0300 Subject: [PATCH 10/14] Fixed starting SMB service if not started --- tests/bdd/ha-bhyve02/test_NAS_T0939.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0939.py b/tests/bdd/ha-bhyve02/test_NAS_T0939.py index 9789831517b..cba683ebe51 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0939.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0939.py @@ -149,12 +149,7 @@ def the_service_page_should_open(driver): def if_the_smb_service_is_not_started_start_the_service(driver): """If the SMB service is not started start the service.""" assert wait_on_element(driver, 5, '//services') - assert wait_on_element(driver, 5, '//button[@ix-auto="button__S3_Actions"]', 'clickable') - # Scroll to SMB service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) - driver.find_element_by_xpath('//div[@ix-auto="value__SMB"]') + assert wait_on_element(driver, 5, '//mat-slide-toggle[@ix-auto="slider__SMB_Running"]', 'clickable') value_exist = attribute_value_exist(driver, '//mat-slide-toggle[@ix-auto="slider__SMB_Running"]', 'class', 'mat-checked') if not value_exist: driver.find_element_by_xpath('//div[@ix-auto="overlay__SMB_Running"]').click() From 938886a83adbcaee9046b90127c4549e92db74ab Mon Sep 17 00:00:00 2001 From: ericbsd Date: Tue, 23 Apr 2024 11:13:15 -0300 Subject: [PATCH 11/14] Longer sleep for LDAP testing --- tests/bdd/ha-bhyve02/test_NAS_T0940.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0940.py b/tests/bdd/ha-bhyve02/test_NAS_T0940.py index 2db1298da5e..da92a6551c5 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0940.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0940.py @@ -132,7 +132,7 @@ def go_to_the_dashboard_verify_ha_is_enabled_then_trigger_failover(driver): assert wait_on_element(driver, 7, xpaths.breadcrumb.dashboard) # wait_on_element need to be replace with wait_on_element when NAS-118299 assert wait_on_element(driver, 10, xpaths.topToolbar.ha_enable) - time.sleep(5) + time.sleep(10) assert wait_on_element(driver, 60, xpaths.button.initiate_failover, 'clickable') driver.find_element_by_xpath(xpaths.button.initiate_failover).click() assert wait_on_element(driver, 5, xpaths.popup.initiate_failover) @@ -166,7 +166,7 @@ def on_the_dashboard_make_sure_ha_is_enabled(driver): driver.find_element_by_xpath(xpaths.button.close).click() # wait_on_element need to be replace with wait_on_element when NAS-118299 assert wait_on_element(driver, 30, xpaths.topToolbar.ha_enable) - time.sleep(5) + time.sleep(10) @then('ssh to the virtual node again to verify the pdbedit command still works') From 970b9a12f0af246c4b202bc1da5302a5c9313696 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Tue, 23 Apr 2024 12:08:11 -0300 Subject: [PATCH 12/14] Refactored some User test. --- tests/bdd/core/test_NAS_T0986.py | 7 +++---- tests/bdd/core/test_NAS_T1014.py | 6 +++--- tests/bdd/core/test_NAS_T1041.py | 6 +++--- tests/bdd/core/test_NAS_T1043.py | 6 +++--- tests/bdd/core/test_NAS_T1044.py | 6 +++--- tests/bdd/core/test_NAS_T1060.py | 7 +++---- tests/bdd/ha-bhyve02/test_NAS_T0908.py | 8 ++++---- tests/bdd/ha-bhyve02/test_NAS_T0909.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0910.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0911.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0912.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0913.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0914.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0915.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0916.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0917.py | 9 +++------ tests/bdd/ha-bhyve02/test_NAS_T0927.py | 6 +++--- tests/bdd/ha-bhyve02/test_NAS_T0929.py | 7 +++---- tests/bdd/ha-bhyve02/test_NAS_T0930.py | 7 +++---- tests/bdd/ha-bhyve02/test_NAS_T0931.py | 7 +++---- tests/bdd/ha-bhyve02/test_NAS_T0967.py | 6 +++--- tests/bdd/ha-tn09/test_NAS_T0923.py | 6 +++--- tests/bdd/reusableSeleniumCode.py | 5 +++++ tests/bdd/xpaths.py | 2 ++ 24 files changed, 74 insertions(+), 99 deletions(-) diff --git a/tests/bdd/core/test_NAS_T0986.py b/tests/bdd/core/test_NAS_T0986.py index d9ee1ecabd4..fa46d79b141 100644 --- a/tests/bdd/core/test_NAS_T0986.py +++ b/tests/bdd/core/test_NAS_T0986.py @@ -53,10 +53,9 @@ def you_should_be_on_the_dashboard(driver): @then('click on the Accounts on the side menu, click on Users') def click_on_the_accounts_on_the_side_menu_click_on_users(driver): """click on the Accounts on the side menu, click on Users.""" - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + assert wait_on_element(driver, 7, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('when the Users page should open, click on the "Add" Button') diff --git a/tests/bdd/core/test_NAS_T1014.py b/tests/bdd/core/test_NAS_T1014.py index cb15e178475..aed8fe192cb 100644 --- a/tests/bdd/core/test_NAS_T1014.py +++ b/tests/bdd/core/test_NAS_T1014.py @@ -53,12 +53,12 @@ def you_should_be_on_the_dashboard(driver): @then('click on the Accounts on the side menu, click on Users') def click_on_the_accounts_on_the_side_menu_click_on_users(driver): """click on the Accounts on the side menu, click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('when the Users page should open, click on the "Add" Button') diff --git a/tests/bdd/core/test_NAS_T1041.py b/tests/bdd/core/test_NAS_T1041.py index 1f08b1b0b3f..938727c82c8 100644 --- a/tests/bdd/core/test_NAS_T1041.py +++ b/tests/bdd/core/test_NAS_T1041.py @@ -200,12 +200,12 @@ def on_windows_shares_page_verify_the_smbuser_share_exist(driver): @then('click on Accounts on the side menu, click on Users') def click_on_accounts_on_the_side_menu_click_on_users(driver): """click on Accounts on the side menu, click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('on the Users page click Add') diff --git a/tests/bdd/core/test_NAS_T1043.py b/tests/bdd/core/test_NAS_T1043.py index 582c3e6dc32..f9220f423a1 100644 --- a/tests/bdd/core/test_NAS_T1043.py +++ b/tests/bdd/core/test_NAS_T1043.py @@ -55,12 +55,12 @@ def you_are_on_the_dashboard(driver): @then('click on the Accounts on the side menu, click on Users') def click_on_the_accounts_on_the_side_menu_click_on_users(driver): """click on the Accounts on the side menu, click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('on the Users page, click the foo user right arrow') diff --git a/tests/bdd/core/test_NAS_T1044.py b/tests/bdd/core/test_NAS_T1044.py index 2ef13230041..039b3ba7c78 100644 --- a/tests/bdd/core/test_NAS_T1044.py +++ b/tests/bdd/core/test_NAS_T1044.py @@ -54,12 +54,12 @@ def you_are_on_the_dashboard(driver): @then('click on the Accounts on the side menu, click on Users') def click_on_the_accounts_on_the_side_menu_click_on_users(driver): """click on the Accounts on the side menu, click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('on the Users page, click the foo user right arrow') diff --git a/tests/bdd/core/test_NAS_T1060.py b/tests/bdd/core/test_NAS_T1060.py index c350a9595b7..fa5db033a59 100644 --- a/tests/bdd/core/test_NAS_T1060.py +++ b/tests/bdd/core/test_NAS_T1060.py @@ -66,10 +66,9 @@ def the_browser_is_open_on_the_truenas_url_and_logged_in(driver, nas_ip, root_pa def on_the_dashboard_click_on_accounts_on_the_side_menu_click_on_users(driver): """on the dashboard, click on Accounts on the side menu, click on Users.""" assert wait_on_element(driver, 10, '//li[contains(.,"Dashboard")]') - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Accounts"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() - assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + assert wait_on_element(driver, 7, xpaths.dashboard.system_information) + rsc.click_on_element(driver, xpaths.sideMenu.accounts) + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('on the Users page should open, click on the Add Button') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0908.py b/tests/bdd/ha-bhyve02/test_NAS_T0908.py index 4edbacc0f90..dd1a5bafcb4 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0908.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0908.py @@ -57,15 +57,15 @@ def you_should_see_the_dashboard_and_system_information(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - assert wait_on_element(driver, 10, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + assert wait_on_element(driver, 10, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -73,7 +73,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0909.py b/tests/bdd/ha-bhyve02/test_NAS_T0909.py index 91fe7e26f29..1eea9f8b49d 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0909.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0909.py @@ -56,17 +56,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -74,7 +71,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0910.py b/tests/bdd/ha-bhyve02/test_NAS_T0910.py index f4983ba7a9a..f798bde0971 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0910.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0910.py @@ -63,17 +63,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -81,7 +78,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, '//mat-list-item[@ix-auto="option__Users"]') @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0911.py b/tests/bdd/ha-bhyve02/test_NAS_T0911.py index a391d639498..db19fba1e85 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0911.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0911.py @@ -56,17 +56,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -74,7 +71,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0912.py b/tests/bdd/ha-bhyve02/test_NAS_T0912.py index 634a3d81f29..15f4f3e77d5 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0912.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0912.py @@ -57,17 +57,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -75,7 +72,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0913.py b/tests/bdd/ha-bhyve02/test_NAS_T0913.py index 2888a35d07c..2291a564da3 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0913.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0913.py @@ -56,17 +56,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -74,7 +71,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0914.py b/tests/bdd/ha-bhyve02/test_NAS_T0914.py index b41f4b1e388..89839bffd42 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0914.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0914.py @@ -63,17 +63,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -81,7 +78,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0915.py b/tests/bdd/ha-bhyve02/test_NAS_T0915.py index 2dd1c09cdaa..270f8f92f30 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0915.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0915.py @@ -63,17 +63,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -81,7 +78,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0916.py b/tests/bdd/ha-bhyve02/test_NAS_T0916.py index 7073cb12674..dd87e58f50f 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0916.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0916.py @@ -63,17 +63,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -81,7 +78,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0917.py b/tests/bdd/ha-bhyve02/test_NAS_T0917.py index c142abeddce..023c2fae972 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0917.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0917.py @@ -56,17 +56,14 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') - class_attribute = element.get_attribute('class') - if 'open' not in class_attribute: - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.accounts) @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -74,7 +71,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0927.py b/tests/bdd/ha-bhyve02/test_NAS_T0927.py index 8395d7267df..bdb44d815a9 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0927.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0927.py @@ -56,10 +56,10 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts, Click on Users') def click_on_the_accounts_click_on_users(driver): """Click on the Accounts, Click on Users.""" - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + assert wait_on_element(driver, 5, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0929.py b/tests/bdd/ha-bhyve02/test_NAS_T0929.py index e1c5c6f04bf..e27c7c99538 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0929.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0929.py @@ -56,10 +56,9 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts, Click on Users') def click_on_the_accounts_click_on_users(driver): """Click on the Accounts, Click on Users.""" - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + assert wait_on_element(driver, 5, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0930.py b/tests/bdd/ha-bhyve02/test_NAS_T0930.py index c9f030c590b..e4161e336c6 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0930.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0930.py @@ -85,10 +85,9 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts, Click on Users') def click_on_the_accounts_click_on_users(driver): """Click on the Accounts, Click on Users.""" - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + assert wait_on_element(driver, 5, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0931.py b/tests/bdd/ha-bhyve02/test_NAS_T0931.py index 220b1abba36..1b5eccea132 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0931.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0931.py @@ -85,10 +85,9 @@ def you_should_see_the_dashboard(driver): @then('Click on the Accounts, Click on Users') def click_on_the_accounts_click_on_users(driver): """Click on the Accounts, Click on Users.""" - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Accounts"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() - assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + assert wait_on_element(driver, 5, xpaths.sideMenu.accounts, 'clickable') + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0967.py b/tests/bdd/ha-bhyve02/test_NAS_T0967.py index d22a84695dd..4e90679f3c5 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0967.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0967.py @@ -60,14 +60,14 @@ def you_should_see_the_dashboard_and_system_information(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Users"]', 'clickable') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -75,7 +75,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/ha-tn09/test_NAS_T0923.py b/tests/bdd/ha-tn09/test_NAS_T0923.py index 22e55f36ba3..214f796a631 100644 --- a/tests/bdd/ha-tn09/test_NAS_T0923.py +++ b/tests/bdd/ha-tn09/test_NAS_T0923.py @@ -52,14 +52,14 @@ def you_should_see_the_dashboard_and_system_information(driver): @then('Click on the Accounts item in the left side menu') def click_on_the_accounts_item_in_the_left_side_menu(driver): """Click on the Accounts item in the left side menu.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]').click() + driver.find_element_by_xpath(xpaths.sideMenu.accounts).click() @then('The Accounts menu should expand down') def the_accounts_menu_should_expand_down(driver): """The Accounts menu should expand down.""" assert wait_on_element(driver, 0.5, 30, '//mat-list-item[@ix-auto="option__Users"]') - element = driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Accounts"]') + element = driver.find_element_by_xpath(xpaths.sideMenu.accounts) class_attribute = element.get_attribute('class') assert 'open' in class_attribute, class_attribute @@ -67,7 +67,7 @@ def the_accounts_menu_should_expand_down(driver): @then('Click on Users') def click_on_users(driver): """Click on Users.""" - driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Users"]').click() + rsc.click_on_element(driver, xpaths.sideMenu.users) @then('The Users page should open') diff --git a/tests/bdd/reusableSeleniumCode.py b/tests/bdd/reusableSeleniumCode.py index 3c8c48ff70a..245315bd188 100644 --- a/tests/bdd/reusableSeleniumCode.py +++ b/tests/bdd/reusableSeleniumCode.py @@ -27,6 +27,11 @@ def scroll_To(driver: classmethod, xpath: str): time.sleep(0.2) +def click_on_element(driver: classmethod, xpath: str): + assert wait_on_element(driver, 5, xpath, 'clickable') + driver.find_element_by_xpath(xpath).click() + + 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 7409c9ce626..84339ad3ed2 100644 --- a/tests/bdd/xpaths.py +++ b/tests/bdd/xpaths.py @@ -78,6 +78,8 @@ class sideMenu: """xpath for the menu on the left side""" root = '//span[contains(.,"root")]' dashboard = '//mat-list-item[@ix-auto="option__Dashboard"]' + accounts = '//mat-list-item[@ix-auto="option__Accounts"]' + users = '//mat-list-item[@ix-auto="option__Users"]' directory_services = '//mat-list-item[@ix-auto="option__Directory Services"]' directory_services_ldap = '//mat-list-item[@ix-auto="option__LDAP"]' directory_services_nis = '//mat-list-item[@ix-auto="option__NIS"]' From ff3ef4a717721c92058c183eaa284fc0ccb7fffb Mon Sep 17 00:00:00 2001 From: ericbsd Date: Tue, 23 Apr 2024 12:21:49 -0300 Subject: [PATCH 13/14] Fixed starting SMB service for all HA test --- tests/bdd/ha-bhyve02/test_NAS_T0965.py | 5 ----- tests/bdd/ha-bhyve02/test_NAS_T0968.py | 7 +------ tests/bdd/ha-bhyve02/test_NAS_T0971.py | 7 +------ 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0965.py b/tests/bdd/ha-bhyve02/test_NAS_T0965.py index 22f549c25e1..f85cfd34cdd 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0965.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0965.py @@ -151,11 +151,6 @@ def the_service_page_should_open(driver): def if_the_smb_service_is_not_started_start_the_service(driver): """If the SMB service is not started start the service.""" assert wait_on_element(driver, 7, '//services') - assert wait_on_element(driver, 7, '//button[@ix-auto="button__S3_Actions"]') - # Scroll to SMB service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) assert wait_on_element(driver, 7, '//div[@ix-auto="overlay__SMB_Running"]', 'clickable') value_exist = attribute_value_exist(driver, '//mat-slide-toggle[@ix-auto="slider__SMB_Running"]', 'class', 'mat-checked') if not value_exist: diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0968.py b/tests/bdd/ha-bhyve02/test_NAS_T0968.py index 174b26a8ccb..f95e1a3c9a6 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0968.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0968.py @@ -149,12 +149,7 @@ def the_service_page_should_open(driver): def if_the_smb_service_is_not_started_start_the_service(driver): """If the SMB service is not started start the service.""" assert wait_on_element(driver, 7, '//services') - assert wait_on_element(driver, 7, '//button[@ix-auto="button__S3_Actions"]') - # Scroll to SMB service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) - driver.find_element_by_xpath('//div[@ix-auto="value__SMB"]') + assert wait_on_element(driver, 7, '//div[@ix-auto="overlay__SMB_Running"]', 'clickable') value_exist = attribute_value_exist(driver, '//mat-slide-toggle[@ix-auto="slider__SMB_Running"]', 'class', 'mat-checked') if not value_exist: driver.find_element_by_xpath('//div[@ix-auto="overlay__SMB_Running"]').click() diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0971.py b/tests/bdd/ha-bhyve02/test_NAS_T0971.py index 71758ce5318..311b4ffbe71 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0971.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0971.py @@ -149,12 +149,7 @@ def the_service_page_should_open(driver): def if_the_smb_service_is_not_started_start_the_service(driver): """If the SMB service is not started start the service.""" assert wait_on_element(driver, 7, '//services') - assert wait_on_element(driver, 7, '//button[@ix-auto="button__S3_Actions"]') - # Scroll to SMB service - element = driver.find_element_by_xpath('//button[@ix-auto="button__S3_Actions"]') - driver.execute_script("arguments[0].scrollIntoView();", element) - time.sleep(1) - driver.find_element_by_xpath('//div[@ix-auto="value__SMB"]') + assert wait_on_element(driver, 7, '//div[@ix-auto="overlay__SMB_Running"]', 'clickable') value_exist = attribute_value_exist(driver, '//mat-slide-toggle[@ix-auto="slider__SMB_Running"]', 'class', 'mat-checked') if not value_exist: driver.find_element_by_xpath('//div[@ix-auto="overlay__SMB_Running"]').click() From 2226bb85cf6abccc8b2c061cbbb1acfc1ffc04f1 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Wed, 24 Apr 2024 14:00:05 -0300 Subject: [PATCH 14/14] Adding longer wait for ha_enable --- tests/bdd/ha-bhyve02/test_NAS_T0933.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bdd/ha-bhyve02/test_NAS_T0933.py b/tests/bdd/ha-bhyve02/test_NAS_T0933.py index 420d661235f..9dd30ce7845 100644 --- a/tests/bdd/ha-bhyve02/test_NAS_T0933.py +++ b/tests/bdd/ha-bhyve02/test_NAS_T0933.py @@ -249,6 +249,7 @@ def press_initiate_failover_check_confirm_and_press_failover(driver): driver.find_element_by_xpath(xpaths.checkbox.confirm).click() assert wait_on_element(driver, 5, xpaths.button.failover) driver.find_element_by_xpath(xpaths.button.failover).click() + time.sleep(10) @then('Wait for the login page to appear') @@ -273,8 +274,7 @@ def at_the_login_page_enter_root_and_password(driver, user, password): if wait_on_element(driver, 5, xpaths.popup.help): assert wait_on_element(driver, 10, xpaths.button.close, 'clickable') driver.find_element_by_xpath(xpaths.button.close).click() - # wait_on_element need to be replace with wait_on_element when NAS-118299 - assert wait_on_element(driver, 30, xpaths.topToolbar.ha_enable) + assert wait_on_element(driver, 60, xpaths.topToolbar.ha_enable) @then(parsers.parse('ssh and input {tdbdump_command} after failover'))