@cronn/playwright-utils 0.4.0 → 0.5.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/dist/index.d.mts +15 -0
- package/dist/index.mjs +17 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -112,6 +112,21 @@ declare class ConsoleCaptor {
|
|
|
112
112
|
* The already captured {@link messages} are kept.
|
|
113
113
|
*/
|
|
114
114
|
stopCapture(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Remove all captured {@link messages}.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* captor.startCapture();
|
|
121
|
+
*
|
|
122
|
+
* await page.goto("/users");
|
|
123
|
+
* captor.clearMessages();
|
|
124
|
+
*
|
|
125
|
+
* await page.getByRole("button", { name: "Only enabled" }).click();
|
|
126
|
+
* expect(captor.messages).toHaveLength(1);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
clearMessages(): void;
|
|
115
130
|
/**
|
|
116
131
|
* Collect the console messages reported while the callback runs.
|
|
117
132
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -148,6 +148,23 @@ var ConsoleCaptor = class {
|
|
|
148
148
|
this.page.off("console", this.consoleListener);
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
+
* Remove all captured {@link messages}.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* captor.startCapture();
|
|
156
|
+
*
|
|
157
|
+
* await page.goto("/users");
|
|
158
|
+
* captor.clearMessages();
|
|
159
|
+
*
|
|
160
|
+
* await page.getByRole("button", { name: "Only enabled" }).click();
|
|
161
|
+
* expect(captor.messages).toHaveLength(1);
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
clearMessages() {
|
|
165
|
+
this.messages.length = 0;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
151
168
|
* Collect the console messages reported while the callback runs.
|
|
152
169
|
*
|
|
153
170
|
* The capturing is stopped once the action has finished, even if it throws.
|