CIT App Helpers#

This section documents the main helper functions and types used throughout the CIT automation testing suite.

addCITCorpUser#

Deprecated since version 1.0: Use addCITCorpUserV2 or newer user creation patterns instead.

addCITCorpUser(page)#

Adds a new CIT Corporation user. This function verifies the popup fields, fills in basic user information, sets CIT Corp specific permissions, and takes a screenshot.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the CIT Corp user has been added.

addCITCorpUserV2#

Deprecated since version 1.0: Use newer user creation patterns. This function may be removed in future versions.

addCITCorpUserV2(page)#

Performs an end-to-end flow for adding a new CIT Corporation user. This includes clicking “New User”, verifying popup fields, filling basic user info, setting permissions, and saving the new user.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the end-to-end user addition flow is complete.

addNewUserWithPermissions#

Deprecated since version 1.0: Use createUserWithPermissions instead.

addNewUserWithPermissions(page, newUserButtonText, email, firstNameValue, lastNameValue)#

Adds a new user with specified permissions by wrapping the function.

Arguments:
  • page (Page) – The Playwright Page object.

  • newUserButtonText (string) – The text of the button to click to initiate new user creation.

  • email (string) – The email address for the new user.

  • firstNameValue (string) – The first name for the new user.

  • lastNameValue (string) – The last name for the new user.

Returns:

Promise – Resolves when the new user with permissions has been added.

addSponsorOrgUser#

Deprecated since version 1.0: Use newer user creation patterns for sponsor organizations.

addSponsorOrgUser(page)#

Adds a new Sponsor Organization user. This function navigates to the new user form, fills in basic user information, sets Sponsor Org specific permissions, and saves the user.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the Sponsor Org user has been added.

addUserSpecificWithEmail#

Deprecated since version 1.0: Use createUser or createUserWithPermissions instead.

addUserSpecificWithEmail(page, email)#

Adds a new user with a specific email address. This function is a wrapper around the more general function.

Arguments:
  • page (Page) – The Playwright Page object.

  • email (string) – The email address for the new user.

Returns:

Promise – Resolves when the user has been added.

checkAddNewStaffPopupFields#

checkAddNewStaffPopupFields(page)#
Arguments:
Returns:

Promise

checkPageSpecificFields#

checkPageSpecificFields(page, pageFieldHeading, otherFieldLocator, secondaryFieldHeading)#
Arguments:
Returns:

Promise

checkPopupFields#

checkPopupFields(page, popupHeading, fieldsList, sectionHeadings, screenshotName, clickButton)#

Generic function to check the presence and visibility of fields and headings within a popup. This function can be reused for various popups across the application.

Arguments:
  • page (Page) – The Playwright Page object.

  • popupHeading (string) – The main heading text of the popup to verify.

  • fieldsList – An array of field names (labels or placeholders) to verify within the popup.

  • sectionHeadings – Optional. An array of section headings to verify within the popup.

  • screenshotName (string) – Base name for screenshot files taken during the process.

  • clickButton (boolean) – If true, clicks a button with the text to open the popup before verification.

Returns:

Promise – A promise that resolves to if all specified fields and headings are successfully verified, otherwise.

checkUserFields#

checkUserFields(page, fullName)#
Arguments:
Returns:

Promise

createUser#

createUser(page, options)#

Creates a new user with specified basic info and permissions. This is a universal function that replaces several similar user creation functions.

Arguments:
  • page (Page) – The Playwright Page object.

  • options – Configuration options for user creation.

Returns:

Promise – Resolves when the user creation process is completed.

createUserWithPermissions#

createUserWithPermissions(page, userDataOrEmail, firstName, lastName, initialPermissions, useRandomToggles)#

Creates a new user with specified basic information and permissions. This function handles both objects and individual parameters for backward compatibility.

Arguments:
  • page (Page) – The Playwright Page object.

  • userDataOrEmail – Either a object containing user details, or a string representing the user’s email address.

  • firstName (string) – The user’s first name (only used if is an email string).

  • lastName (string) – The user’s last name (only used if is an email string).

  • initialPermissions – Permissions to assign to the user (only used if is an email string).

  • useRandomToggles (boolean) – Whether to use random values for permissions (only used if is an email string).

Returns:

Promise – Resolves when the user creation flow is completed.

createUserWithRequiredFields#

Deprecated since version 1.0: Use createUser or createUserWithPermissions instead.

createUserWithRequiredFields(page, email, firstNameValue, lastNameValue)#

Creates a new user with only the required fields (email, first name, last name). This function is a wrapper around the more general function.

Arguments:
  • page (Page) – The Playwright Page object.

  • email (string) – The email address for the new user.

  • firstNameValue (string) – The first name for the new user.

  • lastNameValue (string) – The last name for the new user.

Returns:

Promise – Resolves when the user with required fields has been created.

deleteUserWithConfirmation#

Deprecated since version 1.0: Use performUserAction with ‘delete’ action instead.

deleteUserWithConfirmation(page, userIdentifier, cancelAttempts)#

Handles the user deletion flow, including optional cancellation attempts before final confirmation.

Arguments:
  • page (Page) – The Playwright Page object.

  • userIdentifier – The identifier to locate the user in the table (e.g., full name, email).

  • cancelAttempts (number) – The number of times to attempt to cancel the deletion before proceeding with confirmation.

Returns:

Promise – Resolves when the user deletion flow is completed.

editUserPermissions#

editUserPermissions(page, email, permissionsToToggle, useRandomToggles, useSoftAssert, useFormInfixClickPattern, screenshotName, exactMatches, checkTimeoutMs)#

Edits the permissions for a specific user. This function allows toggling permissions based on a provided list, with options for random toggling, soft assertions, and specific form interaction patterns.

Arguments:
  • page (Page) – The Playwright Page object.

  • email (string) – The email address of the user whose permissions are being edited.

  • permissionsToToggle – An array of permission names (strings) or objects ({name: string, value: boolean}) to toggle. If null, default Staff permissions will be used.

  • useRandomToggles (boolean) – If true, and is a string array, permissions will be randomly toggled.

  • useSoftAssert (boolean) – If true, uses soft assertions for permission checks, allowing tests to continue on failure.

  • useFormInfixClickPattern (boolean) – If true, uses a specific click pattern for form fields (from Codegen recordings).

  • screenshotName (string) – Prefix for screenshot filenames.

  • exactMatches – Specifies whether to use exact matches for permission labels (e.g., ).

  • checkTimeoutMs (number) – Timeout in milliseconds for checking permission elements.

Returns:

Promise – Resolves when the user permissions have been edited and saved.

fillCITCorpInfo#

Deprecated since version 1.0: Use fillOrganizationInfo instead.

fillCITCorpInfo(page, useMailingAddress, CITCorpInfo)#

Fills out the CIT Corporation information form. This function wraps the universal function and adds CITCorp-specific functionality like clicking “Require Investor to Upload” and “Does the Proof of Address”.

Arguments:
  • page (Page) – The Playwright Page object.

  • useMailingAddress (boolean) – Whether to use a mailing address.

  • CITCorpInfo (CITCorpInfo) – Optional object containing specific CIT Corporation information to override defaults.

Returns:

Promise – Resolves when the CIT Corporation information has been filled.

fillCITCorpLegalInfo#

fillCITCorpLegalInfo(page)#

Fills out the legal information form for a CIT Corporation. This includes basic legal fields, address fields, and contact information.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the legal information has been filled.

fillOrganizationInfo#

fillOrganizationInfo(page, orgType, options)#

Universal organization info filling function

Arguments:
  • page (Page) – Playwright page

  • orgType (OrgType) – Type of organization

  • options – Configuration options

Returns:

Promise

fillSponsorORCitOrgInfo#

fillSponsorORCitOrgInfo(page, useMailingAddress, orgType, justRequired, orgInfo)#

Fills out sponsor organization or CIT corporation information. This function is dynamic and allows passing in labels and values for each field. If a value is not provided for a field (e.g., orgName, website), the original hardcoded default values from will be used.

Arguments:
  • page (Page) – The Playwright Page object.

  • useMailingAddress (boolean) – Whether to use a mailing address.

  • orgType (OrgType) – The type of organization (‘CITCorp’, ‘Sponsorship Org’, or ‘Unknown’).

  • justRequired (boolean) – If true, only fills required fields.

  • orgInfo – Optional object containing specific organization information to override defaults.

Returns:

Promise – Resolves when the organization information has been filled.

performUserAction#

performUserAction(page, action, options)#

Performs a specific action (view, edit, delete, activate) on a user.

Arguments:
  • page (Page) – The Playwright Page object.

  • action – The action to perform on the user.

  • options – Configuration options for performing the action.

Returns:

Promise – Resolves when the user action is completed.

searchAndSetListView#

Deprecated since version 1.0: Use direct page interactions instead.

searchAndSetListView(page, searchTerm, itemsPerPage)#

Sets up the list view in a table and searches for a specific user. This involves setting the number of items displayed per page and then performing a search.

Arguments:
  • page (Page) – The Playwright Page object.

  • searchTerm (string) – The term to search for (e.g., user’s name or email).

  • itemsPerPage (string) – The number of items to display per page in the list view.

