pomwright 1.5.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +5 -5
  3. package/dist/index.d.mts +75 -970
  4. package/dist/index.d.ts +75 -970
  5. package/dist/index.js +585 -1872
  6. package/dist/index.mjs +598 -1880
  7. package/package.json +9 -11
  8. package/AGENTS.md +0 -37
  9. package/docs/v1/BaseApi-explanation.md +0 -63
  10. package/docs/v1/BasePage-explanation.md +0 -96
  11. package/docs/v1/LocatorSchema-explanation.md +0 -271
  12. package/docs/v1/LocatorSchemaPath-explanation.md +0 -165
  13. package/docs/v1/PlaywrightReportLogger-explanation.md +0 -56
  14. package/docs/v1/get-locator-methods-explanation.md +0 -250
  15. package/docs/v1/intro-to-using-pomwright.md +0 -899
  16. package/docs/v1/sessionStorage-methods-explanation.md +0 -38
  17. package/docs/v1/tips-folder-structure.md +0 -38
  18. package/docs/v1-to-v2-migration/bridge-migration-guide.md +0 -159
  19. package/docs/v1-to-v2-migration/direct-migration-guide.md +0 -238
  20. package/docs/v1-to-v2-migration/v1-to-v2-comparison.md +0 -547
  21. package/docs/v2/PageObject.md +0 -293
  22. package/docs/v2/composing-locator-modules.md +0 -93
  23. package/docs/v2/locator-registry.md +0 -695
  24. package/docs/v2/logging.md +0 -168
  25. package/docs/v2/overview.md +0 -515
  26. package/docs/v2/session-storage.md +0 -160
  27. package/index.ts +0 -75
  28. package/intTestV2/.env +0 -0
  29. package/intTestV2/fixtures/testApp.fixtures.ts +0 -43
  30. package/intTestV2/package.json +0 -22
  31. package/intTestV2/page-object-models/testApp/pages/iframe/iframe.locatorSchema.ts +0 -24
  32. package/intTestV2/page-object-models/testApp/pages/iframe/iframe.page.ts +0 -17
  33. package/intTestV2/page-object-models/testApp/pages/testPage.locatorSchema.ts +0 -32
  34. package/intTestV2/page-object-models/testApp/pages/testPage.page.ts +0 -119
  35. package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.locatorSchema.ts +0 -29
  36. package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.page.ts +0 -48
  37. package/intTestV2/page-object-models/testApp/pages/testPath/testPath.locatorSchema.ts +0 -9
  38. package/intTestV2/page-object-models/testApp/pages/testPath/testPath.page.ts +0 -23
  39. package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.locatorSchema.ts +0 -114
  40. package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.page.ts +0 -23
  41. package/intTestV2/page-object-models/testApp/testApp.base.ts +0 -20
  42. package/intTestV2/playwright.config.ts +0 -54
  43. package/intTestV2/server.js +0 -216
  44. package/intTestV2/test-data/staticPage/index.html +0 -280
  45. package/intTestV2/test-data/staticPage/w3images/avatar2.png +0 -0
  46. package/intTestV2/test-data/staticPage/w3images/avatar3.png +0 -0
  47. package/intTestV2/test-data/staticPage/w3images/avatar5.png +0 -0
  48. package/intTestV2/test-data/staticPage/w3images/avatar6.png +0 -0
  49. package/intTestV2/test-data/staticPage/w3images/forest.jpg +0 -0
  50. package/intTestV2/test-data/staticPage/w3images/lights.jpg +0 -0
  51. package/intTestV2/test-data/staticPage/w3images/mountains.jpg +0 -0
  52. package/intTestV2/test-data/staticPage/w3images/nature.jpg +0 -0
  53. package/intTestV2/test-data/staticPage/w3images/snow.jpg +0 -0
  54. package/intTestV2/tests/locatorRegistry/add/add.describe.spec.ts +0 -54
  55. package/intTestV2/tests/locatorRegistry/add/add.filter.spec.ts +0 -143
  56. package/intTestV2/tests/locatorRegistry/add/add.frameLocator.spec.ts +0 -23
  57. package/intTestV2/tests/locatorRegistry/add/add.get.clone.spec.ts +0 -76
  58. package/intTestV2/tests/locatorRegistry/add/add.getByAltText.spec.ts +0 -23
  59. package/intTestV2/tests/locatorRegistry/add/add.getById.spec.ts +0 -45
  60. package/intTestV2/tests/locatorRegistry/add/add.getByLabel.spec.ts +0 -23
  61. package/intTestV2/tests/locatorRegistry/add/add.getByPlaceholder.spec.ts +0 -23
  62. package/intTestV2/tests/locatorRegistry/add/add.getByRole.spec.ts +0 -23
  63. package/intTestV2/tests/locatorRegistry/add/add.getByTestId.spec.ts +0 -23
  64. package/intTestV2/tests/locatorRegistry/add/add.getByText.spec.ts +0 -23
  65. package/intTestV2/tests/locatorRegistry/add/add.getByTitle.spec.ts +0 -23
  66. package/intTestV2/tests/locatorRegistry/add/add.locator.spec.ts +0 -23
  67. package/intTestV2/tests/locatorRegistry/add/add.reuseExisting.spec.ts +0 -107
  68. package/intTestV2/tests/locatorRegistry/add/add.reuseReusable.spec.ts +0 -311
  69. package/intTestV2/tests/locatorRegistry/add/add.spec.ts +0 -159
  70. package/intTestV2/tests/locatorRegistry/filter.cycle.spec.ts +0 -39
  71. package/intTestV2/tests/locatorRegistry/getLocator/getLocator.spec.ts +0 -253
  72. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.clearSteps.spec.ts +0 -105
  73. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.describe.spec.ts +0 -23
  74. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.filter.spec.ts +0 -368
  75. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getLocator.spec.ts +0 -56
  76. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getNestedLocator.spec.ts +0 -175
  77. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.nth.spec.ts +0 -60
  78. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.remove.spec.ts +0 -32
  79. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.replace.spec.ts +0 -24
  80. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.spec.ts +0 -110
  81. package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.update.spec.ts +0 -322
  82. package/intTestV2/tests/locatorRegistry/getNestedLocator/getNestedLocator.spec.ts +0 -412
  83. package/intTestV2/tests/locatorRegistry/registry/registry.binding.spec.ts +0 -50
  84. package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.spec.ts +0 -115
  85. package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.typecheck.ts +0 -86
  86. package/intTestV2/tests/locatorRegistry/validation/validation.sub-path.spec.ts +0 -45
  87. package/intTestV2/tests/step/step.spec.ts +0 -49
  88. package/intTestV2/tests/testApp/color.spec.ts +0 -15
  89. package/intTestV2/tests/testApp/iframe.spec.ts +0 -57
  90. package/intTestV2/tests/testApp/testFilters.spec.ts +0 -24
  91. package/intTestV2/tests/testApp/testPage.spec.ts +0 -161
  92. package/intTestV2/tests/testApp/testPath.spec.ts +0 -18
  93. package/pack-build.sh +0 -11
  94. package/pack-test-v2.sh +0 -36
  95. package/playwright.base.ts +0 -42
  96. package/skills/README.md +0 -56
  97. package/skills/pomwright-v1-5-bridge-migration/SKILL.md +0 -40
  98. package/skills/pomwright-v1-5-bridge-migration/references/call-site-migration.md +0 -178
  99. package/skills/pomwright-v1-5-bridge-migration/references/schema-translation.md +0 -183
  100. package/skills/pomwright-v2-migration/SKILL.md +0 -63
  101. package/skills/pomwright-v2-migration/references/call-site-migration.md +0 -265
  102. package/skills/pomwright-v2-migration/references/class-migration.md +0 -266
  103. package/skills/pomwright-v2-migration/references/fixture-and-helpers.md +0 -423
  104. package/skills/pomwright-v2-migration/references/locator-registration.md +0 -344
  105. package/srcV2/fixture/base.fixtures.ts +0 -23
  106. package/srcV2/helpers/navigation.ts +0 -153
  107. package/srcV2/helpers/playwrightReportLogger.ts +0 -196
  108. package/srcV2/helpers/sessionStorage.ts +0 -251
  109. package/srcV2/helpers/stepDecorator.ts +0 -106
  110. package/srcV2/locators/index.ts +0 -15
  111. package/srcV2/locators/locatorQueryBuilder.ts +0 -427
  112. package/srcV2/locators/locatorRegistrationBuilder.ts +0 -558
  113. package/srcV2/locators/locatorRegistry.ts +0 -583
  114. package/srcV2/locators/locatorUpdateBuilder.ts +0 -602
  115. package/srcV2/locators/reusableLocatorBuilder.ts +0 -200
  116. package/srcV2/locators/types.ts +0 -256
  117. package/srcV2/locators/utils.ts +0 -309
  118. package/srcV2/locators/v1SchemaTranslator.ts +0 -178
  119. package/srcV2/pageObject.ts +0 -105
