playwright
Advanced tools
Comparing version 1.50.0-alpha-2024-11-22 to 1.50.0-alpha-2024-11-23
@@ -46,2 +46,3 @@ "use strict"; | ||
const files = []; | ||
const gitCache = new Map(); | ||
for (const fileName of [...suggestedRebaselines.keys()].sort()) { | ||
@@ -83,5 +84,12 @@ const source = await _fs.default.promises.readFile(fileName, 'utf8'); | ||
for (const range of ranges) result = result.substring(0, range.start) + range.newText + result.substring(range.end); | ||
const relativeName = _path.default.relative(process.cwd(), fileName); | ||
files.push(relativeName); | ||
patches.push(createPatch(relativeName, source, result)); | ||
if (process.env.PWTEST_UPDATE_SNAPSHOTS === 'overwrite') { | ||
await _fs.default.promises.writeFile(fileName, result); | ||
} else if (process.env.PWTEST_UPDATE_SNAPSHOTS === 'manual') { | ||
await _fs.default.promises.writeFile(fileName, applyPatchWithConflictMarkers(source, result)); | ||
} else { | ||
const gitFolder = findGitRoot(_path.default.dirname(fileName), gitCache); | ||
const relativeName = _path.default.relative(gitFolder || process.cwd(), fileName); | ||
files.push(relativeName); | ||
patches.push(createPatch(relativeName, source, result)); | ||
} | ||
} | ||
@@ -102,2 +110,51 @@ const patchFile = _path.default.join(project.project.outputDir, 'rebaselines.patch'); | ||
return ['diff --git a/' + file + ' b/' + file, '--- a/' + file, '+++ b/' + file, ...text.split('\n').slice(4)].join('\n'); | ||
} | ||
function findGitRoot(dir, cache) { | ||
const result = cache.get(dir); | ||
if (result !== undefined) return result; | ||
const gitPath = _path.default.join(dir, '.git'); | ||
if (_fs.default.existsSync(gitPath) && _fs.default.lstatSync(gitPath).isDirectory()) { | ||
cache.set(dir, dir); | ||
return dir; | ||
} | ||
const parentDir = _path.default.dirname(dir); | ||
if (dir === parentDir) { | ||
cache.set(dir, null); | ||
return null; | ||
} | ||
const parentResult = findGitRoot(parentDir, cache); | ||
cache.set(dir, parentResult); | ||
return parentResult; | ||
} | ||
function applyPatchWithConflictMarkers(oldText, newText) { | ||
const diffResult = _utilsBundle.diff.diffLines(oldText, newText); | ||
let result = ''; | ||
let conflict = false; | ||
diffResult.forEach(part => { | ||
if (part.added) { | ||
if (conflict) { | ||
result += part.value; | ||
result += '>>>>>>> SNAPSHOT\n'; | ||
conflict = false; | ||
} else { | ||
result += '<<<<<<< HEAD\n'; | ||
result += part.value; | ||
result += '=======\n'; | ||
conflict = true; | ||
} | ||
} else if (part.removed) { | ||
result += '<<<<<<< HEAD\n'; | ||
result += part.value; | ||
result += '=======\n'; | ||
conflict = true; | ||
} else { | ||
if (conflict) { | ||
result += '>>>>>>> SNAPSHOT\n'; | ||
conflict = false; | ||
} | ||
result += part.value; | ||
} | ||
}); | ||
if (conflict) result += '>>>>>>> SNAPSHOT\n'; | ||
return result; | ||
} |
{ | ||
"name": "playwright", | ||
"version": "1.50.0-alpha-2024-11-22", | ||
"version": "1.50.0-alpha-2024-11-23", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -59,3 +59,3 @@ "repository": { | ||
"dependencies": { | ||
"playwright-core": "1.50.0-alpha-2024-11-22" | ||
"playwright-core": "1.50.0-alpha-2024-11-23" | ||
}, | ||
@@ -62,0 +62,0 @@ "optionalDependencies": { |
# 🎭 Playwright | ||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-132.0.6834.6-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-132.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-18.2-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord) | ||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-132.0.6834.15-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-132.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-18.2-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-infomational)](https://aka.ms/playwright/discord) | ||
@@ -11,3 +11,3 @@ ## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright) | ||
| :--- | :---: | :---: | :---: | | ||
| Chromium <!-- GEN:chromium-version -->132.0.6834.6<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| Chromium <!-- GEN:chromium-version -->132.0.6834.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| WebKit <!-- GEN:webkit-version -->18.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
@@ -14,0 +14,0 @@ | Firefox <!-- GEN:firefox-version -->132.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
3152580
35737
178
+ Addedplaywright-core@1.50.0-alpha-2024-11-23(transitive)
- Removedplaywright-core@1.50.0-alpha-2024-11-22(transitive)