univention.testing.browser package

Contents

univention.testing.browser package#

Submodules#

univention.testing.browser.appcenter module#

univention.testing.browser.appcenter.wait_for_final_query(response: playwright.sync_api.Response)[source]#
class univention.testing.browser.appcenter.AppCenter(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username='Administrator', password='univention')[source]#
handle_first_open_dialog()[source]#
open_app(app_name: str)[source]#

Click on an app in the AppCenter overview

return_to_app_module_from_app_view()[source]#

Return to the app center overview from an opened app

install_app(app_name: str)[source]#

Install an app. The AppCenter needs to be on the overview screen

handle_installation_dialog()[source]#
uninstall_app(app_name: str)[source]#

Uninstall an app. The AppCenter needs to be on the overview screen

univention.testing.browser.generic_udm_module module#

class univention.testing.browser.generic_udm_module.CreatedItem(identifying_name: str)[source]#

Bases: object

identifying_name: str#
class univention.testing.browser.generic_udm_module.AddObjectDialog(tester: UMCBrowserTest, locator: playwright.sync_api.Locator)[source]#

Bases: object

Use this class when pressing the “Add” button opens a dialog

Parameters:
  • tester – The UMCBrowserTest instance to use

  • locator – The locator of the dialog

fill_field(label: str, value: str, exact: bool = False, **kwargs) None[source]#
finish(label: str) None[source]#
next(label: str = 'Next') None[source]#
class univention.testing.browser.generic_udm_module.DetailsView(tester: UMCBrowserTest)[source]#

Bases: object

fill_field(label: str, value: str) None[source]#
check_checkbox(label: str) None[source]#
save(label: str = 'Save') None[source]#
open_tab(name: str) None[source]#
click_button(name: str) None[source]#
upload_picture(img_path: str) playwright.sync_api.Locator[source]#
remove_picture() None[source]#
class univention.testing.browser.generic_udm_module.GenericUDMModule(tester: UMCBrowserTest, module_name: str)[source]#

Bases: object

The GenericUmcModule is the base class for a bunch of UMC Modules which are all structured similarly This class provides a bunch of methods for functionality that is similar/common in the modules.

Parameters:
  • tester – The base tester

  • module_name – The module name to be opened by navigate

navigate(username='Administrator', password='univention') None[source]#
add_object_dialog() AddObjectDialog[source]#

Will add an object by clicking the Add button which is visible for all modules inheriting from this class The way how objects are added is however different between the classes. Some open a dialog to fill in information, others open a full page view and others do both. This function should be used when a dialog is opened by clicking the add button. If there is a full page view being opened add_object_detail_view should be used

add_object_detail_view() DetailsView[source]#

See add_object_dialog for details

open_details(name: str) DetailsView[source]#

Click on the name of a <tr> entry to open it’s DetailsView

delete(name: str | CreatedItem) None[source]#

Checks the checkbox of the row containing name and then press the delete button

modify_text_field(name: str | CreatedItem, label: str = 'Description', value: str = 'description') None[source]#

Shortcut method to open the details of an object, fill a field with a value and save

Parameters:
  • name – the name of the object to modify

  • label – the label of the textbox to fill the text into

  • value – the value to fill into the textbox

class univention.testing.browser.generic_udm_module.PortalModule(tester: UMCBrowserTest)[source]#

Bases: GenericUDMModule

add(name: str = 'portal_name', lang_code: str = 'English/USA', display_name: str = 'Portal Display Name') CreatedItem[source]#
class univention.testing.browser.generic_udm_module.UserModule(tester: UMCBrowserTest)[source]#

Bases: GenericUDMModule

handle_comboboxes(add_object: AddObjectDialog, template: str | None) None[source]#
create_object(name: str = 'user_name', first_name: str = 'first_name', last_name: str = 'last_name', password: str = 'univention', template: str | None = None) CreatedItem[source]#

Add a new user with the given information

Returns:

CreatedItem which can be passed to subsequent methods of this class to modify the added user

copy_user(original_name: str, name: str, last_name: str = 'last_name', password: str = 'univention') None[source]#
class univention.testing.browser.generic_udm_module.GroupModule(tester: UMCBrowserTest)[source]#

Bases: GenericUDMModule

create_object(group_name: str = 'group_name') CreatedItem[source]#

Add a new group with the given information

Returns:

