@playwright/test 1.35.0-alpha-may-31-2023 → 1.35.0-alpha-jun-2-2023

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.
@@ -169,7 +169,7 @@ class ExpectMetaInfoProxyHandler {
169
169
  const argsSuffix = computeArgsSuffix(matcherName, args);
170
170
  const defaultTitle = `expect${this._info.isPoll ? '.poll' : ''}${this._info.isSoft ? '.soft' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${argsSuffix}`;
171
171
  const wallTime = Date.now();
172
- const step = testInfo._addStep({
172
+ const step = matcherName !== 'toPass' ? testInfo._addStep({
173
173
  location: stackFrames[0],
174
174
  category: 'expect',
175
175
  title: (0, _util.trimLongString)(customMessage || defaultTitle, 1024),
@@ -177,7 +177,7 @@ class ExpectMetaInfoProxyHandler {
177
177
  expected: args[0]
178
178
  } : undefined,
179
179
  wallTime
180
- });
180
+ }) : undefined;
181
181
  const reportStepError = jestError => {
182
182
  const message = jestError.message;
183
183
  if (customMessage) {
@@ -196,13 +196,13 @@ class ExpectMetaInfoProxyHandler {
196
196
  const serializedError = (0, _util.serializeError)(jestError);
197
197
  // Serialized error has filtered stack trace.
198
198
  jestError.stack = serializedError.stack;
199
- step.complete({
199
+ step === null || step === void 0 ? void 0 : step.complete({
200
200
  error: serializedError
201
201
  });
202
202
  if (this._info.isSoft) testInfo._failWithError(serializedError, false /* isHardError */);else throw jestError;
203
203
  };
204
204
  const finalizer = () => {
205
- step.complete({});
205
+ step === null || step === void 0 ? void 0 : step.complete({});
206
206
  };
207
207
 
208
208
  // Process the async matchers separately to preserve the zones in the stacks.
@@ -335,34 +335,52 @@ async function toBeOK(response) {
335
335
  async function toPass(callback, options = {}) {
336
336
  const testInfo = (0, _globals.currentTestInfo)();
337
337
  const timeout = options.timeout !== undefined ? options.timeout : 0;
338
- const result = await (0, _utils.pollAgainstTimeout)(async () => {
339
- if (testInfo && (0, _globals.currentTestInfo)() !== testInfo) return {
340
- continuePolling: false,
341
- result: undefined
342
- };
343
- try {
344
- await callback();
345
- return {
346
- continuePolling: this.isNot,
338
+ const rawStack = (0, _utils.captureRawStack)();
339
+ const stackFrames = (0, _util.filteredStackTrace)(rawStack);
340
+ const runWithOrWithoutStep = async callback => {
341
+ if (!testInfo) return await callback(undefined);
342
+ return await testInfo._runAsStep({
343
+ title: 'expect.toPass',
344
+ category: 'expect',
345
+ location: stackFrames[0],
346
+ insulateChildErrors: true
347
+ }, callback);
348
+ };
349
+ return await runWithOrWithoutStep(async step => {
350
+ const result = await (0, _utils.pollAgainstTimeout)(async () => {
351
+ if (testInfo && (0, _globals.currentTestInfo)() !== testInfo) return {
352
+ continuePolling: false,
347
353
  result: undefined
348
354
  };
349
- } catch (e) {
355
+ try {
356
+ await callback();
357
+ return {
358
+ continuePolling: this.isNot,
359
+ result: undefined
360
+ };
361
+ } catch (e) {
362
+ return {
363
+ continuePolling: !this.isNot,
364
+ result: e
365
+ };
366
+ }
367
+ }, timeout, options.intervals || [100, 250, 500, 1000]);
368
+ if (result.timedOut) {
369
+ const timeoutMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;
370
+ const message = result.result ? [result.result.message, '', `Call Log:`, `- ${timeoutMessage}`].join('\n') : timeoutMessage;
371
+ step === null || step === void 0 ? void 0 : step.complete({
372
+ error: {
373
+ message
374
+ }
375
+ });
350
376
  return {
351
- continuePolling: !this.isNot,
352
- result: e
377
+ message: () => message,
378
+ pass: this.isNot
353
379
  };
354
380
  }
355
- }, timeout, options.intervals || [100, 250, 500, 1000]);
356
- if (result.timedOut) {
357
- const timeoutMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;
358
- const message = () => result.result ? [result.result.message, '', `Call Log:`, `- ${timeoutMessage}`].join('\n') : timeoutMessage;
359
381
  return {
360
- message,
361
- pass: this.isNot
382
+ pass: !this.isNot,
383
+ message: () => ''
362
384
  };
363
- }
364
- return {
365
- pass: !this.isNot,
366
- message: () => ''
367
- };
385
+ });
368
386
  }
@@ -159,7 +159,9 @@ class UIMode {
159
159
  }
160
160
  _dispatchEvent(message) {
161
161
  // eslint-disable-next-line no-console
162
- this._page.mainFrame().evaluateExpression(dispatchFuncSource, true, message).catch(e => this._originalStderrWrite.call(process.stderr, String(e)));
162
+ this._page.mainFrame().evaluateExpression(dispatchFuncSource, {
163
+ isFunction: true
164
+ }, message).catch(e => this._originalStderrWrite.call(process.stderr, String(e)));
163
165
  }
164
166
  async _listTests() {
165
167
  const listReporter = new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e));
@@ -198,7 +198,7 @@ class TestInfoImpl {
198
198
  } else if (result.error) {
199
199
  // Internal API step reported an error.
200
200
  error = result.error;
201
- } else {
201
+ } else if (!data.insulateChildErrors) {
202
202
  // One of the child steps failed (probably soft expect).
203
203
  // Report this step as failed to make it easier to spot.
204
204
  error = step.steps.map(s => s.error).find(e => !!e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwright/test",
3
- "version": "1.35.0-alpha-may-31-2023",
3
+ "version": "1.35.0-alpha-jun-2-2023",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": "github:Microsoft/playwright",
6
6
  "homepage": "https://playwright.dev",
@@ -41,7 +41,7 @@
41
41
  "license": "Apache-2.0",
42
42
  "dependencies": {
43
43
  "@types/node": "*",
44
- "playwright-core": "1.35.0-alpha-may-31-2023"
44
+ "playwright-core": "1.35.0-alpha-jun-2-2023"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "fsevents": "2.3.2"