expect-playwright
Advanced tools
Comparing version 0.7.2 to 0.8.0
@@ -7,5 +7,10 @@ "use strict"; | ||
}; | ||
const isLocator = (value) => { | ||
return value.constructor.name === "Locator"; | ||
}; | ||
const getFrame = async (value) => { | ||
const resolved = await value; | ||
return isElementHandle(resolved) ? resolved.contentFrame() : resolved; | ||
return isElementHandle(resolved) | ||
? resolved.contentFrame() | ||
: resolved; | ||
}; | ||
@@ -23,10 +28,13 @@ exports.getFrame = getFrame; | ||
// Finally, we can find the element handle | ||
const handle = await args[0]; | ||
let elementHandle = (_a = (await exports.getFrame(handle))) !== null && _a !== void 0 ? _a : handle; | ||
let handle = await args[0]; | ||
handle = (_a = (await exports.getFrame(handle))) !== null && _a !== void 0 ? _a : handle; | ||
if (isLocator(handle)) { | ||
handle = (await handle.elementHandle()); | ||
} | ||
// If the user provided a page or iframe, we need to locate the provided | ||
// selector or the `body` element if none was provided. | ||
if (!isElementHandle(elementHandle)) { | ||
else if (!isElementHandle(handle)) { | ||
const selector = (_b = args[1]) !== null && _b !== void 0 ? _b : "body"; | ||
try { | ||
elementHandle = (await elementHandle.waitForSelector(selector, options)); | ||
handle = (await handle.waitForSelector(selector, options)); | ||
} | ||
@@ -37,3 +45,3 @@ catch (err) { | ||
} | ||
return [elementHandle, expectedValue]; | ||
return [handle, expectedValue]; | ||
}; | ||
@@ -40,0 +48,0 @@ exports.getElementHandle = getElementHandle; |
{ | ||
"name": "expect-playwright", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"main": "lib/index.js", | ||
@@ -18,9 +18,9 @@ "types": "./global.d.ts", | ||
"jest": "^27.0.4", | ||
"jest-playwright-preset": "^1.6.1", | ||
"playwright-chromium": "^1.12.0", | ||
"playwright-core": "^1.12.0", | ||
"prettier": "^2.3.0", | ||
"jest-playwright-preset": "^1.7.0", | ||
"playwright-chromium": "^1.14.0", | ||
"playwright-core": "^1.14.0", | ||
"prettier": "^2.3.2", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.3.2" | ||
"typescript": "^4.3.5" | ||
} | ||
} |
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
33961
659