Returns:

Promise – Resolves when the list view is set up and the search is completed.

setCITCorpUserPermissions#

Deprecated since version 1.0: Use setPermissions instead.

setCITCorpUserPermissions(page, customPermissions)#

Sets the relevant permission checkboxes for a CIT Corp user. This function wraps the universal function.

Arguments:
  • page (Page) – The Playwright Page object.

  • customPermissions – Optional array of permission names (strings) or objects ({name: string, value: boolean}) to set. If not provided, default CIT Corp permissions will be used.

Returns:

Promise – Resolves when the permissions have been set.

setPermissions#

setPermissions(page, entityType, options)#

Sets permissions for a given entity type (CITCorp, SponsorOrg, or Staff). This is a universal function for managing user permissions.

Arguments:
  • page (Page) – The Playwright Page object.

  • entityType – The type of entity for which to set permissions.

  • options – Configuration options for setting permissions.

Returns:

Promise – Resolves when permissions have been set and optionally saved.

setSponsorOrgUserPermissions#

Deprecated since version 1.0: Use setPermissions instead.

setSponsorOrgUserPermissions(page, customPermissions)#

Sets the required permission checkboxes when adding the initial Sponsor Organization user. This function wraps the universal function.

Arguments:
  • page (Page) – The Playwright Page object.

  • customPermissions – Optional array of permission names to set. If not provided, default Sponsor Org permissions will be used.

Returns:

Promise – Resolves when the permissions have been set.

settingsReminderSectionChecks#

Deprecated since version 1.0: Use simpleUserSectionChecks instead.

settingsReminderSectionChecks(page)#

Performs checks related to the settings reminder section. This function navigates to the “Reminder” sub-section under “Settings” and takes a screenshot.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the checks are completed.

simpleUserSectionChecks#

simpleUserSectionChecks(page, options, columnHeaderNamesToCheck, pageSpecificHeading, pageSpecificLocator, searchFieldPlaceholder, searchTerm, secondaryFieldHeading, sideNavChild, sideNavParent)#

Performs a series of basic checks on a user section, including navigation, column header verification, page-specific field checks, and search functionality.

Arguments:
Returns:

Promise – Resolves to true if matches are found after search, false otherwise.

softAssert#

Deprecated since version 1.0: Use Playwright’s built-in expect with soft assertions instead.

softAssert(page, action, description, screenshotName)#

Performs a “soft” assertion that doesn’t fail the test if the expectation fails. Instead, it logs the error and returns a boolean indicating success/failure.

Arguments:
  • page (Page) – Playwright page

  • action – Function containing the expectation to try

  • description (string) – Description of what is being checked

  • screenshotName (string) – Optional name for a screenshot on failure

Returns:

Promise – Promise<boolean> True if the expectation succeeded, false if it failed

userSectionEndToEndFlow#

userSectionEndToEndFlow(page, options, buttonText, clickInRowFullNameAndEmail, columnHeaderNamesToCheck, email, firstName, fullName, fullNameAndEmail, lastName, pageSpecificHeading, pageSpecificLocator, secondaryFieldHeading, sideNavChild, sideNavParent, userPermissionPool)#

Executes a comprehensive end-to-end flow for managing users within a specific section of the application. This function includes navigation, user creation, permission editing, user detail verification, activation link resending, and user deletion.

Arguments:
Returns:

Promise – Resolves when the entire end-to-end user section flow is completed.

verifyAddCITCorpUserPopupFields#

Deprecated since version 1.0: Use checkPopupFields instead.

verifyAddCITCorpUserPopupFields(page)#

Verifies that the “Add New User” popup fields are present and visible for CIT Corp users. This function utilizes the generic function.

Arguments:
  • page (Page) – The Playwright Page object.

Returns:

Promise – Resolves when the popup fields have been verified.

verifyAndManageUser#

verifyAndManageUser(page, firstName, lastName, category_dropdown, subcategory_dropdown, email, userIdentifier)#

Verifies and manages a user’s details within the application. This function navigates to the specified user section, locates the user, opens their details, and performs checks on the user profile fields.

Arguments:
  • page (Page) – The Playwright Page object.

  • firstName (string) – The first name of the user to verify.

  • lastName (string) – The last name of the user to verify.

  • category_dropdown (string) – The parent category in the sidebar navigation (e.g., ‘peopleUser’).

  • subcategory_dropdown (string) – The subcategory in the sidebar navigation (e.g., ‘Staff’).

  • email (string) – The email address of the user.

  • userIdentifier – An identifier (e.g., full name, email) to locate the user’s row in the table.

Returns:

Promise – Resolves when the user verification and management flow is completed.