Unverified Commit 067b82fd authored by Eric Turgeon's avatar Eric Turgeon Committed by GitHub
Browse files

TE-629 / 22.12.3 / Updating and fixing test for 22.12.3 (#8275)

* Fixed shell_Select xpaths

* change the wait for please wait to 30s in test_NAS_T1237.py

* Change to wait for container active status to 15 minutes

depending of the network it can take over 10 minutes

* change the app install wait to disappear to 5 minutes

* removed NAS-T1223 core file alert has been removed

* Updated the default catalog name in test_NAS_T1353.py to TRUENAS

Also improved wait for input in test_NAS_T1356.py

* Add missing LDAP_SMB depends in test_NAS_T1237.py
Showing with 24 additions and 137 deletions
+24 -137
......@@ -102,11 +102,11 @@ def change_the_users_shell_and_click_save(driver):
element = driver.find_element_by_xpath(xpaths.button.save)
driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(0.5)
assert wait_on_element(driver, 7, '//ix-combobox[@formcontrolname="shell"]//input', 'clickable')
driver.find_element_by_xpath('//ix-combobox[@formcontrolname="shell"]//input').click()
assert wait_on_element(driver, 7, xpaths.add_User.shell_Select, 'clickable')
driver.find_element_by_xpath(xpaths.add_User.shell_Select).click()
# keep a space before sh in the xpath below to make sure it only grab sh and not the other that contains sh.
assert wait_on_element(driver, 7, '//mat-option[contains(.," sh")]', 'clickable')
driver.find_element_by_xpath('//mat-option[contains(.," sh")]').click()
assert wait_on_element(driver, 7, xpaths.add_User.sh_Shell_Option, 'clickable')
driver.find_element_by_xpath(xpaths.add_User.sh_Shell_Option).click()
assert wait_on_element(driver, 7, xpaths.button.save, 'clickable')
driver.find_element_by_xpath(xpaths.button.save).click()
......@@ -124,7 +124,6 @@ def open_the_user_drop_down_to_verify_the_shell_was_changed(driver):
assert wait_on_element(driver, 7, xpaths.users.eric_User, 'clickable')
driver.find_element_by_xpath(xpaths.users.eric_User).click()
assert wait_on_element(driver, 7, xpaths.users.eric_Edit_Button)
driver.find_element_by_xpath('//dt[contains(.,"Shell:")]')
@then('Updated value should be visible')
......
......@@ -197,9 +197,9 @@ def Verify_App_Status(driver, app_Name, app):
assert wait_on_element(driver, 10, xpaths.button.close, 'clickable')
driver.find_element_by_xpath(xpaths.button.close).click()
assert wait_on_element_disappear(driver, 40, xpaths.progress.spinner)
assert wait_on_element(driver, 500, f'//mat-card[contains(.,"{app_Name}")]//span[@class="status active"]')
assert wait_on_element(driver, 720, f'//mat-card[contains(.,"{app_Name}")]//span[@class="status active"]')
else:
assert wait_on_element(driver, 500, f'//mat-card[contains(.,"{app_Name}")]//span[@class="status active"]')
assert wait_on_element(driver, 720, f'//mat-card[contains(.,"{app_Name}")]//span[@class="status active"]')
def Wait_For_Inputable_And_Input_Value(driver, xpath, value):
......
# coding=utf-8
"""SCALE UI feature tests."""
import reusableSeleniumCode as rsc
import time
import xpaths
from function import (
wait_on_element,
is_element_present,
wait_on_element_disappear,
ssh_cmd
)
from pytest_bdd import (
given,
scenario,
then,
when,
)
from pytest_dependency import depends
@scenario('features/NAS-T1223.feature', 'Verify core file alert works')
def test_verify_core_file_alert_works(driver):
"""Verify core file alert works."""
@given('the browser is open on the TrueNAS URL and logged in')
def the_browser_is_open_on_the_truenas_url_and_logged_in(driver, nas_ip, root_password, request):
"""the browser is open on the TrueNAS URL and logged in."""
depends(request, ['Set_Interface'], scope='session')
if nas_ip not in driver.current_url:
driver.get(f"http://{nas_ip}")
assert wait_on_element(driver, 10, xpaths.login.user_Input)
if not wait_on_element(driver, 3, xpaths.side_Menu.dashboard):
assert wait_on_element(driver, 5, xpaths.login.user_Input, 'inputable')
driver.find_element_by_xpath(xpaths.login.user_Input).clear()
driver.find_element_by_xpath(xpaths.login.user_Input).send_keys('root')
driver.find_element_by_xpath(xpaths.login.password_Input).clear()
driver.find_element_by_xpath(xpaths.login.password_Input).send_keys(root_password)
assert wait_on_element(driver, 5, xpaths.login.signin_Button)
driver.find_element_by_xpath(xpaths.login.signin_Button).click()
else:
assert wait_on_element(driver, 7, xpaths.side_Menu.dashboard, 'clickable')
driver.find_element_by_xpath(xpaths.side_Menu.dashboard).click()
@when('on the dashboard, if there is dismiss all notification')
def on_the_dashboard_if_there_is_dismiss_all_notification(driver):
"""on the dashboard, if there is dismiss all notification."""
rsc.Verify_The_Dashboard(driver)
rsc.Dismiss_All_Alerts(driver)
@then('kill a python process with ssh to trigger core files alert')
def kill_a_python_process_with_ssh_to_trigger_core_files_alert(driver, nas_ip, root_password):
"""kill a python process with ssh to trigger core files alert."""
cmd = 'python3 -c "import os; os.abort()"'
results = ssh_cmd(cmd, 'root', root_password, nas_ip)
# Command will failed since kills a process
assert results['result'] is False, results['output']
@then('wait for the alert and verify the core files warning alert')
def wait_for_the_alert_and_verify_the_core_files_warning_alert(driver):
"""wait for the alert and verify the core files warning alert."""
assert wait_on_element(driver, 7, xpaths.toolbar.notification)
assert wait_on_element(driver, 180, '//span[contains(.,"notifications")]//span[contains(text(),"1")]')
assert wait_on_element(driver, 7, xpaths.toolbar.notification_Button, 'clickable')
driver.find_element_by_xpath(xpaths.toolbar.notification_Button).click()
assert wait_on_element(driver, 7, xpaths.alert.title)
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//h3[contains(.,"Warning")]')
assert wait_on_element(driver, 7, '//h4[contains(.,"Core files for the following executables were found: /usr/bin/python")]')
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//mat-icon[normalize-space(text())="error"]')
@then('click on the core files warning Dismiss and verify it is dismissed')
def click_on_the_core_files_warning_dismiss_and_verify_it_is_dismissed(driver):
"""click on the core files warning Dismiss and verify it is dismissed."""
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//a[normalize-space(text())="Dismiss"]', 'clickable')
driver.find_element_by_xpath('//ix-alert[contains(.,"Core files")]//a[normalize-space(text())="Dismiss"]').click()
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//mat-icon[normalize-space(text())="check_circle"]')
@then('click on the core files warning Re-Open and verify the alert is back')
def click_on_the_core_files_warning_reopen_and_verify_the_alert_is_back(driver):
"""click on the core files warning Re-Open and verify the alert is back."""
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//a[normalize-space(text())="Re-Open"]', 'clickable')
driver.find_element_by_xpath('//ix-alert[contains(.,"Core files")]//a[normalize-space(text())="Re-Open"]').click()
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//h3[contains(.,"Warning")]')
assert wait_on_element(driver, 7, '//ix-alert[contains(.,"Core files")]//mat-icon[normalize-space(text())="error"]')
assert wait_on_element(driver, 7, xpaths.alert.close_Button, 'clickable')
driver.find_element_by_xpath(xpaths.alert.close_Button).click()
@then('after remove the core files in "/var/db/system/cores"')
def after_remove_the_core_files_in_vardbsystemcores(driver, nas_ip, root_password):
"""after remove the core files in "/var/db/system/cores"."""
cmd = 'rm -f /var/db/system/cores/*'
results = ssh_cmd(cmd, 'root', root_password, nas_ip)
assert results['result'] is True, results['output']
@then('verify that the core file alert disappear')
def verify_that_the_core_file_alert_disappear(driver):
"""verify that the core file alert disappear."""
assert wait_on_element_disappear(driver, 180, '//span[contains(.,"notifications")]//span[contains(text(),"1")]')
driver.find_element_by_xpath(xpaths.toolbar.notification_Button).click()
assert wait_on_element(driver, 7, xpaths.alert.title)
assert not is_element_present(driver, '//ix-alert[contains(.,"Core files")]//h3[contains(.,"Warning")]')
assert wait_on_element(driver, 7, xpaths.alert.close_Button, 'clickable')
driver.find_element_by_xpath(xpaths.alert.close_Button).click()
time.sleep(0.5)
......@@ -29,7 +29,7 @@ def test_verify_recursive_and_transverse_acl_options():
@given('the browser is open, the TrueNAS URL and logged in')
def the_browser_is_open_the_truenas_url_and_logged_in(driver, nas_ip, root_password, request):
"""the browser is open, the TrueNAS URL and logged in."""
depends(request, ['tank_pool'], scope='session')
depends(request, ['tank_pool', 'LDAP_SMB'], scope='session')
if nas_ip not in driver.current_url:
driver.get(f"http://{nas_ip}")
assert wait_on_element(driver, 10, xpaths.login.user_Input)
......@@ -73,7 +73,7 @@ def on_the_datasets_page_create_a_smb_dataset_rtacltest1_with_tank(driver, datas
driver.find_element_by_xpath(xpaths.add_Dataset.share_Type_SMB_Option).click()
assert wait_on_element(driver, 5, xpaths.button.save, 'clickable')
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element_disappear(driver, 15, xpaths.popup.please_Wait)
assert wait_on_element_disappear(driver, 30, xpaths.popup.please_Wait)
assert wait_on_element(driver, 7, xpaths.dataset.dataset_Name(dataset1_name))
......@@ -94,7 +94,7 @@ def create_a_second_smb_dataset_rtacltest2_under_rtacltest1(driver, dataset2_nam
driver.find_element_by_xpath(xpaths.add_Dataset.share_Type_SMB_Option).click()
assert wait_on_element(driver, 5, xpaths.button.save, 'clickable')
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element_disappear(driver, 15, xpaths.popup.please_Wait)
assert wait_on_element_disappear(driver, 30, xpaths.popup.please_Wait)
assert wait_on_element(driver, 5, '//button[contains(.,"Return to pool list")]', 'clickable')
driver.find_element_by_xpath('//button[contains(.,"Return to pool list")]').click()
assert wait_on_element(driver, 7, xpaths.dataset.dataset_Name(dataset2_name))
......
......@@ -108,7 +108,7 @@ def click_save_and_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -86,7 +86,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -95,7 +95,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -88,7 +88,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 10, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -87,7 +87,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -86,7 +86,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the App is active')
......
......@@ -19,8 +19,8 @@ from pytest_dependency import depends
@pytest.mark.dependency(name='App_Catalog')
@scenario('features/NAS-T1353.feature', 'Apps Page - Validate adding a Catalog')
def test_apps_page__validate__adding_truecharts():
"""Apps Page - Validate adding TrueCharts."""
def test_apps_page__validate_adding_a_catalog():
"""Apps Page - Validate adding a Catalog."""
@given('the browser is open, navigate to the SCALE URL, and login')
......@@ -64,7 +64,7 @@ def on_application_page_click_on_the_manage_catalogs_tab(driver):
@then('click the Add Catalog button and confirm the warning')
def click_add_catalog_and_confirm_the_warning(driver):
"""click Add Catalog and confirm the warning."""
assert wait_on_element(driver, 10, '//div[text()=" OFFICIAL "]')
assert wait_on_element(driver, 10, xpaths.applications.default_Catalog_Name)
assert wait_on_element(driver, 10, xpaths.button.add_Catalog, 'clickable')
driver.find_element_by_xpath(xpaths.button.add_Catalog).click()
assert wait_on_element(driver, 7, xpaths.popup.warning)
......
......@@ -89,7 +89,7 @@ def under_port_forwarding_click_add_input_80_in_container_port_and_9004_in_node_
"""under Port Forwarding click Add input 80 in Container Port and 9004 in Node Port."""
assert wait_on_element(driver, 7, xpaths.app_Setup.add_Port_Forwading_Button, 'clickable')
driver.find_element_by_xpath(xpaths.app_Setup.add_Port_Forwading_Button).click()
assert wait_on_element(driver, 7, xpaths.app_Setup.container_Port_Input)
assert wait_on_element(driver, 7, xpaths.app_Setup.container_Port_Input, 'inputable')
driver.find_element_by_xpath(xpaths.app_Setup.container_Port_Input).clear()
driver.find_element_by_xpath(xpaths.app_Setup.container_Port_Input).send_keys('80')
assert wait_on_element(driver, 7, xpaths.app_Setup.node_Port_Input)
......@@ -102,7 +102,7 @@ def click_add_again_input_443_in_container_port_and_9005_in_node_port(driver):
"""click Add again input 443 in Container Port and 9005 in Node Port."""
assert wait_on_element(driver, 7, xpaths.app_Setup.add_Port_Forwading_Button, 'clickable')
driver.find_element_by_xpath(xpaths.app_Setup.add_Port_Forwading_Button).click()
assert wait_on_element(driver, 7, xpaths.app_Setup.container_Port2_Input)
assert wait_on_element(driver, 7, xpaths.app_Setup.container_Port2_Input, 'inputable')
driver.find_element_by_xpath(xpaths.app_Setup.container_Port2_Input).clear()
driver.find_element_by_xpath(xpaths.app_Setup.container_Port2_Input).send_keys('443')
assert wait_on_element(driver, 7, xpaths.app_Setup.node_Port2_Input)
......@@ -117,7 +117,7 @@ def click_save_wait_for_the_installation_to_finish(driver):
driver.find_element_by_xpath(xpaths.button.save).click()
assert wait_on_element(driver, 5, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 240, xpaths.popup.installing)
assert wait_on_element_disappear(driver, 300, xpaths.popup.installing)
@then('confirm installation is successful and the Docker image is active')
......
......@@ -62,8 +62,9 @@ class add_User:
username_Input = '//ix-input[@formcontrolname="username"]//input'
password_Input = '//ix-input[@formcontrolname="password"]//input'
confirm_Password_Input = '//ix-input[@formcontrolname="password_conf"]//input'
shell_Select = '//ix-combobox[@formcontrolname="shell"]//input'
shell_Select = '//ix-select[@formcontrolname="shell"]//mat-select'
bash_Shell_Option = '//mat-option[contains(.,"bash")]'
sh_Shell_Option = '//mat-option[contains(.," sh")]'
sudo_Checkbox = '//mat-checkbox[contains(.,"Allow all sudo commands")]'
email_Input = '//ix-input[@formcontrolname="email"]//input'
auxiliary_Groups_Select = '//ix-select[@formcontrolname="groups"]//mat-select'
......@@ -112,6 +113,7 @@ class applications:
title = '//h1[text()="Applications"]'
available_Applications_Tab = '//div[contains(text(),"Available Applications")]'
manage_Catalogs_Tab = '//div[contains(text(),"Manage Catalogs")]'
default_Catalog_Name = '//div[contains(text(),"TRUENAS")]'
def card(app_name):
return f'//mat-card[contains(.,"{app_name}")]'
......
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