CreatedItem which can be passed to subsequent methods of this class to modify the added group

class univention.testing.browser.generic_udm_module.PoliciesModule(tester: UMCBrowserTest)[source]#

Bases: GenericUDMModule

create_object(policy_name: str = 'policy_name') CreatedItem[source]#

Add a new policy with the given information

Returns:

CreatedItem which can be passed to subsequent methods of this class to modify the added policy

modify_text_field(created_item: str | CreatedItem, label: str = 'Update to this UCS version', value: str = '4.0') None[source]#

Shortcut method to open the details of an object, fill a field with a value and save

Parameters:
  • name – the name of the object to modify

  • label – the label of the textbox to fill the text into

  • value – the value to fill into the textbox

class univention.testing.browser.generic_udm_module.ComputerModule(tester: UMCBrowserTest)[source]#

Bases: GenericUDMModule

create_object(computer_name: str = 'computer_name_8') CreatedItem[source]#

Add a new computer with the given information

Returns:

CreatedItem which can be passed to subsequent methods of this class to modify the added computer

univention.testing.browser.ldap_directory module#

class univention.testing.browser.ldap_directory.LDAPDirectory(tester: UMCBrowserTest)[source]#

Bases: object

Class for the UMC LDAP Directory module

navigate(username='Administrator', password='univention')[source]#
open_directory(name: str, exact: bool = True)[source]#
expand_directory(name: str, exact: bool = True)[source]#
open_entry(name: str, exact=True)[source]#
edit_container(name: str, exact=True)[source]#

univention.testing.browser.lib module#

class univention.testing.browser.lib.UCSLanguage(value)[source]#

Bases: Enum

EN_US = 1#
DE_DE = 2#
get_name() str[source]#
class univention.testing.browser.lib.Interactions(tester: UMCBrowserTest)[source]#

Bases: object

check_second_checkbox_in_grid()[source]#

This function checks the second checkbox in a grid

Note:

Prefer to use check_checkbox_in_grid_by_name when possible

check_checkbox_in_grid_by_name(name: str, nth: int | None = None)[source]#

This function checks a checkbox in a <tr> where the given name appears

Parameters:
  • name – the name to search for

  • nth – controls what to do when there are multiple entries with name found. If none the function will throw an exception if int the function will act on the nth occurrence of the text

open_modules(modules: list[str], limit: int | None = None, start_at: int | None = None)[source]#

This method will open all modules given by modules. It does this by searching for the module in the UMC, clicking on it and then clicking the close button

Parameters:
  • limit – optionally only open the first limit modules

  • start_at – starts opening

open_all_modules(limit: int | None = None, start_at: int | None = None)[source]#

This method opens all modules that can be found in the UMC when searching for ‘*’

Parameters:
  • limit – optionally only open the first limit modules

  • start_at – starts opening

open_and_close_module(module_name: str, wait_for_network_idle: bool = False)[source]#
get_available_modules() list[str][source]#
open_module(module_name: str, expect_response: Pattern[str] | str | None = None, wait_for_network_idle: bool = False)[source]#

This method opens a module from anywhere where the module search bar in the UCM is visible

Parameters:
  • module_name – the name of the module to be opened

  • expect_response – wait for a specific response to be completed before returning

  • wait_for_network_idle – wait for no network connections for at least 500ms. Mututally exclusive with expect_response.

fill_combobox(name: str, option: str)[source]#
class univention.testing.browser.lib.UMCBrowserTest(page: playwright.sync_api.Page, lang: UCSLanguage = UCSLanguage.EN_US)[source]#

Bases: Interactions

This is the base class for all Playwright browser tests. It defines common operations and methods that are useful to all other library modules.

Note:

As a general rule of this library, unless otherwise noted, the caller is responsible for the translation of a string

Parameters:
  • page – The Playwright Page object

  • lang – The language to use for UCS

lang: UCSLanguage#
set_language(lang: UCSLanguage)[source]#
property base_url: str#
Returns:

the base url in the form of https://{hostname}.{domainname}

property ldap_base: str#
property domainname: str#
check_for_no_module_available_popup()[source]#
login(username: str = 'Administrator', password: str = 'univention', location: str = '/univention/management', check_for_no_module_available_popup: bool = False, login_should_fail: bool = False, do_navigation: bool = True, expect_password_change_prompt: bool = False, wait_until: str = 'networkidle')[source]#

