New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@empiricalrun/playwright-utils

Package Overview
Dependencies
Maintainers
0
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@empiricalrun/playwright-utils - npm Package Compare versions

Comparing version

to
0.6.1

6

CHANGELOG.md
# @empiricalrun/playwright-utils
## 0.6.1
### Patch Changes
- de76cd6: fix: wrap mouse-pointer highlighter in try/catch
## 0.6.0

@@ -4,0 +10,0 @@

57

dist/test/scripts/mouse-pointer.js

@@ -6,7 +6,8 @@ "use strict";

page.on("load", async () => {
await page?.evaluate(() => {
const box = document.createElement("div");
box.classList.add("empirical-mouse-pointer");
const styleElement = document.createElement("style");
styleElement.textContent = `
try {
await page?.evaluate(() => {
const box = document.createElement("div");
box.classList.add("empirical-mouse-pointer");
const styleElement = document.createElement("style");
styleElement.textContent = `
.empirical-mouse-pointer {

@@ -57,26 +58,30 @@ pointer-events: none;

`;
document.head.appendChild(styleElement);
document.body.appendChild(box);
document.addEventListener("mousemove", (event) => {
box.style.left = `${event.pageX}px`;
box.style.top = `${event.pageY}px`;
updateButtons(event.buttons);
}, true);
document.addEventListener("mousedown", (event) => {
updateButtons(event.buttons);
box.classList.add(`button-${event.button + 1}`);
}, true);
document.addEventListener("mouseup", (event) => {
updateButtons(event.buttons);
box.classList.remove(`button-${event.button + 1}`);
}, true);
// @ts-ignore
function updateButtons(buttons) {
for (let i = 0; i < 5; i++) {
box.classList.toggle(`button-${i + 1}`, (buttons / Math.pow(2, i)) % 2 >= 1);
document.head.appendChild(styleElement);
document.body.appendChild(box);
document.addEventListener("mousemove", (event) => {
box.style.left = `${event.pageX}px`;
box.style.top = `${event.pageY}px`;
updateButtons(event.buttons);
}, true);
document.addEventListener("mousedown", (event) => {
updateButtons(event.buttons);
box.classList.add(`button-${event.button + 1}`);
}, true);
document.addEventListener("mouseup", (event) => {
updateButtons(event.buttons);
box.classList.remove(`button-${event.button + 1}`);
}, true);
// @ts-ignore
function updateButtons(buttons) {
for (let i = 0; i < 5; i++) {
box.classList.toggle(`button-${i + 1}`, (buttons / Math.pow(2, i)) % 2 >= 1);
}
}
}
});
});
}
catch (e) {
console.log(`Error adding mouse pointer highlighter`, e);
}
});
}
exports.addMousePointerHighlighter = addMousePointerHighlighter;
{
"name": "@empiricalrun/playwright-utils",
"version": "0.6.0",
"version": "0.6.1",
"publishConfig": {

@@ -5,0 +5,0 @@ "registry": "https://registry.npmjs.org/",

Sorry, the diff of this file is not supported yet