Socket
Socket
Sign inDemoInstall

expect-puppeteer

Package Overview
Dependencies
0
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.0.0 to 9.0.1

2

dist/index.d.ts

@@ -129,2 +129,2 @@ import { Page, Frame, ElementHandle, FrameWaitForFunctionOptions, ClickOptions, Dialog } from 'puppeteer';

export { Matcher, MatcherSet, PuppeteerMatchers, expectPuppeteer as expect, getDefaultOptions, setDefaultOptions };
export { type Matcher, type MatcherSet, type PuppeteerMatchers, expectPuppeteer as expect, getDefaultOptions, setDefaultOptions };

@@ -7,9 +7,9 @@ 'use strict';

const checkIsPage = (instance)=>{
return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "CDPPage";
return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPPage" || instance?.constructor?.name === "CdpPage");
};
const checkIsFrame = (instance)=>{
return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "Frame";
return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPFrame" || instance?.constructor?.name === "CdpFrame" || instance?.constructor?.name === "Frame");
};
const checkIsElementHandle = (instance)=>{
return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "CDPElementHandle";
return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPElementHandle" || instance?.constructor?.name === "CdpElementHandle");
};

@@ -78,3 +78,3 @@ const getContext = async (instance, pageFunction)=>{

};
const { text , regexp } = expr;
const { text, regexp } = expr;
if (text) {

@@ -118,6 +118,6 @@ return (value)=>sanitizeForSearch(value).includes(text);

async function matchTextContent(instance, matcher, options, type) {
const { traverseShadowRoots =false , ...otherOptions } = options;
const { traverseShadowRoots = false, ...otherOptions } = options;
const frameOptions = defaultOptions(otherOptions);
const ctx = await getContext(instance, ()=>document.body);
const { text , regexp } = serializeSearchExpression(matcher);
const { text, regexp } = serializeSearchExpression(matcher);
const parseSearchExpressionHandle = await evaluateParseSearchExpression(ctx.page);

@@ -191,5 +191,5 @@ await ctx.page.waitForFunction((handle, text, regexp, traverseShadowRoots, parseSearchExpression, type)=>{

async function getElementFactory(instance, selector, options) {
const { text: searchExpr , visible =false } = options;
const { text: searchExpr, visible = false } = options;
const ctx = await getContext(instance, ()=>document);
const { text , regexp } = serializeSearchExpression(searchExpr);
const { text, regexp } = serializeSearchExpression(searchExpr);
const parseSearchExpressionHandle = await evaluateParseSearchExpression(ctx.page);

@@ -241,3 +241,3 @@ const getElementArgs = [

});
const element = matcher ? elements.find(({ textContent })=>textContent && matcher(textContent)) : elements[0];
const element = matcher ? elements.find(({ textContent })=>textContent && matcher(textContent)) : elements[0];
switch(type){

@@ -269,3 +269,3 @@ case "element":

async function notToMatchElement(instance, selector, options = {}) {
const { text , visible , ...otherOptions } = options;
const { text, visible, ...otherOptions } = options;
const frameOptions = defaultOptions(otherOptions);

@@ -285,3 +285,3 @@ const rSelector = resolveSelector(selector);

async function toMatchElement(instance, selector, options = {}) {
const { text , visible , ...otherOptions } = options;
const { text, visible, ...otherOptions } = options;
const frameOptions = defaultOptions(otherOptions);

@@ -303,3 +303,3 @@ const rSelector = resolveSelector(selector);

async function toClick(instance, selector, options = {}) {
const { delay , button , clickCount , offset , ...otherOptions } = options;
const { delay, button, clickCount, offset, ...otherOptions } = options;
const element = await toMatchElement(instance, selector, otherOptions);

@@ -352,3 +352,3 @@ await element.click({

async function toFill(instance, selector, value, options = {}) {
const { delay , ...toMatchElementOptions } = options;
const { delay, ...toMatchElementOptions } = options;
const element = await toMatchElement(instance, selector, toMatchElementOptions);

@@ -363,3 +363,4 @@ await selectAll(element);

async function toFillForm(instance, selector, values, options = {}) {
const { delay , ...otherOptions } = options;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { delay, ...otherOptions } = options;
const form = await toMatchElement(instance, selector, otherOptions);

@@ -396,3 +397,3 @@ for (const name of Object.keys(values)){

}));
const option = optionsAttributes.find(({ value , textContent })=>value === valueOrText || textContent === valueOrText);
const option = optionsAttributes.find(({ value, textContent })=>value === valueOrText || textContent === valueOrText);
if (!option) {

@@ -399,0 +400,0 @@ throw new Error(`Option not found "${resolveSelector(selector).value}" ("${valueOrText}")`);

{
"name": "expect-puppeteer",
"description": "Assertion toolkit for Puppeteer.",
"version": "9.0.0",
"version": "9.0.1",
"type": "commonjs",

@@ -47,8 +47,8 @@ "main": "./dist/index.js",

"devDependencies": {
"puppeteer": "^20.3.0",
"rollup": "^3.23.0",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-swc3": "^0.8.1"
"puppeteer": "^21.3.6",
"rollup": "^3.29.4",
"rollup-plugin-dts": "^6.0.2",
"rollup-plugin-swc3": "^0.10.1"
},
"gitHead": "e13d1ddce8f557405419b37cc2f6f37b4fe45212"
"gitHead": "76ed6ee5441d039bcbd616d5e6821dfc529ad43f"
}

@@ -207,3 +207,3 @@ # expect-puppeteer

'input[type="file"]',
join(__dirname, "file.txt")
join(__dirname, "file.txt"),
);

@@ -210,0 +210,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc