Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
29
node_modules/playwright/lib/matchers/expect.js
generated
vendored
Executable file → Normal file
29
node_modules/playwright/lib/matchers/expect.js
generated
vendored
Executable file → Normal file
@@ -225,16 +225,15 @@ class ExpectMetaInfoProxyHandler {
|
||||
const title = customMessage || `Expect ${(0, import_utils.escapeWithQuotes)(defaultTitle, '"')}`;
|
||||
const apiName = `expect${this._info.poll ? ".poll " : ""}${this._info.isSoft ? ".soft " : ""}${this._info.isNot ? ".not" : ""}.${matcherName}${argsSuffix}`;
|
||||
const stackFrames = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());
|
||||
const category = matcherName === "toPass" || this._info.poll ? "test.step" : "expect";
|
||||
const stepInfo = {
|
||||
category,
|
||||
category: "expect",
|
||||
apiName,
|
||||
title,
|
||||
params: args[0] ? { expected: args[0] } : void 0,
|
||||
infectParentStepsWithError: this._info.isSoft
|
||||
};
|
||||
const step = testInfo._addStep(stepInfo);
|
||||
const reportStepError = (isAsync, e) => {
|
||||
const reportStepError = (e) => {
|
||||
const jestError = (0, import_matcherHint.isJestError)(e) ? e : null;
|
||||
const expectError = jestError ? new import_matcherHint.ExpectError(jestError, customMessage, stackFrames) : void 0;
|
||||
if (jestError?.matcherResult.suggestedRebaseline) {
|
||||
@@ -243,22 +242,10 @@ class ExpectMetaInfoProxyHandler {
|
||||
}
|
||||
const error = expectError ?? e;
|
||||
step.complete({ error });
|
||||
if (!isAsync || !expectError) {
|
||||
if (this._info.isSoft)
|
||||
testInfo._failWithError(error);
|
||||
else
|
||||
throw error;
|
||||
return;
|
||||
}
|
||||
return (async () => {
|
||||
const recoveryResult = await step.recoverFromStepError(expectError);
|
||||
if (recoveryResult.status === "recovered")
|
||||
return recoveryResult.value;
|
||||
if (this._info.isSoft)
|
||||
testInfo._failWithError(expectError);
|
||||
else
|
||||
throw expectError;
|
||||
})();
|
||||
if (this._info.isSoft)
|
||||
testInfo._failWithError(error);
|
||||
else
|
||||
throw error;
|
||||
};
|
||||
const finalizer = () => {
|
||||
step.complete({});
|
||||
@@ -268,11 +255,11 @@ class ExpectMetaInfoProxyHandler {
|
||||
const callback = () => matcher.call(target, ...args);
|
||||
const result = (0, import_utils.currentZone)().with("stepZone", step).run(callback);
|
||||
if (result instanceof Promise)
|
||||
return result.then(finalizer).catch(reportStepError.bind(null, true));
|
||||
return result.then(finalizer).catch(reportStepError);
|
||||
finalizer();
|
||||
return result;
|
||||
} catch (e) {
|
||||
void reportStepError(false, e);
|
||||
void reportStepError(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
60
node_modules/playwright/lib/matchers/matcherHint.js
generated
vendored
Executable file → Normal file
60
node_modules/playwright/lib/matchers/matcherHint.js
generated
vendored
Executable file → Normal file
@@ -19,26 +19,42 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
||||
var matcherHint_exports = {};
|
||||
__export(matcherHint_exports, {
|
||||
ExpectError: () => ExpectError,
|
||||
isJestError: () => isJestError,
|
||||
kNoElementsFoundError: () => kNoElementsFoundError,
|
||||
matcherHint: () => matcherHint
|
||||
callLogText: () => callLogText,
|
||||
formatMatcherMessage: () => formatMatcherMessage,
|
||||
isJestError: () => isJestError
|
||||
});
|
||||
module.exports = __toCommonJS(matcherHint_exports);
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
const kNoElementsFoundError = "<element(s) not found>";
|
||||
function matcherHint(state, locator, matcherName, expression, actual, matcherOptions, timeout, expectedReceivedString, preventExtraStatIndent = false) {
|
||||
let header = state.utils.matcherHint(matcherName, expression, actual, matcherOptions).replace(/ \/\/ deep equality/, "") + " failed\n\n";
|
||||
const extraSpace = preventExtraStatIndent ? "" : " ";
|
||||
if (locator)
|
||||
header += `Locator: ${extraSpace}${String(locator)}
|
||||
var import_expectBundle = require("../common/expectBundle");
|
||||
function formatMatcherMessage(state, details) {
|
||||
const receiver = details.receiver ?? (details.locator ? "locator" : "page");
|
||||
let message = (0, import_expectBundle.DIM_COLOR)("expect(") + (0, import_expectBundle.RECEIVED_COLOR)(receiver) + (0, import_expectBundle.DIM_COLOR)(")" + (state.promise ? "." + state.promise : "") + (state.isNot ? ".not" : "") + ".") + details.matcherName + (0, import_expectBundle.DIM_COLOR)("(") + (0, import_expectBundle.EXPECTED_COLOR)(details.expectation) + (0, import_expectBundle.DIM_COLOR)(")") + " failed\n\n";
|
||||
const diffLines = details.printedDiff?.split("\n");
|
||||
if (diffLines?.length === 2) {
|
||||
details.printedExpected = diffLines[0];
|
||||
details.printedReceived = diffLines[1];
|
||||
details.printedDiff = void 0;
|
||||
}
|
||||
const align = !details.errorMessage && details.printedExpected?.startsWith("Expected:") && (!details.printedReceived || details.printedReceived.startsWith("Received:"));
|
||||
if (details.locator)
|
||||
message += `Locator: ${align ? " " : ""}${String(details.locator)}
|
||||
`;
|
||||
if (expectedReceivedString)
|
||||
header += `${expectedReceivedString}
|
||||
if (details.printedExpected)
|
||||
message += details.printedExpected + "\n";
|
||||
if (details.printedReceived)
|
||||
message += details.printedReceived + "\n";
|
||||
if (details.timedOut && details.timeout)
|
||||
message += `Timeout: ${align ? " " : ""}${details.timeout}ms
|
||||
`;
|
||||
if (timeout)
|
||||
header += `Timeout: ${extraSpace}${timeout}ms
|
||||
`;
|
||||
return header;
|
||||
if (details.printedDiff)
|
||||
message += details.printedDiff + "\n";
|
||||
if (details.errorMessage) {
|
||||
message += details.errorMessage;
|
||||
if (!details.errorMessage.endsWith("\n"))
|
||||
message += "\n";
|
||||
}
|
||||
message += callLogText(details.log);
|
||||
return message;
|
||||
}
|
||||
class ExpectError extends Error {
|
||||
constructor(jestError, customMessage, stackFrames) {
|
||||
@@ -54,10 +70,18 @@ class ExpectError extends Error {
|
||||
function isJestError(e) {
|
||||
return e instanceof Error && "matcherResult" in e;
|
||||
}
|
||||
const callLogText = (log) => {
|
||||
if (!log || !log.some((l) => !!l))
|
||||
return "";
|
||||
return `
|
||||
Call log:
|
||||
${(0, import_expectBundle.DIM_COLOR)(log.join("\n"))}
|
||||
`;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ExpectError,
|
||||
isJestError,
|
||||
kNoElementsFoundError,
|
||||
matcherHint
|
||||
callLogText,
|
||||
formatMatcherMessage,
|
||||
isJestError
|
||||
});
|
||||
|
||||
18
node_modules/playwright/lib/matchers/matchers.js
generated
vendored
Executable file → Normal file
18
node_modules/playwright/lib/matchers/matchers.js
generated
vendored
Executable file → Normal file
@@ -59,6 +59,7 @@ var import_toMatchText = require("./toMatchText");
|
||||
var import_config = require("../common/config");
|
||||
var import_globals = require("../common/globals");
|
||||
var import_testInfo = require("../worker/testInfo");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
function toBeAttached(locator, options) {
|
||||
const attached = !options || options.attached === void 0 || options.attached;
|
||||
const expected = attached ? "attached" : "detached";
|
||||
@@ -146,7 +147,7 @@ function toContainText(locator, expected, options = {}) {
|
||||
return import_toMatchText.toMatchText.call(this, "toContainText", locator, "Locator", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
|
||||
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout });
|
||||
}, expected, options);
|
||||
}, expected, { ...options, matchSubstring: true });
|
||||
}
|
||||
}
|
||||
function toHaveAccessibleDescription(locator, expected, options) {
|
||||
@@ -189,7 +190,7 @@ function toHaveClass(locator, expected, options) {
|
||||
return import_toEqual.toEqual.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
|
||||
return await locator._expect("to.have.class.array", { expectedText, isNot, timeout });
|
||||
}, expected, options, true);
|
||||
}, expected, options);
|
||||
} else {
|
||||
return import_toMatchText.toMatchText.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
|
||||
@@ -204,7 +205,7 @@ function toContainClass(locator, expected, options) {
|
||||
return import_toEqual.toEqual.call(this, "toContainClass", locator, "Locator", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
|
||||
return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout });
|
||||
}, expected, options, true);
|
||||
}, expected, options);
|
||||
} else {
|
||||
if ((0, import_utils.isRegExp)(expected))
|
||||
throw new Error(`"expected" argument in toContainClass cannot be a RegExp value`);
|
||||
@@ -273,7 +274,7 @@ function toHaveTitle(page, expected, options = {}) {
|
||||
return import_toMatchText.toMatchText.call(this, "toHaveTitle", page, "Page", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { normalizeWhiteSpace: true });
|
||||
return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout });
|
||||
}, expected, { receiverLabel: "page", ...options });
|
||||
}, expected, options);
|
||||
}
|
||||
function toHaveURL(page, expected, options) {
|
||||
if (typeof expected === "function")
|
||||
@@ -283,7 +284,7 @@ function toHaveURL(page, expected, options) {
|
||||
return import_toMatchText.toMatchText.call(this, "toHaveURL", page, "Page", async (isNot, timeout) => {
|
||||
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase });
|
||||
return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout });
|
||||
}, expected, { receiverLabel: "page", ...options });
|
||||
}, expected, options);
|
||||
}
|
||||
async function toBeOK(response) {
|
||||
const matcherName = "toBeOK";
|
||||
@@ -294,7 +295,12 @@ async function toBeOK(response) {
|
||||
response._fetchLog(),
|
||||
isTextEncoding ? response.text() : null
|
||||
]) : [];
|
||||
const message = () => this.utils.matcherHint(matcherName, void 0, "", { isNot: this.isNot }) + (0, import_util.callLogText)(log) + (text === null ? "" : `
|
||||
const message = () => (0, import_matcherHint.formatMatcherMessage)(this, {
|
||||
matcherName,
|
||||
receiver: "response",
|
||||
expectation: "",
|
||||
log
|
||||
}) + (text === null ? "" : `
|
||||
Response text:
|
||||
${import_utils2.colors.dim(text?.substring(0, 1e3) || "")}`);
|
||||
const pass = response.ok();
|
||||
|
||||
30
node_modules/playwright/lib/matchers/toBeTruthy.js
generated
vendored
Executable file → Normal file
30
node_modules/playwright/lib/matchers/toBeTruthy.js
generated
vendored
Executable file → Normal file
@@ -23,14 +23,10 @@ __export(toBeTruthy_exports, {
|
||||
module.exports = __toCommonJS(toBeTruthy_exports);
|
||||
var import_util = require("../util");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
async function toBeTruthy(matcherName, receiver, receiverType, expected, arg, query, options = {}) {
|
||||
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
|
||||
const matcherOptions = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
async function toBeTruthy(matcherName, locator, receiverType, expected, arg, query, options = {}) {
|
||||
(0, import_util.expectTypes)(locator, [receiverType], matcherName);
|
||||
const timeout = options.timeout ?? this.timeout;
|
||||
const { matches: pass, log, timedOut, received } = await query(!!this.isNot, timeout);
|
||||
const { matches: pass, log, timedOut, received, errorMessage } = await query(!!this.isNot, timeout);
|
||||
if (pass === !this.isNot) {
|
||||
return {
|
||||
name: matcherName,
|
||||
@@ -39,21 +35,27 @@ async function toBeTruthy(matcherName, receiver, receiverType, expected, arg, qu
|
||||
expected
|
||||
};
|
||||
}
|
||||
const notFound = received === import_matcherHint.kNoElementsFoundError ? received : void 0;
|
||||
let printedReceived;
|
||||
let printedExpected;
|
||||
if (pass) {
|
||||
printedExpected = `Expected: not ${expected}`;
|
||||
printedReceived = `Received: ${notFound ? import_matcherHint.kNoElementsFoundError : expected}`;
|
||||
printedReceived = errorMessage ? "" : `Received: ${expected}`;
|
||||
} else {
|
||||
printedExpected = `Expected: ${expected}`;
|
||||
printedReceived = `Received: ${notFound ? import_matcherHint.kNoElementsFoundError : received}`;
|
||||
printedReceived = errorMessage ? "" : `Received: ${received}`;
|
||||
}
|
||||
const message = () => {
|
||||
const header = (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", arg, matcherOptions, timedOut ? timeout : void 0, `${printedExpected}
|
||||
${printedReceived}`);
|
||||
const logText = (0, import_util.callLogText)(log);
|
||||
return `${header}${logText}`;
|
||||
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
||||
matcherName,
|
||||
expectation: arg,
|
||||
locator,
|
||||
timeout,
|
||||
timedOut,
|
||||
printedExpected,
|
||||
printedReceived,
|
||||
errorMessage,
|
||||
log
|
||||
});
|
||||
};
|
||||
return {
|
||||
message,
|
||||
|
||||
31
node_modules/playwright/lib/matchers/toEqual.js
generated
vendored
Executable file → Normal file
31
node_modules/playwright/lib/matchers/toEqual.js
generated
vendored
Executable file → Normal file
@@ -26,15 +26,10 @@ var import_util = require("../util");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
const EXPECTED_LABEL = "Expected";
|
||||
const RECEIVED_LABEL = "Received";
|
||||
async function toEqual(matcherName, receiver, receiverType, query, expected, options = {}, messagePreventExtraStatIndent) {
|
||||
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
|
||||
const matcherOptions = {
|
||||
comment: options.contains ? "" : "deep equality",
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
async function toEqual(matcherName, locator, receiverType, query, expected, options = {}) {
|
||||
(0, import_util.expectTypes)(locator, [receiverType], matcherName);
|
||||
const timeout = options.timeout ?? this.timeout;
|
||||
const { matches: pass, received, log, timedOut } = await query(!!this.isNot, timeout);
|
||||
const { matches: pass, received, log, timedOut, errorMessage } = await query(!!this.isNot, timeout);
|
||||
if (pass === !this.isNot) {
|
||||
return {
|
||||
name: matcherName,
|
||||
@@ -48,7 +43,9 @@ async function toEqual(matcherName, receiver, receiverType, query, expected, opt
|
||||
let printedDiff;
|
||||
if (pass) {
|
||||
printedExpected = `Expected: not ${this.utils.printExpected(expected)}`;
|
||||
printedReceived = `Received: ${this.utils.printReceived(received)}`;
|
||||
printedReceived = errorMessage ? "" : `Received: ${this.utils.printReceived(received)}`;
|
||||
} else if (errorMessage) {
|
||||
printedExpected = `Expected: ${this.utils.printExpected(expected)}`;
|
||||
} else if (Array.isArray(expected) && Array.isArray(received)) {
|
||||
const normalizedExpected = expected.map((exp, index) => {
|
||||
const rec = received[index];
|
||||
@@ -73,10 +70,18 @@ async function toEqual(matcherName, receiver, receiverType, query, expected, opt
|
||||
);
|
||||
}
|
||||
const message = () => {
|
||||
const details = printedDiff || `${printedExpected}
|
||||
${printedReceived}`;
|
||||
const header = (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", void 0, matcherOptions, timedOut ? timeout : void 0, details, messagePreventExtraStatIndent);
|
||||
return `${header}${(0, import_util.callLogText)(log)}`;
|
||||
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
||||
matcherName,
|
||||
expectation: "expected",
|
||||
locator,
|
||||
timeout,
|
||||
timedOut,
|
||||
printedExpected,
|
||||
printedReceived,
|
||||
printedDiff,
|
||||
errorMessage,
|
||||
log
|
||||
});
|
||||
};
|
||||
return {
|
||||
actual: received,
|
||||
|
||||
39
node_modules/playwright/lib/matchers/toHaveURL.js
generated
vendored
Executable file → Normal file
39
node_modules/playwright/lib/matchers/toHaveURL.js
generated
vendored
Executable file → Normal file
@@ -22,27 +22,11 @@ __export(toHaveURL_exports, {
|
||||
});
|
||||
module.exports = __toCommonJS(toHaveURL_exports);
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_utils2 = require("playwright-core/lib/utils");
|
||||
var import_expect = require("./expect");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
var import_expectBundle = require("../common/expectBundle");
|
||||
async function toHaveURLWithPredicate(page, expected, options) {
|
||||
const matcherName = "toHaveURL";
|
||||
const expression = "page";
|
||||
const matcherOptions = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
if (typeof expected !== "function") {
|
||||
throw new Error(
|
||||
[
|
||||
// Always display `expected` in expectation place
|
||||
(0, import_matcherHint.matcherHint)(this, void 0, matcherName, expression, void 0, matcherOptions, void 0, void 0, true),
|
||||
`${import_utils2.colors.bold("Matcher error")}: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string, regular expression, or predicate`,
|
||||
this.utils.printWithType("Expected", expected, this.utils.printExpected)
|
||||
].join("\n\n")
|
||||
);
|
||||
}
|
||||
const timeout = options?.timeout ?? this.timeout;
|
||||
const baseURL = page.context()._options.baseURL;
|
||||
let conditionSucceeded = false;
|
||||
@@ -74,7 +58,6 @@ async function toHaveURLWithPredicate(page, expected, options) {
|
||||
message: () => toHaveURLMessage(
|
||||
this,
|
||||
matcherName,
|
||||
expression,
|
||||
expected,
|
||||
lastCheckedURLString,
|
||||
this.isNot,
|
||||
@@ -85,19 +68,14 @@ async function toHaveURLWithPredicate(page, expected, options) {
|
||||
timeout
|
||||
};
|
||||
}
|
||||
function toHaveURLMessage(state, matcherName, expression, expected, received, pass, didTimeout, timeout) {
|
||||
const matcherOptions = {
|
||||
isNot: state.isNot,
|
||||
promise: state.promise
|
||||
};
|
||||
function toHaveURLMessage(state, matcherName, expected, received, pass, timedOut, timeout) {
|
||||
const receivedString = received || "";
|
||||
const messagePrefix = (0, import_matcherHint.matcherHint)(state, void 0, matcherName, expression, void 0, matcherOptions, didTimeout ? timeout : void 0, void 0, true);
|
||||
let printedReceived;
|
||||
let printedExpected;
|
||||
let printedDiff;
|
||||
if (typeof expected === "function") {
|
||||
printedExpected = `Expected predicate to ${!state.isNot ? "succeed" : "fail"}`;
|
||||
printedReceived = `Received string: ${(0, import_expectBundle.printReceived)(receivedString)}`;
|
||||
printedExpected = `Expected: predicate to ${!state.isNot ? "succeed" : "fail"}`;
|
||||
printedReceived = `Received: ${(0, import_expectBundle.printReceived)(receivedString)}`;
|
||||
} else {
|
||||
if (pass) {
|
||||
printedExpected = `Expected pattern: not ${state.utils.printExpected(expected)}`;
|
||||
@@ -108,8 +86,15 @@ function toHaveURLMessage(state, matcherName, expression, expected, received, pa
|
||||
printedDiff = state.utils.printDiffOrStringify(expected, receivedString, labelExpected, "Received string", false);
|
||||
}
|
||||
}
|
||||
const resultDetails = printedDiff ? printedDiff : printedExpected + "\n" + printedReceived;
|
||||
return messagePrefix + resultDetails;
|
||||
return (0, import_matcherHint.formatMatcherMessage)(state, {
|
||||
matcherName,
|
||||
expectation: "expected",
|
||||
timeout,
|
||||
timedOut,
|
||||
printedExpected,
|
||||
printedReceived,
|
||||
printedDiff
|
||||
});
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
|
||||
56
node_modules/playwright/lib/matchers/toMatchAriaSnapshot.js
generated
vendored
Executable file → Normal file
56
node_modules/playwright/lib/matchers/toMatchAriaSnapshot.js
generated
vendored
Executable file → Normal file
@@ -35,11 +35,10 @@ var import_fs = __toESM(require("fs"));
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
var import_expectBundle = require("../common/expectBundle");
|
||||
var import_util = require("../util");
|
||||
var import_expect = require("./expect");
|
||||
var import_globals = require("../common/globals");
|
||||
async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
|
||||
async function toMatchAriaSnapshot(locator, expectedParam, options = {}) {
|
||||
const matcherName = "toMatchAriaSnapshot";
|
||||
const testInfo = (0, import_globals.currentTestInfo)();
|
||||
if (!testInfo)
|
||||
@@ -47,10 +46,6 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
|
||||
if (testInfo._projectInternal.ignoreSnapshots)
|
||||
return { pass: !this.isNot, message: () => "", name: "toMatchAriaSnapshot", expected: "" };
|
||||
const updateSnapshots = testInfo.config.updateSnapshots;
|
||||
const matcherOptions = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
let expected;
|
||||
let timeout;
|
||||
let expectedPath;
|
||||
@@ -75,35 +70,36 @@ async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
|
||||
}
|
||||
}
|
||||
expected = unshift(expected);
|
||||
const { matches: pass, received, log, timedOut } = await receiver._expect("to.match.aria", { expectedValue: expected, isNot: this.isNot, timeout });
|
||||
const { matches: pass, received, log, timedOut, errorMessage } = await locator._expect("to.match.aria", { expectedValue: expected, isNot: this.isNot, timeout });
|
||||
const typedReceived = received;
|
||||
const matcherHintWithExpect = (expectedReceivedString) => {
|
||||
return (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", void 0, matcherOptions, timedOut ? timeout : void 0, expectedReceivedString);
|
||||
};
|
||||
const notFound = typedReceived === import_matcherHint.kNoElementsFoundError;
|
||||
if (notFound) {
|
||||
return {
|
||||
pass: this.isNot,
|
||||
message: () => matcherHintWithExpect(`Expected: ${this.utils.printExpected(expected)}
|
||||
Received: ${(0, import_expectBundle.EXPECTED_COLOR)("<element not found>")}`) + (0, import_util.callLogText)(log),
|
||||
name: "toMatchAriaSnapshot",
|
||||
expected
|
||||
};
|
||||
}
|
||||
const receivedText = typedReceived.raw;
|
||||
const message = () => {
|
||||
if (pass) {
|
||||
const receivedString = notFound ? receivedText : (0, import_expect.printReceivedStringContainExpectedSubstring)(receivedText, receivedText.indexOf(expected), expected.length);
|
||||
const expectedReceivedString = `Expected: not ${this.utils.printExpected(expected)}
|
||||
Received: ${receivedString}`;
|
||||
return matcherHintWithExpect(expectedReceivedString) + (0, import_util.callLogText)(log);
|
||||
let printedExpected;
|
||||
let printedReceived;
|
||||
let printedDiff;
|
||||
if (errorMessage) {
|
||||
printedExpected = `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}`;
|
||||
} else if (pass) {
|
||||
const receivedString = (0, import_expect.printReceivedStringContainExpectedSubstring)(typedReceived.raw, typedReceived.raw.indexOf(expected), expected.length);
|
||||
printedExpected = `Expected: not ${this.utils.printExpected(expected)}`;
|
||||
printedReceived = `Received: ${receivedString}`;
|
||||
} else {
|
||||
const labelExpected = `Expected`;
|
||||
const expectedReceivedString = notFound ? `${labelExpected}: ${this.utils.printExpected(expected)}
|
||||
Received: ${receivedText}` : this.utils.printDiffOrStringify(expected, receivedText, labelExpected, "Received", false);
|
||||
return matcherHintWithExpect(expectedReceivedString) + (0, import_util.callLogText)(log);
|
||||
printedDiff = this.utils.printDiffOrStringify(expected, typedReceived.raw, "Expected", "Received", false);
|
||||
}
|
||||
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
||||
matcherName,
|
||||
expectation: "expected",
|
||||
locator,
|
||||
timeout,
|
||||
timedOut,
|
||||
printedExpected,
|
||||
printedReceived,
|
||||
printedDiff,
|
||||
errorMessage,
|
||||
log
|
||||
});
|
||||
};
|
||||
if (errorMessage)
|
||||
return { pass: this.isNot, message, name: "toMatchAriaSnapshot", expected };
|
||||
if (!this.isNot) {
|
||||
if (updateSnapshots === "all" || updateSnapshots === "changed" && pass === this.isNot || generateMissingBaseline) {
|
||||
if (expectedPath) {
|
||||
|
||||
27
node_modules/playwright/lib/matchers/toMatchSnapshot.js
generated
vendored
Executable file → Normal file
27
node_modules/playwright/lib/matchers/toMatchSnapshot.js
generated
vendored
Executable file → Normal file
@@ -162,7 +162,7 @@ class SnapshotHelper {
|
||||
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-diff"), contentType: this.mimeType, path: this.diffPath });
|
||||
}
|
||||
if (log?.length)
|
||||
output.push((0, import_util.callLogText)(log));
|
||||
output.push((0, import_matcherHint.callLogText)(log));
|
||||
else
|
||||
output.push("");
|
||||
return this.createMatcherResult(output.join("\n"), false, log);
|
||||
@@ -216,8 +216,7 @@ function toMatchSnapshot(received, nameOrOptions = {}, optOptions = {}) {
|
||||
const result = helper.comparator(received, expected, helper.options);
|
||||
if (!result)
|
||||
return helper.handleMatching();
|
||||
const receiver = (0, import_utils.isString)(received) ? "string" : "Buffer";
|
||||
const header = (0, import_matcherHint.matcherHint)(this, void 0, "toMatchSnapshot", receiver, void 0, void 0, void 0);
|
||||
const header = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toMatchSnapshot", receiver: (0, import_utils.isString)(received) ? "string" : "Buffer", expectation: "expected" });
|
||||
return helper.handleDifferent(received, expected, void 0, result.diff, header, result.errorMessage, void 0, this._stepInfo);
|
||||
}
|
||||
function toHaveScreenshotStepTitle(nameOrOptions = {}, optOptions = {}) {
|
||||
@@ -271,11 +270,10 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
||||
}
|
||||
if (helper.updateSnapshots === "none" && !hasSnapshot)
|
||||
return helper.createMatcherResult(`A snapshot doesn't exist at ${helper.expectedPath}.`, false);
|
||||
const receiver = locator ? "locator" : "page";
|
||||
if (!hasSnapshot) {
|
||||
const { actual: actual2, previous: previous2, diff: diff2, errorMessage: errorMessage2, log: log2, timedOut: timedOut2 } = await page._expectScreenshot(expectScreenshotOptions);
|
||||
if (errorMessage2) {
|
||||
const header2 = (0, import_matcherHint.matcherHint)(this, locator, "toHaveScreenshot", receiver, void 0, void 0, timedOut2 ? timeout : void 0);
|
||||
const header2 = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut: timedOut2 });
|
||||
return helper.handleDifferent(actual2, void 0, previous2, diff2, header2, errorMessage2, log2, this._stepInfo);
|
||||
}
|
||||
return helper.handleMissing(actual2, this._stepInfo);
|
||||
@@ -283,22 +281,27 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
||||
const expected = await import_fs.default.promises.readFile(helper.expectedPath);
|
||||
expectScreenshotOptions.expected = helper.updateSnapshots === "all" ? void 0 : expected;
|
||||
const { actual, previous, diff, errorMessage, log, timedOut } = await page._expectScreenshot(expectScreenshotOptions);
|
||||
const writeFiles = () => {
|
||||
writeFileSync(helper.expectedPath, actual);
|
||||
writeFileSync(helper.actualPath, actual);
|
||||
const writeFiles = (actualBuffer) => {
|
||||
writeFileSync(helper.expectedPath, actualBuffer);
|
||||
writeFileSync(helper.actualPath, actualBuffer);
|
||||
console.log(helper.expectedPath + " is re-generated, writing actual.");
|
||||
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
|
||||
};
|
||||
if (!errorMessage) {
|
||||
if (helper.updateSnapshots === "all" && actual && (0, import_utils.compareBuffersOrStrings)(actual, expected)) {
|
||||
console.log(helper.expectedPath + " is re-generated, writing actual.");
|
||||
return writeFiles();
|
||||
return writeFiles(actual);
|
||||
}
|
||||
return helper.handleMatching();
|
||||
}
|
||||
if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all")
|
||||
return writeFiles();
|
||||
const header = (0, import_matcherHint.matcherHint)(this, void 0, "toHaveScreenshot", receiver, void 0, void 0, timedOut ? timeout : void 0);
|
||||
if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all") {
|
||||
if (actual)
|
||||
return writeFiles(actual);
|
||||
let header2 = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut });
|
||||
header2 += " Failed to re-generate expected.\n";
|
||||
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header2, errorMessage, log, this._stepInfo);
|
||||
}
|
||||
const header = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut });
|
||||
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header, errorMessage, log, this._stepInfo);
|
||||
}
|
||||
function writeFileSync(aPath, content) {
|
||||
|
||||
64
node_modules/playwright/lib/matchers/toMatchText.js
generated
vendored
Executable file → Normal file
64
node_modules/playwright/lib/matchers/toMatchText.js
generated
vendored
Executable file → Normal file
@@ -21,26 +21,20 @@ __export(toMatchText_exports, {
|
||||
toMatchText: () => toMatchText
|
||||
});
|
||||
module.exports = __toCommonJS(toMatchText_exports);
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_util = require("../util");
|
||||
var import_expect = require("./expect");
|
||||
var import_matcherHint = require("./matcherHint");
|
||||
var import_expectBundle = require("../common/expectBundle");
|
||||
async function toMatchText(matcherName, receiver, receiverType, query, expected, options = {}) {
|
||||
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
|
||||
const matcherOptions = {
|
||||
isNot: this.isNot,
|
||||
promise: this.promise
|
||||
};
|
||||
const locator = receiverType === "Locator" ? receiver : void 0;
|
||||
if (!(typeof expected === "string") && !(expected && typeof expected.test === "function")) {
|
||||
throw new Error([
|
||||
(0, import_matcherHint.matcherHint)(this, receiverType === "Locator" ? receiver : void 0, matcherName, options.receiverLabel ?? receiver, expected, matcherOptions, void 0, void 0, true),
|
||||
`${import_utils.colors.bold("Matcher error")}: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string or regular expression`,
|
||||
this.utils.printWithType("Expected", expected, this.utils.printExpected)
|
||||
].join("\n\n"));
|
||||
const errorMessage2 = `Error: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string or regular expression
|
||||
${this.utils.printWithType("Expected", expected, this.utils.printExpected)}`;
|
||||
throw new Error((0, import_matcherHint.formatMatcherMessage)(this, { locator, matcherName, expectation: "expected", errorMessage: errorMessage2 }));
|
||||
}
|
||||
const timeout = options.timeout ?? this.timeout;
|
||||
const { matches: pass, received, log, timedOut } = await query(!!this.isNot, timeout);
|
||||
const { matches: pass, received, log, timedOut, errorMessage } = await query(!!this.isNot, timeout);
|
||||
if (pass === !this.isNot) {
|
||||
return {
|
||||
name: matcherName,
|
||||
@@ -49,45 +43,45 @@ async function toMatchText(matcherName, receiver, receiverType, query, expected,
|
||||
expected
|
||||
};
|
||||
}
|
||||
const stringSubstring = options.matchSubstring ? "substring" : "string";
|
||||
const expectedSuffix = typeof expected === "string" ? options.matchSubstring ? " substring" : "" : " pattern";
|
||||
const receivedSuffix = typeof expected === "string" ? options.matchSubstring ? " string" : "" : " string";
|
||||
const receivedString = received || "";
|
||||
const notFound = received === import_matcherHint.kNoElementsFoundError;
|
||||
let printedReceived;
|
||||
let printedExpected;
|
||||
let printedDiff;
|
||||
if (pass) {
|
||||
if (typeof expected === "string") {
|
||||
if (notFound) {
|
||||
printedExpected = `Expected ${stringSubstring}: not ${this.utils.printExpected(expected)}`;
|
||||
printedReceived = `Received: ${received}`;
|
||||
} else {
|
||||
printedExpected = `Expected ${stringSubstring}: not ${this.utils.printExpected(expected)}`;
|
||||
printedExpected = `Expected${expectedSuffix}: not ${this.utils.printExpected(expected)}`;
|
||||
if (!errorMessage) {
|
||||
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedSubstring)(receivedString, receivedString.indexOf(expected), expected.length);
|
||||
printedReceived = `Received string: ${formattedReceived}`;
|
||||
printedReceived = `Received${receivedSuffix}: ${formattedReceived}`;
|
||||
}
|
||||
} else {
|
||||
if (notFound) {
|
||||
printedExpected = `Expected pattern: not ${this.utils.printExpected(expected)}`;
|
||||
printedReceived = `Received: ${received}`;
|
||||
} else {
|
||||
printedExpected = `Expected pattern: not ${this.utils.printExpected(expected)}`;
|
||||
printedExpected = `Expected${expectedSuffix}: not ${this.utils.printExpected(expected)}`;
|
||||
if (!errorMessage) {
|
||||
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedResult)(receivedString, typeof expected.exec === "function" ? expected.exec(receivedString) : null);
|
||||
printedReceived = `Received string: ${formattedReceived}`;
|
||||
printedReceived = `Received${receivedSuffix}: ${formattedReceived}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const labelExpected = `Expected ${typeof expected === "string" ? stringSubstring : "pattern"}`;
|
||||
if (notFound) {
|
||||
printedExpected = `${labelExpected}: ${this.utils.printExpected(expected)}`;
|
||||
printedReceived = `Received: ${received}`;
|
||||
} else {
|
||||
printedDiff = this.utils.printDiffOrStringify(expected, receivedString, labelExpected, "Received string", false);
|
||||
}
|
||||
if (errorMessage)
|
||||
printedExpected = `Expected${expectedSuffix}: ${this.utils.printExpected(expected)}`;
|
||||
else
|
||||
printedDiff = this.utils.printDiffOrStringify(expected, receivedString, `Expected${expectedSuffix}`, `Received${receivedSuffix}`, false);
|
||||
}
|
||||
const message = () => {
|
||||
const resultDetails = printedDiff ? printedDiff : printedExpected + "\n" + printedReceived;
|
||||
const hints = (0, import_matcherHint.matcherHint)(this, receiverType === "Locator" ? receiver : void 0, matcherName, options.receiverLabel ?? "locator", void 0, matcherOptions, timedOut ? timeout : void 0, resultDetails, true);
|
||||
return hints + (0, import_util.callLogText)(log);
|
||||
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
||||
matcherName,
|
||||
expectation: "expected",
|
||||
locator,
|
||||
timeout,
|
||||
timedOut,
|
||||
printedExpected,
|
||||
printedReceived,
|
||||
printedDiff,
|
||||
log,
|
||||
errorMessage
|
||||
});
|
||||
};
|
||||
return {
|
||||
name: matcherName,
|
||||
|
||||
Reference in New Issue
Block a user