Navigates to {base_url}/univention/login?location={location} and logs in with the given credentials

Parameters:
  • username – The username of the user to be logged in

  • password – The password of the user to be logged in

  • location – the location to navigate to after a successful login. This value is being URL encoded

  • check_for_no_module_available_popup – If set to true check for a “There is no module available for the…” popup after login

  • login_should_fail – Returns after failure to log in with wrong credentials

  • do_navigation – Wether to navigate to the login page

  • expect_password_change_prompt – Expect a password change prompt to be visible after clicking the Login button

end_umc_session()[source]#

Logs the current logged in user out by navigating to /univention/login

logout()[source]#

Logout using the Side Menu

This method is merely a shortcut for SideMenu.logout()

systemd_restart_service(service: str)[source]#
restart_umc()[source]#

univention.testing.browser.packagemanagement module#

class univention.testing.browser.packagemanagement.PackageAction(value)[source]#

Bases: Enum

Install = 1#
Uninstall = 2#
expected_status() str[source]#
class univention.testing.browser.packagemanagement.PackageManagement(tester: UMCBrowserTest)[source]#

Bases: object

Class for the Package Management UCS Module

navigate(username='Administrator', password='univention')[source]#
find_small_package() str[source]#

Finds a small package that is less than 0.5 MB, has no dependencies and recommended packages

Returns:

the package name

search_for_package(name: str)[source]#
do_package_action(name: str, action: PackageAction)[source]#
handle_confirmation_dialog(action: str)[source]#
handle_action_dialog()[source]#
install_package(name: str)[source]#

Installs a package that is automatically chosen to be both small in size and has no dependencies and verifies that it is installed

uninstall_package(name: str)[source]#
verify_package_status(expected: PackageAction)[source]#

Verify that the package actually got (un)installed

Parameters:

expected – If expected is PackageAction.Install this function will make sure that the package has been _installed_ and vice versa.

univention.testing.browser.policies module#

class univention.testing.browser.policies.Policies(tester: UMCBrowserTest)[source]#

Bases: object

Class for the UMC LDAP Directory module

navigate()[source]#
toggle_section(name: str, exact: bool = True)[source]#
create_registry_policy(name: str, variable_key: str, variable_value: str)[source]#

univention.testing.browser.portal module#

class univention.testing.browser.portal.UCSPortalEditMode(tester: UMCBrowserTest)[source]#

Bases: object

This Class is used to interact with the edit mode of the UCS Portal.

navigate()[source]#
open_edit_side_bar()[source]#

Open the side bar in the edit mode

upload_background_picture(path='')[source]#

Takes a screenshot of the current page and sets it as the background image. The side bar needs to be opened with open_edit_side_bar before calling this function

remove_background_picture()[source]#

Remove the background picture. A background picture needs to have been set. The side bar needs to be opened with open_edit_side_bar before calling this function

add_category(internal_name: str, name: str)[source]#

Add a category to the UCS Portal

add_entry(internal_name: str, name: str, description: str, keyword: str, link: str, category: str)[source]#

Add a entry to the UCS Portal. The entry will be created in the last category

add_folder(internal_name: str, name: str, category: str)[source]#

Add a folder to the UCS Portal. The folder will be created in the last category

fill_localization_dialog(text: str, data_test_suffix: str = '', locator: Locator | None = None)[source]#

Fill a localization dialog The dialog MUST NOT be open when this method is called When this method returns the dialog will be closed

Parameters:
  • text – the text to fill the boxes with. Suffixed with “ US” for en_US and “ DE” for de_DE

  • data_test_suffix – this can be used if the button to open to box has an id of the form “[data-test=”iconButton–{data_test_suffix}]”

  • locator – if the data-test attribute does not exist on the button the locator can be passed here

class univention.testing.browser.portal.UCSSideMenu(tester: UMCBrowserTest)[source]#

Bases: object

navigate()[source]#
open_edit_mode() UCSPortalEditMode[source]#
logout() None[source]#
class univention.testing.browser.portal.UCSPortal(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username='Administrator', password='univention', do_login: bool = True, portal_url=None, wait_until_login: str = 'networkidle')[source]#
side_menu() UCSSideMenu[source]#

univention.testing.browser.process_overview module#

class univention.testing.browser.process_overview.ProcessOverview(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username='Administrator', password='univention')[source]#
search(category: Literal['All', 'User', 'PID', 'Command'], text: str)[source]#

