playwright
Advanced tools
Comparing version 1.50.0-alpha-2025-01-07 to 1.50.0-alpha-2025-01-11
@@ -440,30 +440,39 @@ "use strict"; | ||
const csiListener = { | ||
onApiCallBegin: (apiName, params, frames, userData, out) => { | ||
userData.apiName = apiName; | ||
onApiCallBegin: data => { | ||
const testInfo = (0, _globals.currentTestInfo)(); | ||
if (!testInfo || apiName.includes('setTestIdAttribute') || apiName === 'tracing.groupEnd') return; | ||
// Some special calls do not get into steps. | ||
if (!testInfo || data.apiName.includes('setTestIdAttribute') || data.apiName === 'tracing.groupEnd') return; | ||
const expectZone = _utils.zones.zoneData('expectZone'); | ||
if (expectZone) { | ||
// Display the internal locator._expect call under the name of the enclosing expect call, | ||
// and connect it to the existing expect step. | ||
data.apiName = expectZone.title; | ||
data.stepId = expectZone.stepId; | ||
return; | ||
} | ||
// In the general case, create a step for each api call and connect them through the stepId. | ||
const step = testInfo._addStep({ | ||
location: frames[0], | ||
location: data.frames[0], | ||
category: 'pw:api', | ||
title: renderApiCall(apiName, params), | ||
apiName, | ||
params | ||
title: renderApiCall(data.apiName, data.params), | ||
apiName: data.apiName, | ||
params: data.params | ||
}, tracingGroupSteps[tracingGroupSteps.length - 1]); | ||
userData.step = step; | ||
out.stepId = step.stepId; | ||
if (apiName === 'tracing.group') tracingGroupSteps.push(step); | ||
data.userData = step; | ||
data.stepId = step.stepId; | ||
if (data.apiName === 'tracing.group') tracingGroupSteps.push(step); | ||
}, | ||
onApiCallEnd: (userData, error) => { | ||
onApiCallEnd: data => { | ||
// "tracing.group" step will end later, when "tracing.groupEnd" finishes. | ||
if (userData.apiName === 'tracing.group') return; | ||
if (userData.apiName === 'tracing.groupEnd') { | ||
if (data.apiName === 'tracing.group') return; | ||
if (data.apiName === 'tracing.groupEnd') { | ||
const step = tracingGroupSteps.pop(); | ||
step === null || step === void 0 || step.complete({ | ||
error | ||
error: data.error | ||
}); | ||
return; | ||
} | ||
const step = userData.step; | ||
const step = data.userData; | ||
step === null || step === void 0 || step.complete({ | ||
error | ||
error: data.error | ||
}); | ||
@@ -470,0 +479,0 @@ }, |
@@ -62,5 +62,4 @@ "use strict"; | ||
const expected = attached ? 'attached' : 'detached'; | ||
const unexpected = attached ? 'detached' : 'attached'; | ||
const arg = attached ? '' : '{ attached: false }'; | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeAttached', locator, 'Locator', expected, unexpected, arg, async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeAttached', locator, 'Locator', expected, arg, async (isNot, timeout) => { | ||
return await locator._expect(attached ? 'to.be.attached' : 'to.be.detached', { | ||
@@ -73,10 +72,22 @@ isNot, | ||
function toBeChecked(locator, options) { | ||
const checked = !options || options.checked === undefined || options.checked; | ||
const expected = checked ? 'checked' : 'unchecked'; | ||
const unexpected = checked ? 'unchecked' : 'checked'; | ||
const arg = checked ? '' : '{ checked: false }'; | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeChecked', locator, 'Locator', expected, unexpected, arg, async (isNot, timeout) => { | ||
return await locator._expect(checked ? 'to.be.checked' : 'to.be.unchecked', { | ||
const checked = options === null || options === void 0 ? void 0 : options.checked; | ||
const indeterminate = options === null || options === void 0 ? void 0 : options.indeterminate; | ||
const expectedValue = { | ||
checked, | ||
indeterminate | ||
}; | ||
let expected; | ||
let arg; | ||
if (options !== null && options !== void 0 && options.indeterminate) { | ||
expected = 'indeterminate'; | ||
arg = `{ indeterminate: true }`; | ||
} else { | ||
expected = (options === null || options === void 0 ? void 0 : options.checked) === false ? 'unchecked' : 'checked'; | ||
arg = (options === null || options === void 0 ? void 0 : options.checked) === false ? `{ checked: false }` : ''; | ||
} | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeChecked', locator, 'Locator', expected, arg, async (isNot, timeout) => { | ||
return await locator._expect('to.be.checked', { | ||
isNot, | ||
timeout | ||
timeout, | ||
expectedValue | ||
}); | ||
@@ -86,3 +97,3 @@ }, options); | ||
function toBeDisabled(locator, options) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeDisabled', locator, 'Locator', 'disabled', 'enabled', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeDisabled', locator, 'Locator', 'disabled', '', async (isNot, timeout) => { | ||
return await locator._expect('to.be.disabled', { | ||
@@ -97,5 +108,4 @@ isNot, | ||
const expected = editable ? 'editable' : 'readOnly'; | ||
const unexpected = editable ? 'readOnly' : 'editable'; | ||
const arg = editable ? '' : '{ editable: false }'; | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEditable', locator, 'Locator', expected, unexpected, arg, async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEditable', locator, 'Locator', expected, arg, async (isNot, timeout) => { | ||
return await locator._expect(editable ? 'to.be.editable' : 'to.be.readonly', { | ||
@@ -108,3 +118,3 @@ isNot, | ||
function toBeEmpty(locator, options) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEmpty', locator, 'Locator', 'empty', 'notEmpty', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEmpty', locator, 'Locator', 'empty', '', async (isNot, timeout) => { | ||
return await locator._expect('to.be.empty', { | ||
@@ -119,5 +129,4 @@ isNot, | ||
const expected = enabled ? 'enabled' : 'disabled'; | ||
const unexpected = enabled ? 'disabled' : 'enabled'; | ||
const arg = enabled ? '' : '{ enabled: false }'; | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEnabled', locator, 'Locator', expected, unexpected, arg, async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeEnabled', locator, 'Locator', expected, arg, async (isNot, timeout) => { | ||
return await locator._expect(enabled ? 'to.be.enabled' : 'to.be.disabled', { | ||
@@ -130,3 +139,3 @@ isNot, | ||
function toBeFocused(locator, options) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeFocused', locator, 'Locator', 'focused', 'inactive', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeFocused', locator, 'Locator', 'focused', '', async (isNot, timeout) => { | ||
return await locator._expect('to.be.focused', { | ||
@@ -139,3 +148,3 @@ isNot, | ||
function toBeHidden(locator, options) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeHidden', locator, 'Locator', 'hidden', 'visible', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeHidden', locator, 'Locator', 'hidden', '', async (isNot, timeout) => { | ||
return await locator._expect('to.be.hidden', { | ||
@@ -150,5 +159,4 @@ isNot, | ||
const expected = visible ? 'visible' : 'hidden'; | ||
const unexpected = visible ? 'hidden' : 'visible'; | ||
const arg = visible ? '' : '{ visible: false }'; | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeVisible', locator, 'Locator', expected, unexpected, arg, async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeVisible', locator, 'Locator', expected, arg, async (isNot, timeout) => { | ||
return await locator._expect(visible ? 'to.be.visible' : 'to.be.hidden', { | ||
@@ -161,3 +169,3 @@ isNot, | ||
function toBeInViewport(locator, options) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeInViewport', locator, 'Locator', 'in viewport', 'outside viewport', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toBeInViewport', locator, 'Locator', 'in viewport', '', async (isNot, timeout) => { | ||
return await locator._expect('to.be.in.viewport', { | ||
@@ -266,3 +274,3 @@ isNot, | ||
if (expected === undefined) { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toHaveAttribute', locator, 'Locator', 'have attribute', 'not have attribute', '', async (isNot, timeout) => { | ||
return _toBeTruthy.toBeTruthy.call(this, 'toHaveAttribute', locator, 'Locator', 'have attribute', '', async (isNot, timeout) => { | ||
return await locator._expect('to.have.attribute', { | ||
@@ -269,0 +277,0 @@ expressionArg: name, |
@@ -25,3 +25,3 @@ "use strict"; | ||
async function toBeTruthy(matcherName, receiver, receiverType, expected, unexpected, arg, query, options = {}) { | ||
async function toBeTruthy(matcherName, receiver, receiverType, expected, arg, query, options = {}) { | ||
var _options$timeout; | ||
@@ -49,3 +49,2 @@ (0, _util.expectTypes)(receiver, [receiverType], matcherName); | ||
const notFound = received === _matcherHint.kNoElementsFoundError ? received : undefined; | ||
const actual = pass ? expected : unexpected; | ||
let printedReceived; | ||
@@ -58,3 +57,3 @@ let printedExpected; | ||
printedExpected = `Expected: ${expected}`; | ||
printedReceived = `Received: ${notFound ? _matcherHint.kNoElementsFoundError : unexpected}`; | ||
printedReceived = `Received: ${notFound ? _matcherHint.kNoElementsFoundError : received}`; | ||
} | ||
@@ -69,3 +68,3 @@ const message = () => { | ||
pass, | ||
actual, | ||
actual: received, | ||
name: matcherName, | ||
@@ -72,0 +71,0 @@ expected, |
{ | ||
"name": "playwright", | ||
"version": "1.50.0-alpha-2025-01-07", | ||
"version": "1.50.0-alpha-2025-01-11", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -59,3 +59,3 @@ "repository": { | ||
"dependencies": { | ||
"playwright-core": "1.50.0-alpha-2025-01-07" | ||
"playwright-core": "1.50.0-alpha-2025-01-11" | ||
}, | ||
@@ -62,0 +62,0 @@ "optionalDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3175001
36298
+ Addedplaywright-core@1.50.0-alpha-2025-01-11(transitive)
- Removedplaywright-core@1.50.0-alpha-2025-01-07(transitive)