Utilities#

This section documents utility functions and types used in the automation testing suite.

buildRowIdentifier#

buildRowIdentifier(opts)#
Arguments:
Returns:

string

buildUserData#

buildUserData(opts)#

Builds a UserData object with sensible defaults. Override any field by passing it via the partial options parameter.

Example:
const user = buildUserData({

firstName: ‘Jane’, permissions: userPermissions.Staff.newStaff

});

Arguments:
Returns:

UserData

createRowNameToClick#

createRowNameToClick(opts, clickSaveWhenDone, email, firstName, lastName, permissions, popupHeading, rowToClickIdentifier, skipPopupCheck, useRandomToggles)#
Arguments:
  • opts (RowNameOptions)

  • clickSaveWhenDone (boolean) – Click Save button after filling user info (for standalone user creation dialogs)

  • email (string)

  • firstName (string)

  • lastName (string)

  • popupHeading (string) – Custom popup heading to verify (default: ‘Add New Staff’)

  • rowToClickIdentifier (number)

  • skipPopupCheck (boolean) – Skip popup field verification (useful in wizard contexts like Sponsor Org creation)

  • useRandomToggles (boolean)

Returns:

getLocalPart#

getLocalPart(email)#

Extracts local part from email (string before the “@”)

Arguments:
Returns:

string

randomBoolean#

randomBoolean()#

Returns a random boolean, e.g. ~50% true, 50% false

Returns:

boolean

randomFirstName#

randomFirstName()#

Returns a random first name from a predefined list.

Returns:

string

randomLastName#

randomLastName()#

Returns a random last name from a predefined list.

Returns:

string

takeNamedScreenshot#

takeNamedScreenshot(page, functionName, stepName, waitBeforeCapture)#

Takes a screenshot with a standardized naming convention and optional comment

Arguments:
  • page (Page) – Playwright page object

  • functionName (string) – Name of the function taking the screenshot

  • stepName (string) – Brief description of the step being captured

  • waitBeforeCapture (number) – Optional time to wait before taking screenshot (default: 500ms)

Returns:

Promise