Run a search

Parameters:
  • category – the category to search for. NOTICE: this argument gets translated in the function

  • text – the text to search for

ensure_process(process: Popen, category: Literal['All', 'User', 'PID', 'Command'])[source]#

Ensures that a process is running, either by PID or Command

Parameters:
  • process – the process to search for. If searching by name the process args are joined together if searching by pid, process.pid is used

  • category – the category to search for the process by. Currently only PID and Command are supported

kill_process(process: Popen, force: bool)[source]#

Kills the process given by process and ensures that is was actually killed

Parameters:
  • process – the process to kill

  • force – if false sends SIGTERM to the process by pressing the Terminate button if true sends SIGKILL to the process by pressing the ‘Force termination’ button

univention.testing.browser.selfservice module#

class univention.testing.browser.selfservice.UserCreationAttribute(label: str, value: str)[source]#

Bases: object

label: str#
value: str#
class univention.testing.browser.selfservice.SelfService(tester: UMCBrowserTest)[source]#

Bases: object

navigate(hash: str = '', username: str | None = None, password: str | None = None)[source]#
navigate_create_account()[source]#
fill_create_account(attributes: dict[str, UserCreationAttribute], button: str | None = 'Create an account')[source]#

univention.testing.browser.sidemenu module#

class univention.testing.browser.sidemenu.SideMenuUser(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username: str = 'Administrator', password: str = 'univention', do_login: bool = True, **kwargs)[source]#
change_password(old_password: str, new_password: str)[source]#
class univention.testing.browser.sidemenu.SideMenuServer(tester: UMCBrowserTest)[source]#

Bases: object

navigate()[source]#
reboot_server(do_reboot: bool = False)[source]#
class univention.testing.browser.sidemenu.SideMenuLicense(tester: UMCBrowserTest)[source]#

Bases: object

navigate(do_login: bool = True)[source]#
import_license(license_file_path: Path, as_text: bool)[source]#
open_license_information()[source]#
class univention.testing.browser.sidemenu.SideMenu(tester: UMCBrowserTest)[source]#

Bases: object

side_menu_button: playwright.sync_api.Locator#
find_side_menu_button()[source]#
navigate(username='Administrator', password='univention', do_login=True, **kwargs)[source]#
toggle_menu()[source]#
switch_to_language(target_language: UCSLanguage)[source]#

Switches the language to the language given by target_language.

This method changes the language using the SideMnu “Switch Language” button. It also updates the tester this Class was initialized with to the new language.

Parameters:

target_language – the language to switch to

logout()[source]#

Logout using the Side Menu

logout_with_fallback()[source]#
back()[source]#
open_user_settings()[source]#

univention.testing.browser.suggestion module#

class univention.testing.browser.suggestion.AppCenterCacheTest[source]#

Bases: object

write(txt: str, truncate: bool = False) None[source]#
restore() None[source]#

univention.testing.browser.systemdiagnostics module#

class univention.testing.browser.systemdiagnostics.SystemDiagnostic(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username='Administrator', password='univention')[source]#
run_system_diagnostics()[source]#
wait_for_system_diagnostics_to_finish()[source]#

univention.testing.browser.udm_users module#

class univention.testing.browser.udm_users.User(username: str, lastname: str, password: str = 'univention', has_popup_after_login: bool = False)[source]#

Bases: object

username: str#
lastname: str#
password: str = 'univention'#
has_popup_after_login: bool = False#
class univention.testing.browser.udm_users.Users(regular_user: univention.testing.browser.udm_users.User, admin_user: univention.testing.browser.udm_users.User)[source]#

Bases: object

regular_user: User#
admin_user: User#
univention.testing.browser.udm_users.create_test_user(udm, lo) User[source]#

univention.testing.browser.univentionconfigurationregistry module#

class univention.testing.browser.univentionconfigurationregistry.UniventionConfigurationRegistry(tester: UMCBrowserTest)[source]#

Bases: object

navigate(username='Administrator', password='univention')[source]#
search(text: str)[source]#
get_ucr_module_search_results(query: str) dict[str, str][source]#

Perform a search in the UCR Module and return the key + value for each row

Parameters:

query – The query to search for

Returns:

A dict with the key and value of the variable

set_variable(key: str, value: str)[source]#