@bigbinary/neeto-team-members-playwright
v1.0.5
Published
Playwright helpers for the neeto team members nano.
Readme
Team members Playwright helpers
@bigbinary/neeto-team-members-playwright contains the team member and role
POMs, selectors, and types owned by this nano. It is versioned and published
independently of @bigbinary/neeto-team-members-frontend.
Generic helpers stay in @bigbinary/neeto-playwright-commons. These POMs use
commons for page commands, common selectors, filters, and exampleEmail.
Usage
Install it in the consuming product's playwright-tests/ directory:
yarn add -D @bigbinary/neeto-team-members-playwrightThe product supplies the peer dependencies listed in package.json, including
@bigbinary/neeto-playwright-commons. The frontend package is not required.
Like commons, the package is ES-module only, and Playwright loads specs as
CommonJS. Add a path alias next to @neetoplaywright in the product's
playwright-tests/tsconfig.json, and import through it.
"paths": {
"@neetoteammembers": [
"./node_modules/@bigbinary/neeto-team-members-playwright"
]
}import {
MEMBER_SELECTORS,
Member,
MemberApis,
ROLES_SELECTORS,
RoleApis,
RolesPage,
TeamMembers,
} from "@neetoteammembers";- Construct
TeamMemberswith{ page, neetoPlaywrightUtilities }. It drives the neeto-atoms sheet UI: radios,menuitembulk actions, and column menus opened from the column header's button. searchMemberByEmail(email)lowercases the address, then searches and verifies the row.new Member(neetoPlaywrightUtilities)creates and updates members through the nano's REST API. Create sendsuser(emails,organization_role,app_roles). Update sendsteam(active,first_name,last_name,organization_role,email, and optionalprofile). Bulk update sendsusers(organization_role,active,emails).- Construct
RolesPagewith(page, neetoPlaywrightUtilities). It checks permissions by label.new RoleApis(neetoPlaywrightUtilities)sendsorganization_role(name,kind,description,permission_ids) and deletenew_role_id. - The host's i18next fixture must load the nano translations before a POM is created.
Member helpers
MemberApis.fetchByEmail(email)queries active members using the server-sideneeto_filtersemail condition and a lowercased email.fetch(params = {})remains available for other scopes and pagination.Member.getUserIdViaAPI(email)polls that filtered request for up to 60 seconds, matches case-insensitively, and returns the member id. It fails if no active member becomes available.Member.addMemberViaRequest({ email, appName, ... })waits for the creation job to finish, then returns the member id using that lookup.Member.editMemberViaRequest,deactivateMemberViaRequest, andupdateEmailViaAPIupdate profiles, deactivate members, and change email.generateRandomTeamMembers({ count, role })creates test-data objects.MemberApis.create,jobStatus,fetchPermissions,update, andbulkUpdateexpose member creation, job polling, permission listing, and member updates.TeamMembers.pageTitleis the members page title from the nano'staxonomyDefaultLabels.member.pluraltranslation. Use it in page-title assertions instead of hard-coding the text.TeamMembers.openMemberShowPage(email)searches by email, opens the matching name cell, and verifies the member page heading.TeamMembers.navigateToTeamMembers,openMemberPane,fillMemberForm,submit,addMemberViaUI,editMemberViaUI, andremoveMemberViaUIdrive the members table and V2 member sheet.searchAndVerifyMemberByEmail({ email })andsearchMemberByEmail(email)search and verify a row;getMemberRowByName(name)returns its row locator.openFilterPane,filterMembersByMultiSelect, andfilterMembersset member filters.takeActionOnMembersperforms bulk actions;performColumnActionandtoggleMemberColumnscontrol table columns.verifyMemberInTable({ name, email })checks the row details;verifyNoDataTitle(email)verifies an empty search result;exportDetails(fileType, adminEmail)requests a member export.
Role helpers
RolesPage.pageTitleis the roles page title from the nano'sneetoTeamMembers.common.roletranslation (plural). Use it in page-title assertions instead of hard-coding "Roles".fetchSortedPermissions()returns permissions in numericsequenceorder.getPermissionIdsByName(names)verifies every requested name exists and returns its ids in sequence order.getPermissionDescriptionsByName(names)returns matching descriptions in the same order.addCustomRoleByPermissionNamesViaRequest(roleName, names)creates a role with permissions selected by their internal names.grantPermissionsByNameViaRequest(roleName, names)replaces the role's permissions and verifies the requested ids were granted. Its request containsid,kind,name, andpermission_ids, withoutorganization_id.getRolePermissionCheckboxes(roleName, category)returns the category's permission checkboxes, excluding its first, category-level checkbox.getTableCheckboxBesidePermission(roleName, description)returns the checkbox aligned with a permission description, excluding category-level rows.verifyRolePermissionCheckboxStates({ roleName, checkedPermissionNames })verifies checked and unchecked permissions across the expanded, unfiltered table.verifyAddRolePanePermissionStates(checkedPermissionNames)verifies the open role sheet using each permission's internal name.getPermissionIds(targetPermissions, isGranularPermission)looks up permission ids by category, or by description when the second argument is true.getRoleIdAndOrganizationId(roleName)resolves a role's identifiers.addCustomRoleViaRequest,editRoleViaRequest, anddeleteRoleViaRequestcreate, edit, and delete roles through the API.addRoleViaUI,editRoleViaUI,selectAndSubmitPermissions, anddeleteRoleViaUIdrive the role sheet and table actions.verifyAddAndDeleteRole({ route, roleName })opens the roles page, then adds and deletes a role with no permissions through the UI.routedefaults to commons'ROUTES.adminPanel.roles, androleNameto a random 8-character name. Production health tests pass it to commons'health.verifyAppIsLive(customSteps), which no longer checks roles itself:test("should verify application is live", ({ health, page, neetoPlaywrightUtilities, }) => health.verifyAppIsLive(() => test.step("3: Verify adding & removing roles", () => new RolesPage(page, neetoPlaywrightUtilities).verifyAddAndDeleteRole()) ));Products whose roles page is elsewhere pass
route: CRM uses/admin/admin-panel/manageUsers/roles, Planner/admin-panel/general/roles, and Code, Runner, CI, Git, Tower, and Quiz/admin/admin-panel/roles.verifyPermissionschecks element visibility for a permission set;verifyRoleSpecificLinkAccesschecks access to product-supplied routes.RoleApis.fetch,addRole,editRole, anddeleteRoleexpose the underlying member/permission/role listing and role mutation requests.
VerifyRolePermissionCheckboxStatesParams is explicitly exported alongside the
existing public argument and response types.
Selector changes (breaking)
Added MEMBER_SELECTORS.manageRolesButton, changeRoleButton,
rolesSearchInput, changeRoleOption(role), and filteredMembersCount from
V2's action block. Added ROLES_SELECTORS.tablePermissionCard(category),
tableCategoryTitle, and emptyCategoryRow from the V2 roles table.
Removed selectors with no literal or generated counterpart in the nano:
MEMBER_SELECTORS.deactivatedAgentsButtonMEMBER_SELECTORS.activatedMembersButtonMEMBER_SELECTORS.menuBarHeadingMEMBER_SELECTORS.statusTagMEMBER_SELECTORS.subscriptionPlanTagROLES_SELECTORS.searchTextField
These removals require a minor release. The existing sheet selectors
ROLES_SELECTORS.permissionCard, permissionCategoryTitle, and
permissionCheckbox(name) remain distinct from the table selectors.
Local development
To try unreleased changes in a product, publish with yalc from this directory,
then add the package in the product's playwright-tests/ directory. Remove the
yalc link before committing so the product's manifest and lockfile stay
unchanged:
yarn build && yalc publishcd path/to/product/playwright-tests
yalc add --dev @bigbinary/neeto-team-members-playwrightAfter the first publish, yalc push from playwright/ updates every product
that added the package. Remove it with
yalc remove @bigbinary/neeto-team-members-playwright.
Releasing
Merge a PR with the playwright label and a patch, minor, or major label.
The existing NeetoCI bump workflow publishes this package and opens the
Bump version PR.
