pomwright 1.1.1 → 1.3.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 +612 -0
- package/README.md +41 -312
- package/dist/index.d.mts +528 -128
- package/dist/index.d.ts +528 -128
- package/dist/index.js +333 -125
- package/dist/index.mjs +330 -122
- package/docs/BaseApi-explanation.md +63 -0
- package/docs/BasePage-explanation.md +96 -0
- package/docs/LocatorSchema-explanation.md +271 -0
- package/docs/LocatorSchemaPath-explanation.md +165 -0
- package/docs/PlaywrightReportLogger-explanation.md +56 -0
- package/docs/get-locator-methods-explanation.md +266 -0
- package/docs/intro-to-using-pomwright.md +899 -0
- package/docs/sessionStorage-methods-explanation.md +38 -0
- package/docs/tips-folder-structure.md +38 -0
- package/index.ts +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,38 @@
|
|
|
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.
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
```
|
package/index.ts
CHANGED
|
@@ -16,8 +16,8 @@ export { PlaywrightReportLogger };
|
|
|
16
16
|
import { type AriaRoleType, GetByMethod, type LocatorSchema } from "./src/helpers/locatorSchema.interface";
|
|
17
17
|
export { GetByMethod, type LocatorSchema, type AriaRoleType };
|
|
18
18
|
|
|
19
|
-
import { GetLocatorBase } from "./src/helpers/getLocatorBase";
|
|
20
|
-
export { GetLocatorBase };
|
|
19
|
+
import { GetLocatorBase, type LocatorSchemaWithoutPath } from "./src/helpers/getLocatorBase";
|
|
20
|
+
export { GetLocatorBase, type LocatorSchemaWithoutPath };
|
|
21
21
|
|
|
22
22
|
import { BaseApi } from "./src/api/baseApi";
|
|
23
23
|
export { BaseApi };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pomwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "POMWright is a complementary test framework for Playwright written in TypeScript.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"TypeScript"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@biomejs/biome": "^
|
|
42
|
-
"@changesets/changelog-github": "^0.5.
|
|
43
|
-
"@changesets/cli": "^2.
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"tsup": "^8.
|
|
46
|
-
"typescript": "^5.
|
|
47
|
-
"vitest": "^2.
|
|
41
|
+
"@biomejs/biome": "^2.2.4",
|
|
42
|
+
"@changesets/changelog-github": "^0.5.1",
|
|
43
|
+
"@changesets/cli": "^2.29.7",
|
|
44
|
+
"@types/node": "^24.5.2",
|
|
45
|
+
"tsup": "^8.5.0",
|
|
46
|
+
"typescript": "^5.9.2",
|
|
47
|
+
"vitest": "^3.2.4"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@playwright/test": ">=1.41.0 <1.42.0 || >=1.43.0 <2.0.0"
|