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.
- package/CHANGELOG.md +22 -0
- package/README.md +5 -5
- package/dist/index.d.mts +75 -970
- package/dist/index.d.ts +75 -970
- package/dist/index.js +585 -1872
- package/dist/index.mjs +598 -1880
- package/package.json +9 -11
- package/AGENTS.md +0 -37
- package/docs/v1/BaseApi-explanation.md +0 -63
- package/docs/v1/BasePage-explanation.md +0 -96
- package/docs/v1/LocatorSchema-explanation.md +0 -271
- package/docs/v1/LocatorSchemaPath-explanation.md +0 -165
- package/docs/v1/PlaywrightReportLogger-explanation.md +0 -56
- package/docs/v1/get-locator-methods-explanation.md +0 -250
- package/docs/v1/intro-to-using-pomwright.md +0 -899
- package/docs/v1/sessionStorage-methods-explanation.md +0 -38
- package/docs/v1/tips-folder-structure.md +0 -38
- package/docs/v1-to-v2-migration/bridge-migration-guide.md +0 -159
- package/docs/v1-to-v2-migration/direct-migration-guide.md +0 -238
- package/docs/v1-to-v2-migration/v1-to-v2-comparison.md +0 -547
- package/docs/v2/PageObject.md +0 -293
- package/docs/v2/composing-locator-modules.md +0 -93
- package/docs/v2/locator-registry.md +0 -695
- package/docs/v2/logging.md +0 -168
- package/docs/v2/overview.md +0 -515
- package/docs/v2/session-storage.md +0 -160
- package/index.ts +0 -75
- package/intTestV2/.env +0 -0
- package/intTestV2/fixtures/testApp.fixtures.ts +0 -43
- package/intTestV2/package.json +0 -22
- package/intTestV2/page-object-models/testApp/pages/iframe/iframe.locatorSchema.ts +0 -24
- package/intTestV2/page-object-models/testApp/pages/iframe/iframe.page.ts +0 -17
- package/intTestV2/page-object-models/testApp/pages/testPage.locatorSchema.ts +0 -32
- package/intTestV2/page-object-models/testApp/pages/testPage.page.ts +0 -119
- package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.locatorSchema.ts +0 -29
- package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.page.ts +0 -48
- package/intTestV2/page-object-models/testApp/pages/testPath/testPath.locatorSchema.ts +0 -9
- package/intTestV2/page-object-models/testApp/pages/testPath/testPath.page.ts +0 -23
- package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.locatorSchema.ts +0 -114
- package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.page.ts +0 -23
- package/intTestV2/page-object-models/testApp/testApp.base.ts +0 -20
- package/intTestV2/playwright.config.ts +0 -54
- package/intTestV2/server.js +0 -216
- package/intTestV2/test-data/staticPage/index.html +0 -280
- package/intTestV2/test-data/staticPage/w3images/avatar2.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar3.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar5.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar6.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/forest.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/lights.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/mountains.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/nature.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/snow.jpg +0 -0
- package/intTestV2/tests/locatorRegistry/add/add.describe.spec.ts +0 -54
- package/intTestV2/tests/locatorRegistry/add/add.filter.spec.ts +0 -143
- package/intTestV2/tests/locatorRegistry/add/add.frameLocator.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.get.clone.spec.ts +0 -76
- package/intTestV2/tests/locatorRegistry/add/add.getByAltText.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getById.spec.ts +0 -45
- package/intTestV2/tests/locatorRegistry/add/add.getByLabel.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getByPlaceholder.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getByRole.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getByTestId.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getByText.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.getByTitle.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.locator.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/add/add.reuseExisting.spec.ts +0 -107
- package/intTestV2/tests/locatorRegistry/add/add.reuseReusable.spec.ts +0 -311
- package/intTestV2/tests/locatorRegistry/add/add.spec.ts +0 -159
- package/intTestV2/tests/locatorRegistry/filter.cycle.spec.ts +0 -39
- package/intTestV2/tests/locatorRegistry/getLocator/getLocator.spec.ts +0 -253
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.clearSteps.spec.ts +0 -105
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.describe.spec.ts +0 -23
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.filter.spec.ts +0 -368
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getLocator.spec.ts +0 -56
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getNestedLocator.spec.ts +0 -175
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.nth.spec.ts +0 -60
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.remove.spec.ts +0 -32
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.replace.spec.ts +0 -24
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.spec.ts +0 -110
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.update.spec.ts +0 -322
- package/intTestV2/tests/locatorRegistry/getNestedLocator/getNestedLocator.spec.ts +0 -412
- package/intTestV2/tests/locatorRegistry/registry/registry.binding.spec.ts +0 -50
- package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.spec.ts +0 -115
- package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.typecheck.ts +0 -86
- package/intTestV2/tests/locatorRegistry/validation/validation.sub-path.spec.ts +0 -45
- package/intTestV2/tests/step/step.spec.ts +0 -49
- package/intTestV2/tests/testApp/color.spec.ts +0 -15
- package/intTestV2/tests/testApp/iframe.spec.ts +0 -57
- package/intTestV2/tests/testApp/testFilters.spec.ts +0 -24
- package/intTestV2/tests/testApp/testPage.spec.ts +0 -161
- package/intTestV2/tests/testApp/testPath.spec.ts +0 -18
- package/pack-build.sh +0 -11
- package/pack-test-v2.sh +0 -36
- package/playwright.base.ts +0 -42
- package/skills/README.md +0 -56
- package/skills/pomwright-v1-5-bridge-migration/SKILL.md +0 -40
- package/skills/pomwright-v1-5-bridge-migration/references/call-site-migration.md +0 -178
- package/skills/pomwright-v1-5-bridge-migration/references/schema-translation.md +0 -183
- package/skills/pomwright-v2-migration/SKILL.md +0 -63
- package/skills/pomwright-v2-migration/references/call-site-migration.md +0 -265
- package/skills/pomwright-v2-migration/references/class-migration.md +0 -266
- package/skills/pomwright-v2-migration/references/fixture-and-helpers.md +0 -423
- package/skills/pomwright-v2-migration/references/locator-registration.md +0 -344
- package/srcV2/fixture/base.fixtures.ts +0 -23
- package/srcV2/helpers/navigation.ts +0 -153
- package/srcV2/helpers/playwrightReportLogger.ts +0 -196
- package/srcV2/helpers/sessionStorage.ts +0 -251
- package/srcV2/helpers/stepDecorator.ts +0 -106
- package/srcV2/locators/index.ts +0 -15
- package/srcV2/locators/locatorQueryBuilder.ts +0 -427
- package/srcV2/locators/locatorRegistrationBuilder.ts +0 -558
- package/srcV2/locators/locatorRegistry.ts +0 -583
- package/srcV2/locators/locatorUpdateBuilder.ts +0 -602
- package/srcV2/locators/reusableLocatorBuilder.ts +0 -200
- package/srcV2/locators/types.ts +0 -256
- package/srcV2/locators/utils.ts +0 -309
- package/srcV2/locators/v1SchemaTranslator.ts +0 -178
- package/srcV2/pageObject.ts +0 -105
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# PlaywrightReportLogger
|
|
2
|
-
|
|
3
|
-
`PlaywrightReportLogger` records log messages during a test and attaches them to Playwright's HTML report. All POMWright fixtures and classes share the same log level and entry list for the duration of a test.
|
|
4
|
-
|
|
5
|
-
## Log levels
|
|
6
|
-
|
|
7
|
-
`debug`, `info`, `warn`, `error`
|
|
8
|
-
|
|
9
|
-
Changing the level affects every child logger because they reference the same state.
|
|
10
|
-
|
|
11
|
-
## Creating and using loggers
|
|
12
|
-
|
|
13
|
-
The `@fixtures/*` test fixtures expose a `log` instance. Child loggers add context to messages without losing shared state:
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { test } from "@fixtures/withoutOptions";
|
|
17
|
-
|
|
18
|
-
test("logging", async ({ log }) => {
|
|
19
|
-
const pageLog = log.getNewChildLogger("LoginPage");
|
|
20
|
-
pageLog.info("filling form");
|
|
21
|
-
});
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Inside a Page Object the constructor typically receives the root logger and creates a child:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
constructor(page: Page, testInfo: TestInfo, pwrl: PlaywrightReportLogger) {
|
|
28
|
-
super(page, testInfo, baseUrl, urlPath, MyPage.name, pwrl);
|
|
29
|
-
// this.log is already a child logger for MyPage
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Attaching to the report
|
|
34
|
-
|
|
35
|
-
At the end of each test the fixture calls `attachLogsToTest(testInfo)`. Entries are sorted by timestamp and attached to the Playwright report with the prefix and log level:
|
|
36
|
-
|
|
37
|
-
```text
|
|
38
|
-
20:49:52 05.05.2023 - INFO : [TestCase -> LoginPage] navigating to /login
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
You can change verbosity during a test:
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
log.setLogLevel("debug");
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
or temporarily:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
const level = log.getCurrentLogLevel();
|
|
51
|
-
log.setLogLevel("error");
|
|
52
|
-
// ...
|
|
53
|
-
log.setLogLevel(level);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The logger is lightweight but powerful enough to trace locator chains or custom helper behaviour while keeping the information in the final HTML report.
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
# Working with Locator Schemas
|
|
2
|
-
|
|
3
|
-
`BasePage` exposes two layers of helpers for working with locator schemas:
|
|
4
|
-
|
|
5
|
-
1. **Wrapper shortcuts** – `getLocator()` and `getNestedLocator()` resolve locators in a single call. They are great when you just need a locator and do not have to tweak the schema.
|
|
6
|
-
2. **`getLocatorSchema()` chains** – return a deep copy of the schemas that make up the requested path so you can update selectors, add filters, or reuse the chain with different parameters.
|
|
7
|
-
|
|
8
|
-
The sections below show how both approaches fit together.
|
|
9
|
-
|
|
10
|
-
## Example set-up
|
|
11
|
-
|
|
12
|
-
The snippets that follow use the simple page object and fixture below.
|
|
13
|
-
|
|
14
|
-
### Create a Page Object Class
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
import { Page, TestInfo } from "@playwright/test";
|
|
18
|
-
import { BasePage, GetByMethod, PlaywrightReportLogger } from "pomwright";
|
|
19
|
-
|
|
20
|
-
type LocatorSchemaPath =
|
|
21
|
-
| "content"
|
|
22
|
-
| "content.heading"
|
|
23
|
-
| "content.region.details"
|
|
24
|
-
| "content.region.details.button.edit";
|
|
25
|
-
|
|
26
|
-
export default class Profile extends BasePage<LocatorSchemaPath> {
|
|
27
|
-
constructor(page: Page, testInfo: TestInfo, pwrl: PlaywrightReportLogger) {
|
|
28
|
-
super(page, testInfo, "https://someDomain.com", "/profile", Profile.name, pwrl);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected initLocatorSchemas() {
|
|
32
|
-
this.locators.addSchema("content", {
|
|
33
|
-
locator: ".main-content",
|
|
34
|
-
locatorMethod: GetByMethod.locator
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
this.locators.addSchema("content.heading", {
|
|
38
|
-
role: "heading",
|
|
39
|
-
roleOptions: {
|
|
40
|
-
name: "Your Profile"
|
|
41
|
-
},
|
|
42
|
-
locatorMethod: GetByMethod.role
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.locators.addSchema("content.region.details", {
|
|
46
|
-
role: "region",
|
|
47
|
-
roleOptions: {
|
|
48
|
-
name: "Profile Details"
|
|
49
|
-
},
|
|
50
|
-
locatorMethod: GetByMethod.role
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
this.locators.addSchema("content.region.details.button.edit", {
|
|
54
|
-
role: "button",
|
|
55
|
-
roleOptions: {
|
|
56
|
-
name: "Edit"
|
|
57
|
-
},
|
|
58
|
-
locatorMethod: GetByMethod.role
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Provide the page object through a fixture
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { test as base } from "pomwright";
|
|
68
|
-
import Profile from "./profile";
|
|
69
|
-
|
|
70
|
-
type Fixtures = {
|
|
71
|
-
profile: Profile;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const test = base.extend<Fixtures>({
|
|
75
|
-
profile: async ({ page, log }, use, testInfo) => {
|
|
76
|
-
const profile = new Profile(page, testInfo, log);
|
|
77
|
-
await use(profile);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Use the fixture in a test
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
import { test } from "./fixtures";
|
|
86
|
-
|
|
87
|
-
test("load profile", async ({ profile }) => {
|
|
88
|
-
await profile.page.goto(profile.fullUrl);
|
|
89
|
-
});
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## BasePage wrapper shortcuts
|
|
93
|
-
|
|
94
|
-
The wrapper methods call `getLocatorSchema(path)` internally and immediately resolve the locator. Use them when the stored schema already matches the element you need.
|
|
95
|
-
|
|
96
|
-
### `getLocator(path)`
|
|
97
|
-
|
|
98
|
-
Returns the locator for the final schema in the chain. This is equivalent to `getLocatorSchema(path).getLocator()`.
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
test("click edit button with a single locator", async ({ profile }) => {
|
|
102
|
-
await profile.page.waitForURL(profile.fullUrl);
|
|
103
|
-
|
|
104
|
-
const editButton = await profile.getLocator("content.region.details.button.edit");
|
|
105
|
-
await editButton.click();
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### `getNestedLocator(path, indices?)`
|
|
110
|
-
|
|
111
|
-
Builds a nested locator by chaining every schema that makes up the path. Optional indices let you pick a specific occurrence of any segment.
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
test("click edit button with a nested locator", async ({ profile }) => {
|
|
115
|
-
await profile.page.waitForURL(profile.fullUrl);
|
|
116
|
-
|
|
117
|
-
const editButton = await profile.getNestedLocator("content.region.details.button.edit");
|
|
118
|
-
await editButton.click();
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
When a path represents repeating elements, provide sub-path keys to select the right instance:
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
test("specify index for nested locators", async ({ profile }) => {
|
|
126
|
-
await profile.page.waitForURL(profile.fullUrl);
|
|
127
|
-
|
|
128
|
-
const editButton = await profile.getNestedLocator(
|
|
129
|
-
"content.region.details.button.edit",
|
|
130
|
-
{
|
|
131
|
-
"content.region.details": 0,
|
|
132
|
-
"content.region.details.button.edit": 1
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
await editButton.click();
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Building chains with `getLocatorSchema()`
|
|
141
|
-
|
|
142
|
-
`getLocatorSchema(path)` returns a deep copy of every schema that makes up the `path` plus chainable helpers for refining the locator. All manipulations happen on the copy, so the original definitions inside the page object stay immutable.
|
|
143
|
-
|
|
144
|
-
```ts
|
|
145
|
-
const chain = profile.getLocatorSchema("content.region.details.button.edit");
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### `update(subPath, partial)`
|
|
149
|
-
|
|
150
|
-
Override one or more properties of any schema in the chain. Calls can be chained and are applied in order. This is how you adapt selectors to dynamic states without mutating the stored definitions.
|
|
151
|
-
|
|
152
|
-
```ts
|
|
153
|
-
const editButton = await profile
|
|
154
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
155
|
-
.update("content.region.details.button.edit", {
|
|
156
|
-
roleOptions: { name: "Edit details" }
|
|
157
|
-
})
|
|
158
|
-
.getNestedLocator();
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
You can also update intermediate segments without touching the rest of the path:
|
|
162
|
-
|
|
163
|
-
```ts
|
|
164
|
-
await profile
|
|
165
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
166
|
-
.update("content.region.details", {
|
|
167
|
-
locator: ".profile-details",
|
|
168
|
-
locatorMethod: GetByMethod.locator
|
|
169
|
-
})
|
|
170
|
-
.getNestedLocator();
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Chain multiple `update` calls when you need to adjust different LocatorSchema in the chain:
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
test("make multiple versions of a locator", async ({ profile }) => {
|
|
177
|
-
await profile.page.waitForURL(profile.fullUrl);
|
|
178
|
-
|
|
179
|
-
const edgeCaseNestedLocator = profile
|
|
180
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
181
|
-
.update("content.region.details", {
|
|
182
|
-
roleOptions: { name: "Payment Info" }
|
|
183
|
-
})
|
|
184
|
-
.update("content.region.details.button.edit", {
|
|
185
|
-
roleOptions: { name: "Update" }
|
|
186
|
-
})
|
|
187
|
-
.getNestedLocator();
|
|
188
|
-
|
|
189
|
-
await edgeCaseNestedLocator.click();
|
|
190
|
-
});
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### `addFilter(subPath, filterOptions)`
|
|
194
|
-
|
|
195
|
-
Adds filters in the same way as Playwright's [`locator.filter()`](https://playwright.dev/docs/api/class-locator#locator-filter). Multiple filters are merged in the order you call them.
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
const resetButton = await profile
|
|
199
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
200
|
-
.addFilter("content.region.details", { hasText: /Profile Details/i })
|
|
201
|
-
// .addFilter(...)
|
|
202
|
-
.getNestedLocator();
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### `getNestedLocator(indices?)`
|
|
206
|
-
|
|
207
|
-
Resolves the full chain to a Playwright locator. Provide optional indices if you need to target a specific occurrence. This method is the same one the wrapper shortcut delegates to, but it keeps any updates or filters you applied earlier in the chain.
|
|
208
|
-
|
|
209
|
-
```ts
|
|
210
|
-
const nestedLocator = await profile
|
|
211
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
212
|
-
//.update(...)
|
|
213
|
-
//.addFilter(...)
|
|
214
|
-
.getNestedLocator({ "content.region": 1 }); // equivalent to .nth(1) (second occurance)
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### `getLocator()`
|
|
218
|
-
|
|
219
|
-
Resolves only the final schema in the chain, i.e. the LocatorSchema which the full LocatorSchemaPath points to. The resulting locator is identical to calling `getNestedLocator()` on a chain that contains a single schema, but it is often more expressive when you only care about the last segment or need to manually chain given some edge case. Same as getNestedLocator, it keeps any updates or filters you applied earlier in the chain.
|
|
220
|
-
|
|
221
|
-
```ts
|
|
222
|
-
const badge = await profile
|
|
223
|
-
.getLocatorSchema("content.region.details.button.edit")
|
|
224
|
-
//.update(...)
|
|
225
|
-
//.addFilter(...)
|
|
226
|
-
.getLocator();
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Reusing a chain
|
|
230
|
-
|
|
231
|
-
Because each call to `getLocatorSchema()` returns a deep copy, you can derive multiple locators without affecting the original definitions.
|
|
232
|
-
|
|
233
|
-
```ts
|
|
234
|
-
const editButtonSchema = profile.getLocatorSchema("content.region.details.button.edit");
|
|
235
|
-
|
|
236
|
-
const editButton = await editButtonSchema.getLocator();
|
|
237
|
-
await editButton.click();
|
|
238
|
-
|
|
239
|
-
editButtonSchema.update("content.region.details.button.edit", {
|
|
240
|
-
roleOptions: { name: "Edit details" }
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
const editButtonUpdated = await editButtonSchema.getNestedLocator();
|
|
244
|
-
await editButtonUpdated.click();
|
|
245
|
-
|
|
246
|
-
// Calling profile.getLocatorSchema("content.region.details.button.edit") again
|
|
247
|
-
// returns a fresh deep copy of the original schema chain.
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
Switching to sub-path keys makes updates easier when `LocatorSchemaPath` strings change, and TypeScript will warn you if you mistype a path. While improving readability.
|