Unverified Commit 86b4f921 authored by Eric Turgeon's avatar Eric Turgeon Committed by GitHub
Browse files

AUTO-87 / 22.02.5 / Fixed, Updated and improve Angelfish HA UI test for 22.02.4 (#7202)

* removed Browser refresh in tests/bdd/ha-bhyve02/test_NAS_T0961.py

* Improve System Dataset Pool Select Pool test waits

* Adding a refresh to "refresh and wait for the second node to be up" step

* Added sleep of 1 minutes to make sure that HA is properly ready

Changed the xpath for HA nodes to be unique
Changed the login after failover to wait for HA to be enable first

* Add clicking I AGREE

* Fixed wait on System Dataset Pool: in test_NAS_T0961.py

* Removed code for scrolling in test_NAS_T0945.py and fixed steps

* Removed scroll in test_NAS_T0961.py

* Update wait on Advanced and System Dataset Pool xpaths

* Commented driver.refresh() in test_NAS_T0961.py

It should not need to be refresh

* Adding pytest dependencies the the HA UI test

* Added the code to marked skipped test blocked in Jira

* Fixed wait_on_element_disappear for System Dataset Pool

* Improved wait after saving a dataset in HA UI test

* Added longer sleep after HA is enable in HA UI test

* Changed the click on the disk for dozer to the first on the list

* Adding sleep of 10 second after pressing failover

to make sure the test don't see login before the failover is started

* Adding code to refresh the login when it appears in NAS T961 and T962
No related merge requests found
Showing with 104 additions and 51 deletions
+104 -51
......@@ -95,8 +95,8 @@ def driver():
# Close Firefox after all tests are completed
def pytest_sessionfinish(session, exitstatus):
web_driver.quit()
# def pytest_sessionfinish(session, exitstatus):
# web_driver.quit()
@pytest.mark.hookwrapper
......
# coding=utf-8
"""High Availability (tn09) feature tests."""
import pytest
import time
from selenium.common.exceptions import ElementClickInterceptedException
from function import (
......@@ -18,8 +19,10 @@ from pytest_bdd import (
when,
parsers
)
pytestmark = [pytest.mark.debug_test]
@pytest.mark.dependency(name='Setup_SSH')
@scenario('features/NAS-T945.feature', 'Verify SSH Access with Root works')
def test_verify_ssh_access_with_root_works(driver):
"""Verify SSH Access with Root works."""
......@@ -79,18 +82,13 @@ def go_to_system_settings_click_services(driver):
@then('the service page should open')
def the_service_page_should_open(driver):
"""the service page should open."""
assert wait_on_element(driver, 5, '//services')
assert wait_on_element(driver, 5, '//h1[text()="Services"]')
time.sleep(1)
@then('press on configure(pencil) SSH')
def press_on_configure_ssh(driver):
"""press on configure(pencil) SSH."""
assert wait_on_element(driver, 5, '//h1[text()="Services"]')
# Scroll to SSH service
assert wait_on_element(driver, 5, '//tr[contains(.,"S3")]//button', 'clickable')
element = driver.find_element_by_xpath('//tr[contains(.,"S3")]//button')
driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(1)
assert wait_on_element(driver, 5, '//tr[contains(.,"SSH")]//button', 'clickable')
driver.find_element_by_xpath('//tr[contains(.,"SSH")]//button').click()
......@@ -127,10 +125,6 @@ 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, '//h1[text()="Services"]')
# Scroll to SSH service
assert wait_on_element(driver, 5, '//tr[contains(.,"S3")]//button', 'clickable')
element = driver.find_element_by_xpath('//tr[contains(.,"S3")]//button')
driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(1)
assert wait_on_element(driver, 5, '//tr[contains(.,"SSH")]//mat-checkbox')
value_exist = attribute_value_exist(driver, '//tr[contains(.,"SSH")]//mat-checkbox', 'class', 'mat-checkbox-checked')
if not value_exist:
......
# coding=utf-8
"""High Availability (tn-bhyve01) feature tests."""
import pytest
import time
from function import (
wait_on_element,
......@@ -14,8 +15,10 @@ from pytest_bdd import (
when,
parsers
)
pytestmark = [pytest.mark.debug_test]
@pytest.mark.dependency(name='Setup_HA')
@scenario('features/NAS-T946.feature', 'Verify setting up HA works with a single failover group')
def test_verify_setting_up_ha_works_with_a_single_failover_group(driver):
"""Verify setting up HA works with a single failover group."""
......@@ -425,10 +428,10 @@ def navigate_to_dashboard_wait_for_ha_to_be_online(driver):
assert wait_on_element(driver, 7, '//mat-list-item[@ix-auto="option__Dashboard"]', 'clickable')
driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Dashboard"]').click()
assert wait_on_element(driver, 10, '//span[contains(.,"System Information")]')
assert wait_on_element(driver, 15, '//div[contains(.,"truenas")]')
assert wait_on_element(driver, 15, '//div[contains(.,"truenas-b")]')
assert wait_on_element(driver, 15, '//div[contains(text(),"truenas") and @class="mat-list-item-content"]')
assert wait_on_element(driver, 180, '//div[contains(text(),"truenas-b") and @class="mat-list-item-content"]')
assert wait_on_element(driver, 180, '//mat-icon[@svgicon="ha_enabled"]')
time.sleep(5)
time.sleep(120)
@then(parsers.parse('enter Hostname "{host1}", Hostname (TrueNAS Controller 2) "{host2}"'))
......@@ -449,8 +452,8 @@ def navigate_to_dashboard_verify_both_contorler_hostname(driver):
driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Dashboard"]').click()
assert wait_on_element(driver, 10, '//span[contains(.,"System Information")]')
assert wait_on_element(driver, 15, '//mat-icon[@svgicon="ha_enabled"]')
assert wait_on_element(driver, 15, '//div[contains(.,"tn-bhyve01-nodea")]')
assert wait_on_element(driver, 15, '//div[contains(.,"tn-bhyve01-nodeb")]')
assert wait_on_element(driver, 15, '//div[contains(text(),"tn-bhyve01-nodea") and @class="mat-list-item-content"]')
assert wait_on_element(driver, 15, '//div[contains(text(),"tn-bhyve01-nodeb") and @class="mat-list-item-content"]')
@then('both controllers should show version and license on the dashboard')
......
# coding=utf-8
"""High Availability (tn-bhyve01) feature tests."""
import pytest
import time
from function import (
wait_on_element,
......@@ -17,6 +18,7 @@ from pytest_bdd import (
)
@pytest.mark.dependency(name='First_User')
@scenario('features/NAS-T947.feature', 'Add User')
def test_add_user(driver):
"""Add User."""
......
......@@ -14,6 +14,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T948.feature', 'Edit User Shell')
......@@ -23,8 +24,9 @@ def test_edit_user_shell(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_url}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T949.feature', 'Edit user enable Permit Sudo')
......@@ -24,8 +25,9 @@ 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):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_url}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
......@@ -14,6 +14,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T950.feature', 'Edit User Email')
......@@ -23,8 +24,9 @@ def test_edit_user_email(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T951.feature', 'Edit user auxiliary group')
......@@ -24,8 +25,9 @@ def test_edit_user_auxiliary_group(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -14,6 +14,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T952.feature', 'Edit user home directory')
......@@ -23,8 +24,9 @@ def test_edit_user_home_directory(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T953.feature', 'Edit User Disable Password')
......@@ -24,8 +25,9 @@ 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):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T954.feature', 'Edit User enable Password')
......@@ -24,8 +25,9 @@ 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):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T955.feature', 'Edit User Change Password')
......@@ -24,8 +25,9 @@ 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):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
......@@ -13,6 +13,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T956.feature', 'Edit User Try Change Password with mismatched passwords')
......@@ -22,8 +23,9 @@ def test_edit_user_try_change_password_with_mismatched_passwords(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_user}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -13,6 +13,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T957.feature', 'Verify invalid email cannot enter be in the User Edit Page')
......@@ -22,8 +23,9 @@ def test_verify_invalid_email_cannot_enter_be_in_the_user_edit_page(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_url}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -15,6 +15,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
@scenario('features/NAS-T958.feature', 'Change user home directory permissions')
......@@ -24,8 +25,9 @@ def test_change_user_home_directory_permissions(driver):
@given(parsers.parse('The browser is open navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open navigate to "{nas_url}"."""
depends(request, ['First_User'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
time.sleep(1)
......
......@@ -21,6 +21,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
localHome = os.path.expanduser('~')
dotsshPath = localHome + '/.ssh'
......@@ -47,8 +48,9 @@ def test_adding_sshkey_to_a_user_and_verify_it_works(driver):
@given(parsers.parse('The browser is open, navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open, navigate to "{nas_url}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
......@@ -21,6 +21,7 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
localHome = os.path.expanduser('~')
dotsshPath = localHome + '/.ssh'
......@@ -47,8 +48,9 @@ def test_adding_sshkey_to_the_root_user_and_verify_it_works(driver):
@given(parsers.parse('The browser is open, navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""The browser is open, navigate to "{nas_url}"."""
depends(request, ['First_User', 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......
# coding=utf-8
"""High Availability (tn-bhyve01) feature tests."""
import pytest
import time
from function import (
wait_on_element,
......@@ -14,8 +15,11 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
pytestmark = [pytest.mark.debug_test]
@pytest.mark.dependency(name='System_Dataset', scope='session')
@scenario('features/NAS-T961.feature', 'Creating new pool and set it as System Dataset')
def test_creating_new_pool_and_set_it_as_system_dataset(driver):
"""Creating new pool and set it as System Dataset."""
......@@ -23,16 +27,15 @@ def test_creating_new_pool_and_set_it_as_system_dataset(driver):
@given(parsers.parse('the browser is open, navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""the browser is open, navigate to "{nas_url}"."""
depends(request, ["Setup_HA"], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
assert wait_on_element(driver, 5, '//input[@data-placeholder="Username"]')
time.sleep(1)
else:
driver.refresh()
@when(parsers.parse('the login page appears, enter "{user}" and "{password}"'))
......@@ -88,12 +91,13 @@ def the_pool_manager_page_should_open(driver):
@then(parsers.parse('enter {pool_name} for pool name, check the box next to {disk}'))
def enter_dozer_for_pool_name_check_the_box_next_to_sdb(driver, pool_name, disk):
def enter_dozer_for_pool_name_check_the_box_next_to_sdb(driver, pool_name):
"""enter dozer for pool name, check the box next to sdb."""
assert wait_on_element(driver, 7, '//input[@id="pool-manager__name-input-field"]', 'inputable')
driver.find_element_by_xpath('//input[@id="pool-manager__name-input-field"]').clear()
driver.find_element_by_xpath('//input[@id="pool-manager__name-input-field"]').send_keys(pool_name)
driver.find_element_by_xpath(f'//mat-checkbox[@id="pool-manager__disks-{disk}"]').click()
# click the first disk on the list
driver.find_element_by_xpath('(//mat-checkbox[contains(@id,"pool-manager__disks-sd")])[1]').click()
@then('press right arrow under data vdev, click on the Force checkbox')
......@@ -157,11 +161,8 @@ def navigate_to_system_setting_and_click_misc(driver):
@then('the Advanced page should open')
def the_miscellaneous_page_should_open(driver):
"""the Advanced page should open."""
assert wait_on_element(driver, 7, '//h1[contains(.,"Advanced")]')
assert wait_on_element(driver, 7, '//h3[contains(.,"Cron Jobs")]')
element = driver.find_element_by_xpath('//h3[contains(.,"Cron Jobs")]')
driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(0.5)
assert wait_on_element(driver, 7, '//h1[text()="Advanced"]')
assert wait_on_element(driver, 7, '//h3[text()="System Dataset Pool"]')
@then('click on System Dataset')
......@@ -177,12 +178,14 @@ def click_on_system_dataset(driver):
@then('the System Dataset page should open')
def the_system_dataset_page_should_open(driver):
"""the System Dataset page should open."""
assert wait_on_element(driver, 5, '//h3[contains(.,"System Dataset Pool")]')
assert wait_on_element(driver, 5, '//h3[contains(.,"System Dataset Pool") and @class="ix-formtitle"]')
@then(parsers.parse('click on System Dataset Pool select {pool_name}, click Save'))
def click_on_system_dataser_pool_select_dozer_click_Save(driver, pool_name):
"""click on System Dataset Pool select dozer, click Save."""
assert wait_on_element(driver, 5, '//label[contains(text(),"Select Pool")]')
time.sleep(1) # needed on my local machine or the test fails.
assert wait_on_element(driver, 5, '//mat-select', 'clickable')
driver.find_element_by_xpath('//mat-select').click()
assert wait_on_element(driver, 5, f'//mat-option[contains(.,"{pool_name}")]')
......@@ -211,10 +214,13 @@ def navigate_to_dashboard(driver):
@then('refresh and wait for the second node to be up')
def refresh_and_wait_for_the_second_node_to_be_up(driver):
"""refresh and wait for the second node to be up"""
assert wait_on_element(driver, 120, '//div[contains(.,"tn-bhyve01-nodeb")]')
# driver.refresh()
assert wait_on_element(driver, 120, '//div[contains(text(),"tn-bhyve01-nodeb") and @class="mat-list-item-content"]')
assert wait_on_element(driver, 120, '//mat-icon[@svgicon="ha_enabled"]')
# 5 second to let the system get ready for the next step.
time.sleep(5)
# 30 second to let the system get ready for the next step.
# ALso triggering a failover directly after changing a system dataset is
# not real world scenario
time.sleep(120)
@then('verify the system dataset is dozer on the active node')
......@@ -237,12 +243,16 @@ def press_Initiate_Failover_and_confirm(driver):
driver.find_element_by_xpath('//mat-checkbox[contains(@class,"confirm-checkbox")]').click()
assert wait_on_element(driver, 5, '//button[.//text()="FAILOVER"]', 'clickable')
driver.find_element_by_xpath('//button[.//text()="FAILOVER"]').click()
time.sleep(10)
@then('wait for the login and the HA enabled status and login')
def wait_for_the_login_and_the_HA_enabled_status_and_login(driver):
"""wait for the login and the HA enabled status and login."""
assert wait_on_element(driver, 240, '//input[@data-placeholder="Username"]')
assert wait_on_element(driver, 120, '//input[@data-placeholder="Username"]')
driver.refresh()
# Wait for HA is enable before login in. The UI will act up if HA is not enable.
assert wait_on_element(driver, 180, '//p[text()="HA is enabled."]')
assert wait_on_element(driver, 10, '//input[@data-placeholder="Username"]')
driver.find_element_by_xpath('//input[@data-placeholder="Username"]').clear()
driver.find_element_by_xpath('//input[@data-placeholder="Username"]').send_keys('root')
......@@ -254,9 +264,10 @@ def wait_for_the_login_and_the_HA_enabled_status_and_login(driver):
assert wait_on_element(driver, 120, '//span[contains(.,"System Information")]')
if wait_on_element(driver, 2, '//button[@ix-auto="button__I AGREE"]', 'clickable'):
driver.find_element_by_xpath('//button[@ix-auto="button__I AGREE"]').click()
assert wait_on_element(driver, 120, '//div[contains(text(),"tn-bhyve01-nodea") and @class="mat-list-item-content"]')
# Make sure HA is enable before going forward
assert wait_on_element(driver, 60, '//mat-icon[@svgicon="ha_enabled"]')
time.sleep(5)
time.sleep(60)
@then('verify the system dataset is dozer on the active node after failover')
......
# coding=utf-8
"""SCALE High Availability (tn-bhyve01) feature tests."""
import pytest
import time
from function import (
wait_on_element,
......@@ -15,8 +16,11 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
pytestmark = [pytest.mark.debug_test]
@pytest.mark.dependency(name='Active_Directory', scope='session')
@scenario('features/NAS-T962.feature', 'Verify Active Directory works after failover with new system dataset')
def test_verify_active_directory_works_after_failover_with_new_system_dataset(driver):
"""Verify Active Directory works after failover with new system dataset."""
......@@ -24,8 +28,9 @@ def test_verify_active_directory_works_after_failover_with_new_system_dataset(dr
@given(parsers.parse('the browser is open, navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""the browser is open, navigate to "{nas_url}"."""
depends(request, ["System_Dataset", 'Setup_SSH'], scope='session')
global host
host = nas_url
if nas_url not in driver.current_url:
......@@ -52,6 +57,8 @@ def if_the_login_page_appears_enter_root_and_testing(driver, user, password):
def on_the_dashboard_click_network_on_the_left_sidebar(driver):
"""on the Dashboard, click Network on the left sidebar."""
assert wait_on_element(driver, 7, '//span[contains(.,"Dashboard")]')
if wait_on_element(driver, 2, '//button[@ix-auto="button__I AGREE"]', 'clickable'):
driver.find_element_by_xpath('//button[@ix-auto="button__I AGREE"]').click()
assert wait_on_element(driver, 10, '//span[contains(.,"System Information")]')
assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Network"]', 'clickable')
driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Network"]').click()
......@@ -209,6 +216,7 @@ def click_initiate_failover_click_the_confirm_checkbox_and_press_failover(driver
driver.find_element_by_xpath('//mat-checkbox[contains(@class,"confirm-checkbox")]').click()
assert wait_on_element(driver, 5, '//button[.//text()="FAILOVER"]', 'clickable')
driver.find_element_by_xpath('//button[.//text()="FAILOVER"]').click()
time.sleep(10)
@then('wait for the login page to appear')
......@@ -216,6 +224,7 @@ def wait_for_the_login_page_to_appear(driver):
"""Wait for the login page to appear."""
# to make sure the UI is refresh for the login page
assert wait_on_element(driver, 240, '//input[@data-placeholder="Username"]')
driver.refresh()
assert wait_on_element(driver, 240, '//p[text()="HA is enabled."]')
......@@ -359,11 +368,13 @@ def click_the_save_button_which_should_be_returned_to_the_storage_page(driver):
driver.find_element_by_xpath('//button[contains(.,"Save Access Control List")]').click()
time.sleep(1)
assert wait_on_element_disappear(driver, 30, '//h6[contains(.,"Please wait")]')
assert wait_on_element_disappear(driver, 30, '//h1[contains(.,"Updating Dataset ACL")]')
@then(parsers.parse('click on the "{dataset_name}" 3 dots button, select View Permissions'))
def click_on_the_my_ad_dataset_3_dots_button_select_view_permissions(driver, dataset_name):
"""click on the "my_ad_dataset" 3 dots button, select View Permissions."""
assert wait_on_element(driver, 15, f'//div[contains(text(),"{dataset_name}")]')
assert wait_on_element(driver, 5, f'//tr[contains(.,"{dataset_name}")]//mat-icon[text()="more_vert"]', 'clickable')
driver.find_element_by_xpath(f'//tr[contains(.,"{dataset_name}")]//mat-icon[text()="more_vert"]').click()
......
# coding=utf-8
"""SCALE High Availability (tn-bhyve01) feature tests."""
import pytest
from function import (
wait_on_element,
is_element_present,
......@@ -13,16 +14,20 @@ from pytest_bdd import (
when,
parsers
)
from pytest_dependency import depends
pytestmark = [pytest.mark.debug_test]
@pytest.mark.dependency(name='SMB_ACTIVE_Directory', scope='session')
@scenario('features/NAS-T963.feature', 'Add an ACL Item and verify is preserve')
def test_add_an_acl_item_and_verify_is_preserve(driver):
"""Add an ACL Item and verify is preserve."""
@given(parsers.parse('the browser is open, navigate to "{nas_url}"'))
def the_browser_is_open_navigate_to_nas_url(driver, nas_url):
def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):
"""the browser is open, navigate to "{nas_url}"."""
depends(request, ['Active_Directory'], scope='session')
if nas_url not in driver.current_url:
driver.get(f"http://{nas_url}/ui/sessions/signin")
assert wait_on_element(driver, 10, '//input[@data-placeholder="Username"]')
......@@ -47,7 +52,7 @@ def if_the_login_page_appears_enter__user_and_password(driver, user, password):
@then('on the Dashboard, click Storage on the left sidebar')
def on_the_dashboard_click_storage_on_the_left_sidebar(driver):
"""on the Dashboard, click Storage on the left sidebar."""
assert wait_on_element(driver, 7, '//span[contains(.,"Dashboard")]')
assert wait_on_element(driver, 7, '//h1[text()="Dashboard"]')
assert wait_on_element(driver, 10, '//span[contains(.,"System Information")]')
assert wait_on_element(driver, 5, '//mat-list-item[@ix-auto="option__Storage"]', 'clickable')
driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Storage"]').click()
......@@ -110,6 +115,7 @@ def click_the_save_button_should_be_returned_to_the_storage_page(driver):
assert wait_on_element(driver, 5, '//button[contains(.,"Save Access Control List")]', 'clickable')
driver.find_element_by_xpath('//button[contains(.,"Save Access Control List")]').click()
assert wait_on_element_disappear(driver, 20, '//h6[contains(.,"Please wait")]')
assert wait_on_element_disappear(driver, 30, '//h1[contains(.,"Updating Dataset ACL")]')
assert wait_on_element(driver, 7, '//h1[text()="Storage"]')
......@@ -132,4 +138,4 @@ def the_dataset_permissions_box_should_appear(driver):
@then(parsers.parse('verify the new ACL item for user "{name}" still exist'))
def verify_the_new_acl_item_for_user_ericbsd_still_exist(driver, name):
"""verify the new ACL item for user "ericbsd" still exist."""
assert wait_on_element(driver, 5, '//div[text()="User - ericbsd"]')
assert wait_on_element(driver, 5, '//div[@class="name" and text()="User - ericbsd"]')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment