twd-js 1.1.2 โ 1.2.1
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/README.md +20 -24
- package/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.js +1 -0
- package/dist/index.cjs.js +39 -44
- package/dist/index.d.ts +433 -7
- package/dist/index.es.js +4670 -4917
- package/dist/jsx-runtime-CtyxV31n.mjs +276 -0
- package/dist/jsx-runtime-DN5DOl8k.js +6 -0
- package/dist/mock-sw.js +1 -1
- package/dist/runner-ci.cjs.js +1 -1
- package/dist/runner-ci.d.ts +28 -12
- package/dist/runner-ci.es.js +32 -22
- package/dist/runner.cjs.js +1 -1
- package/dist/runner.d.ts +55 -41
- package/dist/runner.es.js +127 -70
- package/dist/ui.cjs.js +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.es.js +11 -0
- package/dist/vite-plugin.d.ts +21 -1
- package/package.json +15 -10
- package/dist/asserts/index.d.ts +0 -2
- package/dist/commands/mockBridge.d.ts +0 -73
- package/dist/commands/url.d.ts +0 -33
- package/dist/commands/visit.d.ts +0 -1
- package/dist/constants/version.d.ts +0 -1
- package/dist/global.d.ts +0 -8
- package/dist/initializers/initSidebar.d.ts +0 -22
- package/dist/initializers/initTests.d.ts +0 -31
- package/dist/plugin/removeMockServiceWorker.d.ts +0 -18
- package/dist/proxies/domMessage.d.ts +0 -1
- package/dist/proxies/eventsMessage.d.ts +0 -1
- package/dist/proxies/screenDom.d.ts +0 -5
- package/dist/proxies/userEvent.d.ts +0 -4
- package/dist/twd-types.d.ts +0 -106
- package/dist/twd.d.ts +0 -178
- package/dist/ui/ClosedSidebar.d.ts +0 -6
- package/dist/ui/Icons/BaseIcon.d.ts +0 -7
- package/dist/ui/Icons/ChevronDown.d.ts +0 -2
- package/dist/ui/Icons/ChevronRight.d.ts +0 -2
- package/dist/ui/Icons/Loader.d.ts +0 -2
- package/dist/ui/Icons/MockRequestIcon.d.ts +0 -2
- package/dist/ui/Icons/Play.d.ts +0 -2
- package/dist/ui/MockRulesButton.d.ts +0 -1
- package/dist/ui/TWDSidebar.d.ts +0 -16
- package/dist/ui/TestList.d.ts +0 -17
- package/dist/ui/TestListItem.d.ts +0 -39
- package/dist/ui/buildTreeFromHandlers.d.ts +0 -14
- package/dist/ui/hooks/useLayout.d.ts +0 -6
- package/dist/utils/assertionMessage.d.ts +0 -1
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/wait.d.ts +0 -3
package/README.md
CHANGED
|
@@ -67,26 +67,22 @@ describe("Hello World Page", () => {
|
|
|
67
67
|
it("should display the welcome title and counter button", async () => {
|
|
68
68
|
await twd.visit("/");
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
const title =
|
|
72
|
-
|
|
70
|
+
// Use Testing Library queries (Recommended - semantic & accessible)
|
|
71
|
+
const title = screenDom.getByRole("heading", { name: /welcome to twd/i });
|
|
72
|
+
twd.should(title, "be.visible");
|
|
73
|
+
twd.should(title, "have.text", "Welcome to TWD");
|
|
73
74
|
|
|
74
|
-
const counterButton =
|
|
75
|
-
|
|
75
|
+
const counterButton = screenDom.getByRole("button", { name: /count is/i });
|
|
76
|
+
twd.should(counterButton, "be.visible");
|
|
77
|
+
twd.should(counterButton, "have.text", "Count is 0");
|
|
76
78
|
|
|
77
79
|
const user = userEvent.setup();
|
|
78
|
-
await user.click(counterButton
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
// const title =
|
|
83
|
-
//
|
|
84
|
-
// twd.should(title, "have.text", "Welcome to TWD");
|
|
85
|
-
//
|
|
86
|
-
// const counterButton = screenDom.getByRole("button", { name: /count is/i });
|
|
87
|
-
// twd.should(counterButton, "be.visible");
|
|
88
|
-
// await user.click(counterButton);
|
|
89
|
-
// twd.should(counterButton, "have.text", "Count is 1");
|
|
80
|
+
await user.click(counterButton);
|
|
81
|
+
twd.should(counterButton, "have.text", "Count is 1");
|
|
82
|
+
|
|
83
|
+
// Alternative: Use TWD's native selectors for direct element access
|
|
84
|
+
// const title = await twd.get("h1");
|
|
85
|
+
// title.should("be.visible").should("have.text", "Welcome to TWD");
|
|
90
86
|
});
|
|
91
87
|
});
|
|
92
88
|
```
|
|
@@ -103,16 +99,16 @@ describe("Hello World Page", () => {
|
|
|
103
99
|
|
|
104
100
|
TWD supports two approaches:
|
|
105
101
|
|
|
106
|
-
**
|
|
102
|
+
**Testing Library Queries (Recommended):**
|
|
107
103
|
```ts
|
|
108
|
-
const button =
|
|
109
|
-
|
|
104
|
+
const button = screenDom.getByRole("button", { name: /submit/i });
|
|
105
|
+
twd.should(button, "be.visible");
|
|
110
106
|
```
|
|
111
107
|
|
|
112
|
-
**
|
|
108
|
+
**Native Selectors:**
|
|
113
109
|
```ts
|
|
114
|
-
const button =
|
|
115
|
-
|
|
110
|
+
const button = await twd.get("button");
|
|
111
|
+
button.should("be.visible");
|
|
116
112
|
```
|
|
117
113
|
|
|
118
114
|
### User Interactions
|
|
@@ -141,7 +137,7 @@ const rule = await twd.waitForRequest("getUser");
|
|
|
141
137
|
- ๐ฏ **[Writing Tests](https://brikev.github.io/twd/writing-tests)** - Learn how to write effective tests
|
|
142
138
|
- ๐ฅ **[API Mocking](https://brikev.github.io/twd/api-mocking)** - Mock API requests in your tests
|
|
143
139
|
- ๐ **[API Reference](https://brikev.github.io/twd/api/)** - Complete API documentation
|
|
144
|
-
- ๐งช **[Testing Library Support](https://brikev.github.io/twd/
|
|
140
|
+
- ๐งช **[Testing Library Support](https://brikev.github.io/twd/react-testing-library)** - Use semantic queries
|
|
145
141
|
|
|
146
142
|
## Examples
|
|
147
143
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}exports.getDefaultExportFromCjs=e;
|