@bigbinary/neeto-tags-playwright
v1.0.3
Published
Playwright helpers for the neeto tags nano.
Readme
Tags Playwright helpers
@bigbinary/neeto-tags-playwright contains the tags POM, API helper, selectors,
and types owned by this nano. It is versioned and published independently of
@bigbinary/neeto-tags-frontend.
Usage
Install it in the consuming product's playwright-tests/ directory:
yarn add -D @bigbinary/neeto-tags-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": {
"@neetotags": ["./node_modules/@bigbinary/neeto-tags-playwright"]
}import {
MERGE_TAGS_SELECTORS,
TAGS_SELECTORS,
TagsApi,
TagsPage,
} from "@neetotags";- Construct
TagsPagewith(page, neetoPlaywrightUtilities, tagsRequestUrl?). It drives the nano's/v2dashboard, merge flow, and entity tag picker UI. PasstagsRequestUrlwhen the host serves the tags API somewhere other than${BASE_URL}/admin/tags(/api/v1/admin/tags), for example${BASE_URL}/desk/tagsin neetoDesk. addTagViaUI({ tagName, description, addTagsLabel }),fillTagDetails,editTagViaUI,verifyTag,deleteTagViaUI,attemptDeleteTagViaUIAndExpectError,searchAndVerifyTags, andfilterTagsViaUIdrive the tags dashboard and form sheet.getTagRow(tagName)returns the matching dashboard row locator.addTagViaRequest({ name, description, style })creates a tag through the API and returns it.deleteTagViaRequest(tagId)deletes one.deleteTagsByNameViaRequest(names)fetches tags from the configured URL and deletes every returned tag whose name exactly matches an entry innames. It does nothing when no names match.navigateToMergeTagsPage()opens the merge page. Call it beforemergeTags({ sourceTags, destinationTag })ormergeAndVerifyTagsViaUI, then useverifyMergedTagsto check the result.searchAndSelect({ selector, tagName, rowSelector })searches and selects a source or destination tag in the merge form.assignTag({ tagName, pickerTestId, create })andremoveAssignedTag({ tagName })drive the entityTagsComponentpicker and selected tag badges. By default,assignTagfinds the V2 popover's combobox by its translated search placeholder. PasspickerTestIdfor a host-specific input, including an inline picker.verifyTagOption(tagName, { visible = true } = {})opens the V2 popover, searches for the name, checks the matching option's visibility, and closes the picker. Use{ visible: false }for a missing or already assigned tag. Its options type is exported asVerifyTagOptionProps.new TagsApi(neetoPlaywrightUtilities, tagsRequestUrl?)wraps the nano's REST endpoints:fetch(params),create({ name, description, style }),update({ id, ... }),delete(id), andmerge({ primaryId, secondaryId }).- The host's i18next fixture must load the nano translations before a POM is created.
Breaking selector removals
The following TAGS_SELECTORS keys were removed because V2 does not render
them:
deleteTagButtonandtagContainer: useCOMMON_SELECTORS.badgeCloseButtonandCOMMON_SELECTORS.badgeContainerfor V2 badges.metaDataBlock,tagItemsCountButton, andmetaDataCard: V1-only IDs.tagSearchField: neither the nano nor neeto-atoms generatesselect-tag-container. The V2 popover uses an optional host-supplied test ID; the inline Select generates<prefix>-select-input. UseassignTag's default popover lookup or pass the host's actual input ID aspickerTestId.
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-tags-playwrightAfter the first publish, yalc push from playwright/ updates every product
that added the package. Remove it with
yalc remove @bigbinary/neeto-tags-playwright.
Releasing
Add playwright and exactly one of patch, minor, or major, then add
release last to enter the NeetoTower release gate described in the root
README. Removing public selectors requires minor. After the gate merges the
PR, the NeetoCI bump workflow publishes this package and opens the
Bump version PR.
