Update dependencies and fix screenshot tests

This commit is contained in:
Cadence Ember 2022-04-18 20:13:05 +12:00
parent 3b18a7028e
commit 0edc966fda
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
3 changed files with 753 additions and 1324 deletions

2055
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,15 +9,15 @@
"assistant": "cd src/site && node assistant.js",
"build-lang": "cd src/lang/utils && node build_base.js",
"test": "tap",
"upload-test-files": "rsync -a src/lib/utils/saved_requests/files/ debib:meta/saved_requests; rsync -a test/screenshots/final/ debib:meta/screenshots",
"upload-test-files": "rsync -a src/lib/utils/saved_requests/files/ ipib:meta/saved_requests; rsync -a test/screenshots/final/ ipib:meta/screenshots",
"download-test-files": "bash -c 'mkdir -p test/screenshots/{diff,final,staging} && rm test/screenshots/final/* && wget -q -r -nd -np -P test/screenshots/final -R html -R tmp https://meta.bibliogram.art/screenshots/'"
},
"keywords": [],
"author": "",
"license": "AGPL-3.0-only",
"dependencies": {
"better-sqlite3": "^7.4.4",
"cookie": "^0.4.1",
"better-sqlite3": "^7.5.1",
"cookie": "^0.5.0",
"fast-html-parser": "^1.0.1",
"feed": "git+https://git.sr.ht/~cadence/nodejs-feed#3dde82f8296d7a6f5659323e497e0c684f03ab71",
"get-stream": "^6.0.1",
@ -25,10 +25,10 @@
"is-in-subnet": "^4.0.1",
"mixin-deep": "^2.0.1",
"node-dir": "^0.1.17",
"node-fetch": "^2.6.5",
"node-fetch": "^2.6.7",
"pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#2a5a025a974bd5cbb81bae32ec4d5c247cec0d42",
"pug": "^3.0.2",
"semver": "^7.3.5",
"semver": "^7.3.7",
"socks-proxy-agent": "git+https://git.sr.ht/~cadence/nodejs-socks-proxy-agent#5eef50a01667bd5c6b5626fb8e206232152dfbee"
},
"optionalDependencies": {
@ -37,8 +37,8 @@
},
"devDependencies": {
"jimp": "^0.16.1",
"selenium-webdriver": "^4.0.0",
"tap": "^15.0.10",
"why-is-node-running": "^2.2.0"
"selenium-webdriver": "^4.1.1",
"tap": "^16.0.1",
"why-is-node-running": "^2.2.1"
}
}

View File

@ -18,8 +18,8 @@ constants.website_origin = origin
const dimensions = new Map([
["firefox", {
scrollbar: 12,
heightDifference: 74,
widthDifference: 0
heightDifference: 74+12,
widthDifference: 0 // 12
}],
["chrome", {
scrollbar: 15,
@ -82,6 +82,7 @@ function exec(command) {
if (scrollNumber > 1) {
await driver.executeScript(`window.scrollByPages(1)`)
await new Promise(resolve => setTimeout(resolve, 400)) // magic :( I didn't always need this
}
const finalExists = await fs.access(screenPath("final")).then(() => true).catch(() => false)
@ -91,6 +92,7 @@ function exec(command) {
const message = `equal screens: ${filenameWithScroll}`
tap.test(message, async childTest => {
const image = await Jimp.read(screenshot)
console.log("screenshot size", {width: image.bitmap.width, height: image.bitmap.height}, "crop size", command.size)
image.crop(0, 0, command.size.width, command.size.height) // crop out page scrollbar
if (finalExists) {