POMWright v1.5 Bridge Migration (BasePage -> BasePageV1toV2)
Migrate v1 BasePage page objects to BasePageV1toV2 (the bridge), converting locator definitions
and call-site syntax to v2. The bridge is deprecated and will be removed in 2.0.0; it exists only
as a staged migration step.
Workflow
- Inventory the target POC file: identify
BasePageextends,initLocatorSchemas, alladdSchemacalls, and call-sites using v1 accessors. - Switch inheritance from
BasePagetoBasePageV1toV2. Constructor signature stays the same (page, testInfo, baseUrl, urlPath, pocName, pwrl). - Add
defineLocators()method stub. - Translate each
addSchemacall frominitLocatorSchemasintothis.add(path).method(...)insidedefineLocators(). See references/schema-translation.md for the full mapping table and examples. - Remove translated
addSchemaentries frominitLocatorSchemas. Once all are moved, keepinitLocatorSchemas()as an empty method while still extendingBasePageV1toV2. - Update call-site syntax in tests/helpers/fixtures that consume the POC. See references/call-site-migration.md.
- Verify by running tests.
Key rules
- Paths already registered in
defineLocatorsare skipped when the bridge translatesinitLocatorSchemas- no duplicates. - v1 schemas using
Locatorinstances or missing selector fields cannot be auto-translated; rewrite those indefineLocatorsimmediately. BasePageV1toV2narrowsthis.locatorstoaddSchemaonly; no other v1 mutations are exposed.- v2 accessors (
add,getLocator,getNestedLocator,getLocatorSchema) are exposed on the bridge and should be used from this point forward. - v2
getLocator/getNestedLocatorare synchronous (noawait). v1 versions were async. - v2
getNestedLocatorno longer accepts index maps. UsegetLocatorSchema(path).nth(subPath, index).getNestedLocator()instead. filterreplaces v1addFilter.nthreplaces v1 index maps. Both can be chained in any order.
References
- Schema translation mapping: references/schema-translation.md - GetByMethod -> v2 DSL mapping table, filter/options translation, reusable locators, frameLocator changes
- Call-site migration: references/call-site-migration.md - getLocator, getNestedLocator, getLocatorSchema, update, addFilter, index maps, SessionStorage changes
Source: DyHex/POMWright — distributed by TomeVault.