expect-puppeteer
Advanced tools
Comparing version
@@ -6,2 +6,13 @@ # Change Log | ||
## [6.1.1](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer/compare/v6.1.0...v6.1.1) (2022-07-06) | ||
### Bug Fixes | ||
* **expect-puppeteer:** return proper error stack traces from matchers ([#487](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer/issues/487)) ([e9cafb1](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer/commit/e9cafb14b3ea5573ff06a55ba13e0718bb482b03)) | ||
# [6.1.0](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer/compare/v6.0.3...v6.1.0) (2022-02-02) | ||
@@ -8,0 +19,0 @@ |
@@ -35,4 +35,3 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
/* eslint-disable no-use-before-define, no-restricted-syntax, no-await-in-loop */ | ||
const pageMatchers = { | ||
@@ -75,3 +74,3 @@ toClick: _toClick.default, | ||
} catch (error) { | ||
Error.captureStackTrace(error, createMatcher); | ||
Error.captureStackTrace(error, throwingMatcher); | ||
throw error; | ||
@@ -121,5 +120,8 @@ } | ||
const jestMatchers = originalExpect(actual, ...args); | ||
return _extends({}, jestMatchers, matchers, { | ||
not: _extends({}, jestMatchers.not, matchers.not) | ||
}); | ||
return { ...jestMatchers, | ||
...matchers, | ||
not: { ...jestMatchers.not, | ||
...matchers.not | ||
} | ||
}; | ||
} | ||
@@ -126,0 +128,0 @@ |
@@ -10,12 +10,6 @@ "use strict"; | ||
const _excluded = ["text"]; | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
async function notToMatchElement(instance, selector, _ref = {}) { | ||
let { | ||
text | ||
} = _ref, | ||
options = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
async function notToMatchElement(instance, selector, { | ||
text, | ||
...options | ||
} = {}) { | ||
options = (0, _options.defaultOptions)(options); | ||
@@ -22,0 +16,0 @@ const { |
@@ -8,8 +8,4 @@ "use strict"; | ||
const _excluded = ["delay"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
async function selectAll(element) { | ||
@@ -41,8 +37,6 @@ // modified from https://github.com/microsoft/playwright/issues/849#issuecomment-587983363 | ||
async function toFill(instance, selector, value, options) { | ||
const _ref = options || {}, | ||
{ | ||
delay | ||
} = _ref, | ||
toMatchElementOptions = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
const { | ||
delay, | ||
...toMatchElementOptions | ||
} = options || {}; | ||
const element = await (0, _toMatchElement.default)(instance, selector, toMatchElementOptions); | ||
@@ -49,0 +43,0 @@ await selectAll(element); |
@@ -10,17 +10,10 @@ "use strict"; | ||
const _excluded = ["text", "visible"]; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
async function toMatchElement(instance, selector, _ref = {}) { | ||
let { | ||
text: searchExpr, | ||
visible = false | ||
} = _ref, | ||
options = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
async function toMatchElement(instance, selector, { | ||
text: searchExpr, | ||
visible = false, | ||
...options | ||
} = {}) { | ||
options = (0, _options.defaultOptions)(options); | ||
selector = selector instanceof Object ? _extends({}, selector) : { | ||
selector = selector instanceof Object ? { ...selector | ||
} : { | ||
type: 'css', | ||
@@ -27,0 +20,0 @@ value: selector |
@@ -5,5 +5,2 @@ "use strict"; | ||
exports.setDefaultOptions = exports.getDefaultOptions = exports.defaultOptions = void 0; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
let defaultOptionsValue = { | ||
@@ -21,3 +18,3 @@ timeout: 500 | ||
if (global.puppeteerConfig && (global.puppeteerConfig.launch && global.puppeteerConfig.launch.slowMo || global.puppeteerConfig.connect && global.puppeteerConfig.connect.slowMo) && defaultOptionsValue && defaultOptionsValue.timeout) { | ||
return _extends({}, defaultOptionsValue, { | ||
return { ...defaultOptionsValue, | ||
// Multiplying slowMo by 10 is just arbitrary | ||
@@ -27,3 +24,3 @@ // slowMo is applied on all Puppeteer internal methods, so it is just a "slow" indicator | ||
timeout: defaultOptionsValue.timeout + global.puppeteerConfig.launch.slowMo * 10 | ||
}); | ||
}; | ||
} | ||
@@ -36,4 +33,6 @@ | ||
const defaultOptions = options => _extends({}, getDefaultOptions(), options); | ||
const defaultOptions = options => ({ ...getDefaultOptions(), | ||
...options | ||
}); | ||
exports.defaultOptions = defaultOptions; |
{ | ||
"name": "expect-puppeteer", | ||
"description": "Assertion toolkit for Puppeteer.", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"main": "lib/index.js", | ||
@@ -26,3 +26,3 @@ "repository": "https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer", | ||
}, | ||
"gitHead": "cf307475dc56132a33aeee4d13bca9f772418c6d" | ||
"gitHead": "e7850cae66aad8e1da7acae3791f8012273a2e54" | ||
} |
47746
-3.34%603
-1.79%