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

playwright

Package Overview
Dependencies
Maintainers
0
Versions
4841
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright - npm Package Compare versions

Comparing version 1.51.0-beta-1741114139000 to 1.51.0-beta-1741145440000

lib/prompt.js

27

lib/index.js

@@ -38,3 +38,3 @@ "use strict";

var _testType = require("./common/testType");
var _util = require("./util");
var _prompt = require("./prompt");
var _expect = require("./matchers/expect");

@@ -788,2 +788,3 @@ var _configLoader = require("./common/configLoader");

this._pageSnapshot = void 0;
this._sourceCache = new Map();
this._playwright = playwright;

@@ -860,26 +861,4 @@ this._artifactsDir = artifactsDir;

await this._screenshotRecorder.persistTemporary();
await this._attachErrorPrompts();
await (0, _prompt.attachErrorPrompts)(this._testInfo, this._sourceCache, this._pageSnapshot);
}
async _attachErrorPrompts() {
if (process.env.PLAYWRIGHT_NO_COPY_PROMPT) return;
if (this._testInfo.errors.length === 0) return;
const testSources = await _fs.default.promises.readFile(this._testInfo.file, 'utf-8');
for (const [index, error] of this._testInfo.errors.entries()) {
if (this._testInfo.attachments.find(a => a.name === `_prompt-${index}`)) continue;
const metadata = this._testInfo.config.metadata;
const promptParts = [`My Playwright test failed.`, `Explain why, be concise, respect Playwright best practices.`, '', `Failed test: ${this._testInfo.titlePath.join(' >> ')}`, '', 'Error:', '', '```', (0, _util.stripAnsiEscapes)(error.stack || error.message || ''), '```'];
if (this._pageSnapshot) {
promptParts.push('', 'Page snapshot:', '```yaml', this._pageSnapshot, '```');
}
if (metadata.gitDiff) {
promptParts.push('', 'Local changes:', '```diff', metadata.gitDiff, '```');
}
promptParts.push('', 'Test file:', '```ts', `// ${this._testInfo.file}`, testSources, '```');
this._testInfo._attach({
name: `_prompt-${index}`,
contentType: 'text/markdown',
body: Buffer.from(promptParts.join('\n'))
}, undefined);
}
}
async _startTraceChunkOnContextCreation(tracing) {

@@ -886,0 +865,0 @@ const options = this._testInfo._tracing.traceOptions();

@@ -474,24 +474,3 @@ "use strict";

function prepareErrorStack(stack) {
const lines = stack.split('\n');
let firstStackLine = lines.findIndex(line => line.startsWith(' at '));
if (firstStackLine === -1) firstStackLine = lines.length;
const message = lines.slice(0, firstStackLine).join('\n');
const stackLines = lines.slice(firstStackLine);
let location;
for (const line of stackLines) {
const frame = (0, _utils.parseStackFrame)(line, _path.default.sep, !!process.env.PWDEBUGIMPL);
if (!frame || !frame.file) continue;
if (belongsToNodeModules(frame.file)) continue;
location = {
file: frame.file,
column: frame.column || 0,
line: frame.line || 0
};
break;
}
return {
message,
stackLines,
location
};
return (0, _utils.parseErrorStack)(stack, _path.default.sep, !!process.env.PWDEBUGIMPL);
}

@@ -553,5 +532,2 @@ function characterWidth(c) {

}
function belongsToNodeModules(file) {
return file.includes(`${_path.default.sep}node_modules${_path.default.sep}`);
}
function resolveFromEnv(name) {

@@ -558,0 +534,0 @@ const value = process.env[name];

{
"name": "playwright",
"version": "1.51.0-beta-1741114139000",
"version": "1.51.0-beta-1741145440000",
"description": "A high-level API to automate web browsers",

@@ -59,3 +59,3 @@ "repository": {

"dependencies": {
"playwright-core": "1.51.0-beta-1741114139000"
"playwright-core": "1.51.0-beta-1741145440000"
},

@@ -62,0 +62,0 @@ "optionalDependencies": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc