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.
Files changed (51) hide show
  1. package/README.md +20 -24
  2. package/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
  3. package/dist/_commonjsHelpers-DwGv2jUC.js +1 -0
  4. package/dist/index.cjs.js +39 -44
  5. package/dist/index.d.ts +433 -7
  6. package/dist/index.es.js +4670 -4917
  7. package/dist/jsx-runtime-CtyxV31n.mjs +276 -0
  8. package/dist/jsx-runtime-DN5DOl8k.js +6 -0
  9. package/dist/mock-sw.js +1 -1
  10. package/dist/runner-ci.cjs.js +1 -1
  11. package/dist/runner-ci.d.ts +28 -12
  12. package/dist/runner-ci.es.js +32 -22
  13. package/dist/runner.cjs.js +1 -1
  14. package/dist/runner.d.ts +55 -41
  15. package/dist/runner.es.js +127 -70
  16. package/dist/ui.cjs.js +1 -0
  17. package/dist/ui.d.ts +10 -0
  18. package/dist/ui.es.js +11 -0
  19. package/dist/vite-plugin.d.ts +21 -1
  20. package/package.json +15 -10
  21. package/dist/asserts/index.d.ts +0 -2
  22. package/dist/commands/mockBridge.d.ts +0 -73
  23. package/dist/commands/url.d.ts +0 -33
  24. package/dist/commands/visit.d.ts +0 -1
  25. package/dist/constants/version.d.ts +0 -1
  26. package/dist/global.d.ts +0 -8
  27. package/dist/initializers/initSidebar.d.ts +0 -22
  28. package/dist/initializers/initTests.d.ts +0 -31
  29. package/dist/plugin/removeMockServiceWorker.d.ts +0 -18
  30. package/dist/proxies/domMessage.d.ts +0 -1
  31. package/dist/proxies/eventsMessage.d.ts +0 -1
  32. package/dist/proxies/screenDom.d.ts +0 -5
  33. package/dist/proxies/userEvent.d.ts +0 -4
  34. package/dist/twd-types.d.ts +0 -106
  35. package/dist/twd.d.ts +0 -178
  36. package/dist/ui/ClosedSidebar.d.ts +0 -6
  37. package/dist/ui/Icons/BaseIcon.d.ts +0 -7
  38. package/dist/ui/Icons/ChevronDown.d.ts +0 -2
  39. package/dist/ui/Icons/ChevronRight.d.ts +0 -2
  40. package/dist/ui/Icons/Loader.d.ts +0 -2
  41. package/dist/ui/Icons/MockRequestIcon.d.ts +0 -2
  42. package/dist/ui/Icons/Play.d.ts +0 -2
  43. package/dist/ui/MockRulesButton.d.ts +0 -1
  44. package/dist/ui/TWDSidebar.d.ts +0 -16
  45. package/dist/ui/TestList.d.ts +0 -17
  46. package/dist/ui/TestListItem.d.ts +0 -39
  47. package/dist/ui/buildTreeFromHandlers.d.ts +0 -14
  48. package/dist/ui/hooks/useLayout.d.ts +0 -6
  49. package/dist/utils/assertionMessage.d.ts +0 -1
  50. package/dist/utils/log.d.ts +0 -1
  51. 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
- // Option 1: Use TWD's native selectors
71
- const title = await twd.get("h1");
72
- title.should("be.visible").should("have.text", "Welcome to TWD");
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 = await twd.get("button");
75
- counterButton.should("be.visible").should("have.text", "Count is 0");
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.el);
79
- counterButton.should("have.text", "Count is 1");
80
-
81
- // Option 2: Use Testing Library queries (semantic, accessible)
82
- // const title = screenDom.getByRole("heading", { name: /welcome to twd/i });
83
- // twd.should(title, "be.visible");
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
- **Native Selectors:**
102
+ **Testing Library Queries (Recommended):**
107
103
  ```ts
108
- const button = await twd.get("button");
109
- button.should("be.visible");
104
+ const button = screenDom.getByRole("button", { name: /submit/i });
105
+ twd.should(button, "be.visible");
110
106
  ```
111
107
 
112
- **Testing Library Queries:**
108
+ **Native Selectors:**
113
109
  ```ts
114
- const button = screenDom.getByRole("button", { name: /submit/i });
115
- twd.should(button, "be.visible");
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/api/react-testing-library)** - Use semantic queries
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,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as g
6
+ };
@@ -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;