|
f7eb47b…
|
lmata
|
1 |
"use strict"; |
|
f7eb47b…
|
lmata
|
2 |
var __defProp = Object.defineProperty; |
|
f7eb47b…
|
lmata
|
3 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
|
f7eb47b…
|
lmata
|
4 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
|
f7eb47b…
|
lmata
|
5 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
|
f7eb47b…
|
lmata
|
6 |
var __export = (target, all) => { |
|
f7eb47b…
|
lmata
|
7 |
for (var name in all) |
|
f7eb47b…
|
lmata
|
8 |
__defProp(target, name, { get: all[name], enumerable: true }); |
|
f7eb47b…
|
lmata
|
9 |
}; |
|
f7eb47b…
|
lmata
|
10 |
var __copyProps = (to, from, except, desc) => { |
|
f7eb47b…
|
lmata
|
11 |
if (from && typeof from === "object" || typeof from === "function") { |
|
f7eb47b…
|
lmata
|
12 |
for (let key of __getOwnPropNames(from)) |
|
f7eb47b…
|
lmata
|
13 |
if (!__hasOwnProp.call(to, key) && key !== except) |
|
f7eb47b…
|
lmata
|
14 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
|
f7eb47b…
|
lmata
|
15 |
} |
|
f7eb47b…
|
lmata
|
16 |
return to; |
|
f7eb47b…
|
lmata
|
17 |
}; |
|
f7eb47b…
|
lmata
|
18 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
|
f7eb47b…
|
lmata
|
19 |
var toBeTruthy_exports = {}; |
|
f7eb47b…
|
lmata
|
20 |
__export(toBeTruthy_exports, { |
|
f7eb47b…
|
lmata
|
21 |
toBeTruthy: () => toBeTruthy |
|
f7eb47b…
|
lmata
|
22 |
}); |
|
f7eb47b…
|
lmata
|
23 |
module.exports = __toCommonJS(toBeTruthy_exports); |
|
f7eb47b…
|
lmata
|
24 |
var import_utils = require("playwright-core/lib/utils"); |
|
f7eb47b…
|
lmata
|
25 |
var import_util = require("../util"); |
|
f7eb47b…
|
lmata
|
26 |
async function toBeTruthy(matcherName, locator, receiverType, expected, arg, query, options = {}) { |
|
f7eb47b…
|
lmata
|
27 |
(0, import_util.expectTypes)(locator, [receiverType], matcherName); |
|
f7eb47b…
|
lmata
|
28 |
const timeout = options.timeout ?? this.timeout; |
|
f7eb47b…
|
lmata
|
29 |
const { matches: pass, log, timedOut, received, errorMessage } = await query(!!this.isNot, timeout); |
|
f7eb47b…
|
lmata
|
30 |
if (pass === !this.isNot) { |
|
f7eb47b…
|
lmata
|
31 |
return { |
|
f7eb47b…
|
lmata
|
32 |
name: matcherName, |
|
f7eb47b…
|
lmata
|
33 |
message: () => "", |
|
f7eb47b…
|
lmata
|
34 |
pass, |
|
f7eb47b…
|
lmata
|
35 |
expected |
|
f7eb47b…
|
lmata
|
36 |
}; |
|
f7eb47b…
|
lmata
|
37 |
} |
|
f7eb47b…
|
lmata
|
38 |
let printedReceived; |
|
f7eb47b…
|
lmata
|
39 |
let printedExpected; |
|
f7eb47b…
|
lmata
|
40 |
if (pass) { |
|
f7eb47b…
|
lmata
|
41 |
printedExpected = `Expected: not ${expected}`; |
|
f7eb47b…
|
lmata
|
42 |
printedReceived = errorMessage ? "" : `Received: ${expected}`; |
|
f7eb47b…
|
lmata
|
43 |
} else { |
|
f7eb47b…
|
lmata
|
44 |
printedExpected = `Expected: ${expected}`; |
|
f7eb47b…
|
lmata
|
45 |
printedReceived = errorMessage ? "" : `Received: ${received}`; |
|
f7eb47b…
|
lmata
|
46 |
} |
|
f7eb47b…
|
lmata
|
47 |
const message = () => { |
|
f7eb47b…
|
lmata
|
48 |
return (0, import_utils.formatMatcherMessage)(this.utils, { |
|
f7eb47b…
|
lmata
|
49 |
isNot: this.isNot, |
|
f7eb47b…
|
lmata
|
50 |
promise: this.promise, |
|
f7eb47b…
|
lmata
|
51 |
matcherName, |
|
f7eb47b…
|
lmata
|
52 |
expectation: arg, |
|
f7eb47b…
|
lmata
|
53 |
locator: locator.toString(), |
|
f7eb47b…
|
lmata
|
54 |
timeout, |
|
f7eb47b…
|
lmata
|
55 |
timedOut, |
|
f7eb47b…
|
lmata
|
56 |
printedExpected, |
|
f7eb47b…
|
lmata
|
57 |
printedReceived, |
|
f7eb47b…
|
lmata
|
58 |
errorMessage, |
|
f7eb47b…
|
lmata
|
59 |
log |
|
f7eb47b…
|
lmata
|
60 |
}); |
|
f7eb47b…
|
lmata
|
61 |
}; |
|
f7eb47b…
|
lmata
|
62 |
return { |
|
f7eb47b…
|
lmata
|
63 |
message, |
|
f7eb47b…
|
lmata
|
64 |
pass, |
|
f7eb47b…
|
lmata
|
65 |
actual: received, |
|
f7eb47b…
|
lmata
|
66 |
name: matcherName, |
|
f7eb47b…
|
lmata
|
67 |
expected, |
|
f7eb47b…
|
lmata
|
68 |
log, |
|
f7eb47b…
|
lmata
|
69 |
timeout: timedOut ? timeout : void 0 |
|
f7eb47b…
|
lmata
|
70 |
}; |
|
f7eb47b…
|
lmata
|
71 |
} |
|
f7eb47b…
|
lmata
|
72 |
// Annotate the CommonJS export names for ESM import in node: |
|
f7eb47b…
|
lmata
|
73 |
0 && (module.exports = { |
|
f7eb47b…
|
lmata
|
74 |
toBeTruthy |
|
f7eb47b…
|
lmata
|
75 |
}); |