@@ -1,38 +0,0 @@
1
- # SessionStorage helper
2
-
3
- Every `BasePage` exposes a `sessionStorage` property that wraps common operations on `window.sessionStorage`. The helper records each action as a Playwright `test.step` for better reporting.
4
-
5
- ## set(states, reload)
6
-
7
- Writes key/value pairs to session storage. Passing `true` for `reload` refreshes the page to apply the new state immediately.
8
-
9
- ```ts
10
- await page.sessionStorage.set({ token: "abc", theme: "dark" }, true);
11
- ```
12
-
13
- ## setOnNextNavigation(states)
14
-
15
- Queues values that are written just before the next navigation event. Multiple calls merge their state.
16
-
17
- ```ts
18
- await login.sessionStorage.setOnNextNavigation({ token: "abc" });
19
- await login.page.goto(login.fullUrl); // queued values are applied before navigation completes
20
- ```
21
-
22
- ## get(keys?)
23
-
24
- Retrieves data from session storage. When `keys` are provided only those values are returned; otherwise all stored keys are returned.
25
-
26
- ```ts
27
- const { theme } = await page.sessionStorage.get(["theme"]);
28
- ```
29
-
30
- ## clear()
31
-
32
- Removes everything from session storage:
33
-
34
- ```ts
35
- await page.sessionStorage.clear();
36
- ```
37
-
38
- These helpers are especially useful when tests need to prime application state without going through the UI.
@@ -1,38 +0,0 @@
1
- # Folder Structure
2
-
3
- How you structure your project is ultimately up to you and what makes sense often differ between projects, but I've found the following structure works quite well in most cases.
4
-
5
- ```text
6
- ./playwright
7
- /fixtures
8
- /app1
9
- app1.fixtures.ts
10
- /app2
11
- /automatic
12
- /custom-expects
13
- all.fixtures.ts
14
- /pom
15
- /app1
16
- /common
17
- /basePage
18
- app1.basePage.ts
19
- /helpers
20
- /pages
21
- homepage.locatorSchema.ts
22
- homepage.page.ts
23
- /profile
24
- profile.locatorSchema.ts
25
- profile.page.ts
26
- /app2
27
- /tests
28
- /app1
29
- /byFeature
30
- login.spec.ts
31
- /byResourcePath
32
- homepage.spec.ts
33
- /profile
34
- profile.spec.ts
35
- /e2e
36
- /app2
37
- /e2e
38
- ```
@@ -1,159 +0,0 @@
1
- # Bridge Migration Guide (BasePage ➜ BasePageV1toV2 ➜ PageObject)
2
-
3
- This guide is for teams that want a **two-step migration**:
4
-
5
- 1. Move from `BasePage` (v1) to `BasePageV1toV2` (bridge).
6
- 2. Then move from `BasePageV1toV2` to `PageObject` (v2).
7
-
8
- The bridge preserves v1 locator schema ingestion while exposing v2 registries, allowing gradual conversion.
9
-
10
- > `BasePageV1toV2` is deprecated and will be removed in 2.0.0. Use it only as a temporary bridge.
11
-
12
- ---
13
-
14
- ## Step 1: Migrate `BasePage` to `BasePageV1toV2`
15
-
16
- ### v1 BasePage
17
-
18
- ```ts
19
- class LoginPage extends BasePage<Paths> {
20
- constructor(page: Page, testInfo: TestInfo, log: PlaywrightReportLogger) {
21
- super(page, testInfo, "https://example.com", "/login", "LoginPage", log);
22
- }
23
-
24
- protected initLocatorSchemas() {
25
- this.locators.addSchema({
26
- locatorSchemaPath: "main.button@login",
27
- locatorMethod: GetByMethod.role,
28
- role: "button",
29
- roleOptions: { name: "Login" },
30
- });
31
- }
32
- }
33
- ```
34
-
35
- ### Bridge: BasePageV1toV2
36
-
37
- ```ts
38
- class LoginPage extends BasePageV1toV2<Paths> {
39
- constructor(page: Page, testInfo: TestInfo, log: PlaywrightReportLogger) {
40
- super(page, testInfo, "https://example.com", "/login", "LoginPage", log);
41
- }
42
-
43
- protected defineLocators(): void {
44
- // Start migrating here with v2 add(...) calls.
45
- this.add("main.button@login").getByRole("button", { name: "Login" });
46
- }
47
-
48
- protected initLocatorSchemas(): void {
49
- // Keep v1 schemas temporarily until you migrate them all.
50
- this.locators.addSchema({
51
- locatorSchemaPath: "main.form@login",
52
- locatorMethod: GetByMethod.role,
53
- role: "form",
54
- roleOptions: { name: "Login" },
55
- });
56
- }
57
- }
58
- ```
59
-
60
- Key points:
61
-
62
- - `BasePageV1toV2` still requires `testInfo` and `PlaywrightReportLogger`.
63
- - It exposes **both** v1 schema ingestion (`initLocatorSchemas`) and v2 accessors (`add`, `getLocator`, `getNestedLocator`, `getLocatorSchema`).
64
- - You can migrate locators incrementally by moving schemas from `initLocatorSchemas` to `defineLocators`.
65
-
66
- ---
67
-
68
- ## Step 2: Gradually migrate locators to v2 DSL
69
-
70
- ### Convert one schema at a time
71
-
72
- ```ts
73
- // v1 schema
74
- this.locators.addSchema({
75
- locatorSchemaPath: "main.form@login.input@username",
76
- locatorMethod: GetByMethod.label,
77
- label: "Username",
78
- });
79
-
80
- // v2 DSL (preferred)
81
- this.add("main.form@login.input@username").getByLabel("Username");
82
- ```
83
-
84
- ### Replace v1 mutations
85
-
86
- ```ts
87
- // v1
88
- await page
89
- .getLocatorSchema("main.form@login.input@username")
90
- .addFilter("main.form@login", { hasText: "Login" })
91
- .getNestedLocator();
92
-
93
- // v2
94
- page
95
- .getLocatorSchema("main.form@login.input@username")
96
- .filter("main.form@login", { hasText: "Login" })
97
- .getNestedLocator();
98
- ```
99
-
100
- ---
101
-
102
- ## Step 3: Remove v1 schema ingestion entirely
103
-
104
- When all schemas are converted to `defineLocators`, delete `initLocatorSchemas` and switch to `PageObject`.
105
-
106
- ```ts
107
- class LoginPage extends PageObject<Paths> {
108
- constructor(page: Page) {
109
- super(page, "https://example.com", "/login", { label: "LoginPage" });
110
- }
111
-
112
- protected defineLocators(): void {
113
- this.add("main.form@login.input@username").getByLabel("Username");
114
- }
115
-
116
- protected pageActionsToPerformAfterNavigation() {
117
- return [];
118
- }
119
- }
120
- ```
121
-
122
- ---
123
-
124
- ## Step 4: Update API usage
125
-
126
- After switching to `PageObject`, update the remaining call sites:
127
-
128
- - `getLocator` / `getNestedLocator` are synchronous and the latter no longer accept index maps.
129
- - `SessionStorage` signatures changed (`set(states, { reload, waitForContext })`).
130
- - PageObject does not implement `testInfo` and `PlaywrightReportLogger` while v1 `BasePage` does, if you want them in your POCs you'll need to add them.
131
-
132
- ---
133
-
134
- ## Bridge checklist
135
-
136
- - [ ] Replace extend `BasePage` with extend `BasePageV1toV2`.
137
- - [ ] Add `defineLocators()` and start migrating schemas.
138
- - [ ] Migrate all locator schemas to `defineLocators`.
139
- - [ ] Update FrameLocators (see [v1-to-v2-comparison.md](docs/v1-to-v2-migration/v1-to-v2-comparison.md))
140
- - [ ] Update getById regex patterns (see [v1-to-v2-comparison.md](docs/v1-to-v2-migration/v1-to-v2-comparison.md))
141
- - [ ] Replace v1 `getLocatorSchema(path).addFilter(...)` with v2 `getLocatorSchema(path).filter(...)`.
142
- - [ ] Replace v1 getNestedLocator index maps with v2 `getLocatorSchema(path).nth(...)`.
143
- - [ ] Update v1 `getLocatorSchema(path).update(...)` with v2 `getLocatorSchema(path)`... `.update(...)` / `.nth(...)` / `.filter(...)` etc.
144
- - [ ] Replace extend `BasePageV1toV2` with extend `PageObject`. See [direct-migration-guide.md](docs/v1-to-v2-migration/direct-migration-guide.md)
145
- - [ ] Update logging and session storage usage.
146
-
147
- ---
148
-
149
- ## When to avoid the bridge
150
-
151
- Skip `BasePageV1toV2` if:
152
-
153
- - You can migrate all locators and method calls quickly.
154
- - You want to adopt v2 URL typing and navigation immediately.
155
- - You do not need the old `GetLocatorBase` or schema objects.
156
-
157
- ---
158
-
159
- For a full feature comparison and method mapping, see [v1-to-v2-comparison.md](docs/v1-to-v2-migration/v1-to-v2-comparison.md).
@@ -1,238 +0,0 @@
1
- # Direct v1 ➜ v2 Migration Guide
2
-
3
- This guide shows how to migrate directly from `BasePage` (v1) to `PageObject` (v2). It focuses on the structural changes, locator conversion, and API differences you must address.
4
-
5
- > v1 is deprecated and will be removed in 2.0.0. v1.5.0 is the final v1 release.
6
-
7
- ---
8
-
9
- ## 1) Inventory your v1 usage
10
-
11
- Before changing code, list where the following appear:
12
-
13
- - `BasePage` subclasses.
14
- - `initLocatorSchemas` definitions.
15
- - `LocatorSchema` objects and `GetByMethod` usage.
16
- - `getLocatorSchema(...).update(...)` and `addFilter(...)` chains.
17
- - `getLocator` / `getNestedLocator` wrappers.
18
- - `SessionStorage` usage (old signatures).
19
- - `PlaywrightReportLogger` usage in constructors.
20
- - Any `data-cy` selectors or custom selector engines.
21
-
22
- ---
23
-
24
- ## 2) Convert `BasePage` to `PageObject`
25
-
26
- ### v1
27
-
28
- ```ts
29
- class LoginPage extends BasePage<Paths> {
30
- constructor(page: Page, testInfo: TestInfo, log: PlaywrightReportLogger) {
31
- super(page, testInfo, "https://example.com", "/login", "LoginPage", log);
32
- }
33
-
34
- protected initLocatorSchemas() {
35
- this.locators.addSchema({
36
- locatorSchemaPath: "main.button@login",
37
- locatorMethod: GetByMethod.role,
38
- role: "button",
39
- roleOptions: { name: "Login" },
40
- });
41
- }
42
- }
43
- ```
44
-
45
- ### v2
46
-
47
- ```ts
48
- class LoginPage extends PageObject<Paths> {
49
- constructor(page: Page) {
50
- super(page, "https://example.com", "/login", { label: "LoginPage" });
51
- }
52
-
53
- protected defineLocators(): void {
54
- this.add("main.button@login").getByRole("button", { name: "Login" });
55
- }
56
-
57
- protected pageActionsToPerformAfterNavigation() {
58
- return [];
59
- }
60
- }
61
- ```
62
-
63
- Key changes:
64
-
65
- - Remove `testInfo`, `PlaywrightReportLogger`, and `pocName` constructor args.
66
- - Use `defineLocators()` instead of `initLocatorSchemas()`.
67
- - Provide `pageActionsToPerformAfterNavigation()`.
68
-
69
- ---
70
-
71
- ## 3) Translate v1 locator schemas to v2 `add(...)`
72
-
73
- ### v1 locator schema
74
-
75
- ```ts
76
- this.locators.addSchema({
77
- locatorSchemaPath: "main.form@login.input@username",
78
- locatorMethod: GetByMethod.label,
79
- label: "Username",
80
- });
81
- ```
82
-
83
- ### v2 registry DSL
84
-
85
- ```ts
86
- this.add("main.form@login.input@username").getByLabel("Username");
87
- ```
88
-
89
- Mapping guide:
90
-
91
- | v1 `locatorMethod` | v2 method |
92
- | --- | --- |
93
- | `role` | `getByRole(...)` |
94
- | `text` | `getByText(...)` |
95
- | `label` | `getByLabel(...)` |
96
- | `placeholder` | `getByPlaceholder(...)` |
97
- | `altText` | `getByAltText(...)` |
98
- | `title` | `getByTitle(...)` |
99
- | `locator` | `locator(...)` |
100
- | `frameLocator` | `frameLocator(...)` |
101
- | `testId` | `getByTestId(...)` |
102
- | `id` (custom) | `getById(...)` (custom) |
103
- | `dataCy` (custom) | `locator('[data-cy="..."]')` |
104
-
105
- ---
106
-
107
- ## 4) Replace `getLocator` / `getNestedLocator`
108
-
109
- In v1 these were async wrappers and accepted index maps. In v2 they are synchronous and do not accept index maps.
110
-
111
- ### v1
112
-
113
- ```ts
114
- const submit = await poc.getNestedLocator("main.form.button@submit", {
115
- "main.form": 0,
116
- });
117
- ```
118
-
119
- ### v2
120
-
121
- ```ts
122
- const submit = poc
123
- .getLocatorSchema("main.form.button@submit")
124
- .nth("main.form", 0)
125
- .getNestedLocator();
126
- ```
127
-
128
- ---
129
-
130
- ## 5) Replace v1 `getLocatorSchema().update()` and `addFilter()`
131
-
132
- ### v1
133
-
134
- ```ts
135
- const submit = await poc
136
- .getLocatorSchema("main.form.button@submit")
137
- .update("main.form.button@submit", { roleOptions: { name: "Sign in" } })
138
- .addFilter("main.form.button@submit", { hasText: /Sign in/i })
139
- .getNestedLocator();
140
- ```
141
-
142
- ### v2
143
-
144
- ```ts
145
- const submit = poc
146
- .getLocatorSchema("main.form.button@submit")
147
- .update("main.form.button@submit")
148
- .getByRole({ name: "Sign in" })
149
- .filter("main.form.button@submit", { hasText: /Sign in/i })
150
- .getNestedLocator();
151
- ```
152
-
153
- ---
154
-
155
- ## 6) Update SessionStorage usage
156
-
157
- ### v1
158
-
159
- ```ts
160
- await poc.sessionStorage.set({ token: "abc" }, true);
161
- const data = await poc.sessionStorage.get(["token"]);
162
- await poc.sessionStorage.clear();
163
- ```
164
-
165
- ### v2
166
-
167
- ```ts
168
- await poc.sessionStorage.set({ token: "abc" }, { reload: true });
169
- const data = await poc.sessionStorage.get(["token"], { waitForContext: true });
170
- await poc.sessionStorage.clear({ waitForContext: true });
171
- ```
172
-
173
- ---
174
-
175
- ## 7) Replace BasePage logging
176
-
177
- In v1, `BasePage` receives `PlaywrightReportLogger` and keeps it internally. In v2, logging is provided by the `test` fixture.
178
-
179
- ### v2 fixture
180
-
181
- ```ts
182
- import { test } from "pomwright";
183
-
184
- test("login flow", async ({ page, log }) => {
185
- log.info("starting login");
186
- });
187
- ```
188
-
189
- If you want logging inside POMs, pass a child logger explicitly.
190
-
191
- ---
192
-
193
- ## 8) Update navigation flows
194
-
195
- v2 adds a navigation helper to `PageObject` and expects a `pageActionsToPerformAfterNavigation()` method.
196
-
197
- ```ts
198
- protected pageActionsToPerformAfterNavigation() {
199
- return [
200
- async () => {
201
- await this.getNestedLocator("main.form@login").waitFor({ state: "visible" });
202
- },
203
- ];
204
- }
205
-
206
- await loginPage.navigation.gotoThisPage();
207
- await loginPage.navigation.expectAnotherPage();
208
- ```
209
-
210
- ---
211
-
212
- ## 9) Remove v1-only APIs
213
-
214
- - `BaseApi` is deprecated and not part of v2. Use your own API base class.
215
- - `GetBy` and `LocatorSchema` objects are replaced by the registry DSL.
216
- - `data-cy` selector engine is removed; use `locator('[data-cy="..."]')` or register your own selector engine in Playwright.
217
-
218
- ---
219
-
220
- ## 10) Validate after migration
221
-
222
- - Run tests.
223
- - Check all POMs compile with strict types.
224
- - Confirm registry paths match the new dot-delimited rules (no whitespace).
225
-
226
- ---
227
-
228
- ## Summary checklist
229
-
230
- - [ ] Replace `BasePage` with `PageObject`.
231
- - [ ] Move `initLocatorSchemas` → `defineLocators`.
232
- - [ ] Convert `LocatorSchema` objects to `add(...).getBy...` calls.
233
- - [ ] Replace `addFilter` and index maps with `filter` + `nth`.
234
- - [ ] Update `SessionStorage` signatures.
235
- - [ ] Remove `data-cy` and custom selector engine assumptions.
236
- - [ ] Adopt the v2 `test` fixture for logging or implement it directly, see docs/v2/logging.md.
237
-
238
- For the bridge option, see `bridge-migration-guide.md`.