From 3f37abd52b8c7a6cfd50e38f2034841c487dc266 Mon Sep 17 00:00:00 2001 From: okdistribute <633012+okdistribute@users.noreply.github.com> Date: Sun, 14 Jun 2020 20:04:34 -0700 Subject: [PATCH 1/6] fix: use ./bin/cli behaviors --- bin/cli | 2 +- bin/{cli-build => cli-behaviors} | 0 package.json | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename bin/{cli-build => cli-behaviors} (100%) diff --git a/bin/cli b/bin/cli index 08e0238..8d238f2 100755 --- a/bin/cli +++ b/bin/cli @@ -7,7 +7,7 @@ program .version(pkg.version) .usage(' [options]') .command('api [options]', 'Start the behavior api sever') - .command('build [options]', 'Build and or validate behaviors, or generate their metadata') + .command('behaviors [options]', 'Build and or validate behaviors, or generate their metadata') .command('newBehavior [options]', 'Create a new behavior') .command('runner [options] ', 'Run and or build a behaviors') .command('stdlib [options]', `Commands specific to working with the behavior's std library`) diff --git a/bin/cli-build b/bin/cli-behaviors similarity index 100% rename from bin/cli-build rename to bin/cli-behaviors diff --git a/package.json b/package.json index b5149e3..fb603d5 100755 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "build-docs": "esdoc", "build-prod": "rollup -c rollup.prod.config.js", "build-watch": "rollup --watch -c rollup.dev.config.js", - "generate-runnable-behaviors": "node bin/cli-build -b", + "generate-runnable-behaviors": "node bin/cli-behaviors -b", "generate-stdlib-debug": "node ./bin/cli-stdlib --debug-script", "generate-stdlib-index": "node ./bin/cli-stdlib --gen-index", "generate-test-helper-values": "node ./internal/generateTestHelperValues.js", From 0696c4a87ff8fd76699f597ab2649f1c1fad69aa Mon Sep 17 00:00:00 2001 From: okdistribute <633012+okdistribute@users.noreply.github.com> Date: Sun, 14 Jun 2020 20:07:02 -0700 Subject: [PATCH 2/6] feat: add puppeeter testing --- package.json | 1 + test/_withPage.js | 16 ++++++++++++++++ test/test-behavior-api.js | 12 +++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/_withPage.js diff --git a/package.json b/package.json index fb603d5..2b9c61b 100755 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "plur": "^3.1.1", "prettier": "^1.18.2", "pretty-time": "^1.1.0", + "puppeteer": "^3.3.0", "qs": "^6.9.0", "rollup": "^1.23.1", "rollup-plugin-alias": "^2.0.1", diff --git a/test/_withPage.js b/test/_withPage.js new file mode 100644 index 0000000..afca533 --- /dev/null +++ b/test/_withPage.js @@ -0,0 +1,16 @@ +const puppeteer = require('puppeteer'); + +export default async (t, run) => { + const browser = await puppeteer.launch({ + ignoreHTTPSErrors: true + }); + const page = await browser.newPage({ + waitUntil: 'networkIdle' + }); + try { + await run(t, page); + } finally { + await page.close(); + await browser.close(); + } +} diff --git a/test/test-behavior-api.js b/test/test-behavior-api.js index ca2a4b0..7087532 100644 --- a/test/test-behavior-api.js +++ b/test/test-behavior-api.js @@ -3,6 +3,13 @@ import rp from 'request-promise-native'; import startServer from './helpers/testServer'; import { tests, allResult, defaultBMD } from './helpers/testedValues'; import { loadBehavior } from './helpers/utils'; +import withPage from './_withPage' +import fs from 'fs' +import path from 'path' + +const output = path.join(__dirname, 'output') + +var stream = fs.createWriteStream(output) /** * @type {fastify.FastifyInstance} @@ -21,10 +28,13 @@ test.after.always(t => { for (const aTest of tests) { test(`Retrieving the behavior js for "${ aTest.name - }" by URL should work`, async t => { + }" by URL should work`, withPage, async (t, page) => { const response = await rp(aTest.behaviorURL); const expectedBehavior = await loadBehavior(aTest.metadata.fileName); t.is(response, expectedBehavior); + console.log(expectedBehavior) + await page.goto(aTest.url); + await page.addScriptTag({content: expectedBehavior}); }); test(`Retrieving the behavior info for "${ From 6d3142202646cbe39a8fcc06eadd2162c8d6b3ba Mon Sep 17 00:00:00 2001 From: okdistribute <633012+okdistribute@users.noreply.github.com> Date: Mon, 3 Aug 2020 16:37:40 -0700 Subject: [PATCH 3/6] fix: get basic test runner operational! --- .gitignore | 8 +- README.md | 8 + package.json | 2 + test/helpers/testedValues.js | 103 +++++-------- test/status/README.md | 35 +++++ test/status/all.js | 20 +++ test/{ => status/lib}/_withPage.js | 5 +- test/status/lib/clean.sh | 1 + test/status/lib/one.js | 48 ++++++ test/status/lib/output-status.js | 23 +++ test/status/test-one-behavior.sh | 8 + test/test-behavior-api.js | 14 -- yarn.lock | 237 ++++++++++++++++++++++++++++- 13 files changed, 429 insertions(+), 83 deletions(-) create mode 100644 test/status/README.md create mode 100644 test/status/all.js rename test/{ => status/lib}/_withPage.js (69%) create mode 100755 test/status/lib/clean.sh create mode 100644 test/status/lib/one.js create mode 100644 test/status/lib/output-status.js create mode 100755 test/status/test-one-behavior.sh diff --git a/.gitignore b/.gitignore index 602f8af..cddcf01 100644 --- a/.gitignore +++ b/.gitignore @@ -59,4 +59,10 @@ typings/ .nuxt .vuepress/dist .serverless -docs \ No newline at end of file +docs +## status +test/status/proxy-certs +test/status/templates +test/status/static +test/status/collections + diff --git a/README.md b/README.md index d83d46b..12488f1 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,11 @@ The default configuration of the image is to run the api server, however you can with any of the cli commands listed previously. For more information please consult the provided `Dockerfile` and `docker-compose.yml` files. + +#### Testing + +``` +yarn build-dev +yarn generate-test-helper-values +yarn generate-runnable-behaviors +``` diff --git a/package.json b/package.json index 2b9c61b..68ae005 100755 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@babel/traverse": "^7.6.3", "@babel/types": "^7.6.3", "acorn": "^7.1.0", + "cdxj": "^1.0.2", "chalk": "^2.4.2", "cheerio": "^1.0.0-rc.2", "chokidar": "^3.2.1", @@ -35,6 +36,7 @@ "rollup-plugin-alias": "^2.0.1", "rollup-plugin-cleanup": "^3.1.1", "rollup-plugin-node-resolve": "^5.2.0", + "run-series": "^1.1.8", "ts-morph": "^4.2.0", "typescript": "^3.6.4", "uuid": "^3.3.3" diff --git a/test/helpers/testedValues.js b/test/helpers/testedValues.js index 0cf98d8..ac34994 100644 --- a/test/helpers/testedValues.js +++ b/test/helpers/testedValues.js @@ -4,6 +4,7 @@ module.exports = { name: 'Autoscroll', metadata: { name: 'autoScrollBehavior', + functional: true, displayName: 'Default Scrolling', defaultBehavior: true, description: @@ -53,6 +54,7 @@ module.exports = { metadata: { name: 'slideShareBehavior', displayName: 'SlideShare', + functional: true, match: { regex: '^(?:https?:\\/\\/(?:www\\.)?)slideshare\\.net\\/.+', }, @@ -80,6 +82,7 @@ module.exports = { metadata: { name: 'youtubeVideoBehavior', displayName: 'Youtube', + functional: true, match: { regex: '^(?:https?:\\/\\/(?:www\\.)?)?youtube\\.com\\/watch[?]v=.+', }, @@ -130,7 +133,7 @@ module.exports = { name: 'facebookUserFeed', displayName: 'Facebook Page', match: { - regex: '^https?:\\/\\/(www\\.)?facebook\\.com\\/[^\\/]+\\/?$', + regex: '^https?:\\/\\/(www\\.)?facebook\\.com\\/[^/]+\\/?$', }, description: 'Capture all items and comments in the Facebook page and scroll down to load more content where possible.', @@ -154,6 +157,7 @@ module.exports = { metadata: { name: 'fulcrumEpubBehavior', displayName: 'Fulcrum Epub', + functional: true, match: { regex: 'https?:\\/\\/(www\\.)?fulcrum\\.org\\/epubs\\/.+', }, @@ -180,6 +184,7 @@ module.exports = { metadata: { name: 'instagramOwnFeedBehavior', displayName: 'Instagram User Feed', + functional: true, match: { regex: '^https?:\\/\\/(www\\.)?instagram\\.com(?:\\/)?$', }, @@ -205,9 +210,9 @@ module.exports = { metadata: { name: 'instagramPostBehavior', displayName: 'Instagram Post', + functional: true, match: { - regex: - '^https?:\\/\\/(www\\.)?instagram\\.com\\/p\\/[^\\/]+(?:\\/)?$', + regex: '^https?:\\/\\/(www\\.)?instagram\\.com\\/p\\/[^/]+(?:\\/)?$', }, description: 'Capture every image and/or video, retrieve all comments, and scroll down to load more.', @@ -232,9 +237,10 @@ module.exports = { metadata: { name: 'instagramUserBehavior', displayName: 'Instagram User Page', + functional: true, match: { regex: - '^https?:\\/\\/(www\\.)?instagram\\.com\\/[^\\/]+(?:\\/(?:[?].+)?(?:tagged(?:\\/)?)?)?$', + '^https?:\\/\\/(www\\.)?instagram\\.com\\/[^/]+(?:\\/(?:[?].+)?(?:tagged(?:\\/)?)?)?$', }, description: 'Capture all stories, images, videos and comments on user’s page.', @@ -259,9 +265,10 @@ module.exports = { metadata: { name: 'soundCloudArtistBehavior', displayName: 'Soundcloud Profile', + functional: true, match: { regex: - '^(?:https?:\\/\\/(?:www\\.)?)?soundcloud\\.com\\/(?!(?:discover|stream))[^\\/]+(?:\\/(?:tracks|albums|sets|reposts))?(?:\\/)?$', + '^(?:https?:\\/\\/(?:www\\.)?)?soundcloud\\.com\\/(?!(?:discover|stream))[^/]+(?:\\/(?:tracks|albums|sets|reposts))?(?:\\/)?$', }, description: 'Capture every track on Soundcloud profile.', updated: '2019-08-21T14:52:23-07:00', @@ -285,6 +292,7 @@ module.exports = { metadata: { name: 'soundCloudEmbedBehavior', displayName: 'Soundcloud Embed', + functional: true, match: { regex: '^https?:\\/\\/w\\.soundcloud\\.com\\/player\\/.+', }, @@ -306,46 +314,19 @@ module.exports = { behaviorByNameURL: 'http://localhost:3030/behavior?name=soundCloudEmbedBehavior', }, - { - name: 'Twitter Hashtags', - metadata: { - name: 'twitterHashTagsBehavior', - displayName: 'Twitter Hashtag', - match: { - regex: - '^(?:https?:\\/\\/(?:www\\.)?)?twitter\\.com\\/hashtag\\/[^?]+.*', - }, - description: - 'Capture every tweet in hashtag search, including embedded videos, images and replies.', - updated: '2019-08-21T14:52:23-07:00', - fileName: 'twitterHashTagsBehavior.js', - }, - url: 'https://twitter.com/hashtag/iipcwac18?vertical=default&src=hash', - infoURL: - 'http://localhost:3030/info?url=https://twitter.com/hashtag/iipcwac18?vertical=default&src=hash', - infoByNameURL: 'http://localhost:3030/info?name=twitterHashTagsBehavior', - infoListURL: - 'http://localhost:3030/info-list?url=https://twitter.com/hashtag/iipcwac18?vertical=default&src=hash', - infoListByNameURL: - 'http://localhost:3030/info-list?name=twitterHashTagsBehavior', - behaviorURL: - 'http://localhost:3030/behavior?url=https://twitter.com/hashtag/iipcwac18?vertical=default&src=hash', - behaviorByNameURL: - 'http://localhost:3030/behavior?name=twitterHashTagsBehavior', - }, { name: 'Twitter Timeline', metadata: { name: 'twitterTimelineBehavior', displayName: 'Twitter Timeline', + functional: true, match: { - regex: - '^(?:https?:[\\/]{2}(?:www[.])?)?twitter[.]com[\\/]?(?:[^\\/]+[\\/]?)?$', + regex: '^(?:https?:[/]{2}(?:www[.])?)?twitter[.]com[/]?.*', }, description: - 'Capture every tweet, including embedded videos, images, replies and/or related tweets in thread.', - updated: '2019-08-21T14:52:23-07:00', - fileName: 'twitterTimelineBehavior.js', + 'Capture every tweet, including quotes, embedded videos, images, replies and/or related tweets in thread.', + updated: '2020-04-27T00:00:00Z', + fileName: 'twitterTwitterAllBehavior.js', }, url: 'https://twitter.com/webrecorder_io', infoURL: @@ -365,9 +346,10 @@ module.exports = { metadata: { name: 'yahooGroupConvoMessagesBehavior', displayName: 'Yahoo Group Conversation Messages', + functional: true, match: { regex: - '^https?:\\/\\/(?:www\\.)?groups\\.yahoo\\.com\\/neo\\/groups\\/[^\\/]+\\/conversations\\/messages(?:[?].+)?$', + '^https?:\\/\\/(?:www\\.)?groups\\.yahoo\\.com\\/neo\\/groups\\/[^/]+\\/conversations\\/messages(?:[?].+)?$', }, description: 'Views conversation messages of a Yahoo Group', updated: '2019-10-23T15:04:10-04:00', @@ -391,6 +373,7 @@ module.exports = { ], defaultBMD: { name: 'autoScrollBehavior', + functional: true, displayName: 'Default Scrolling', defaultBehavior: true, description: @@ -400,10 +383,11 @@ module.exports = { }, allResult: { url: 'http://localhost:3030/info-all', - count: 14, + count: 13, value: { defaultBehavior: { name: 'autoScrollBehavior', + functional: true, displayName: 'Default Scrolling', defaultBehavior: true, description: @@ -426,6 +410,7 @@ module.exports = { slideShareBehavior: { name: 'slideShareBehavior', displayName: 'SlideShare', + functional: true, match: { regex: '^(?:https?:\\/\\/(?:www\\.)?)slideshare\\.net\\/.+', }, @@ -437,6 +422,7 @@ module.exports = { youtubeVideoBehavior: { name: 'youtubeVideoBehavior', displayName: 'Youtube', + functional: true, match: { regex: '^(?:https?:\\/\\/(?:www\\.)?)?youtube\\.com\\/watch[?]v=.+', }, @@ -459,7 +445,7 @@ module.exports = { name: 'facebookUserFeed', displayName: 'Facebook Page', match: { - regex: '^https?:\\/\\/(www\\.)?facebook\\.com\\/[^\\/]+\\/?$', + regex: '^https?:\\/\\/(www\\.)?facebook\\.com\\/[^/]+\\/?$', }, description: 'Capture all items and comments in the Facebook page and scroll down to load more content where possible.', @@ -469,6 +455,7 @@ module.exports = { fulcrumEpubBehavior: { name: 'fulcrumEpubBehavior', displayName: 'Fulcrum Epub', + functional: true, match: { regex: 'https?:\\/\\/(www\\.)?fulcrum\\.org\\/epubs\\/.+', }, @@ -479,6 +466,7 @@ module.exports = { instagramOwnFeedBehavior: { name: 'instagramOwnFeedBehavior', displayName: 'Instagram User Feed', + functional: true, match: { regex: '^https?:\\/\\/(www\\.)?instagram\\.com(?:\\/)?$', }, @@ -490,9 +478,10 @@ module.exports = { instagramPostBehavior: { name: 'instagramPostBehavior', displayName: 'Instagram Post', + functional: true, match: { regex: - '^https?:\\/\\/(www\\.)?instagram\\.com\\/p\\/[^\\/]+(?:\\/)?$', + '^https?:\\/\\/(www\\.)?instagram\\.com\\/p\\/[^/]+(?:\\/)?$', }, description: 'Capture every image and/or video, retrieve all comments, and scroll down to load more.', @@ -502,9 +491,10 @@ module.exports = { instagramUserBehavior: { name: 'instagramUserBehavior', displayName: 'Instagram User Page', + functional: true, match: { regex: - '^https?:\\/\\/(www\\.)?instagram\\.com\\/[^\\/]+(?:\\/(?:[?].+)?(?:tagged(?:\\/)?)?)?$', + '^https?:\\/\\/(www\\.)?instagram\\.com\\/[^/]+(?:\\/(?:[?].+)?(?:tagged(?:\\/)?)?)?$', }, description: 'Capture all stories, images, videos and comments on user’s page.', @@ -514,9 +504,10 @@ module.exports = { soundCloudArtistBehavior: { name: 'soundCloudArtistBehavior', displayName: 'Soundcloud Profile', + functional: true, match: { regex: - '^(?:https?:\\/\\/(?:www\\.)?)?soundcloud\\.com\\/(?!(?:discover|stream))[^\\/]+(?:\\/(?:tracks|albums|sets|reposts))?(?:\\/)?$', + '^(?:https?:\\/\\/(?:www\\.)?)?soundcloud\\.com\\/(?!(?:discover|stream))[^/]+(?:\\/(?:tracks|albums|sets|reposts))?(?:\\/)?$', }, description: 'Capture every track on Soundcloud profile.', updated: '2019-08-21T14:52:23-07:00', @@ -525,6 +516,7 @@ module.exports = { soundCloudEmbedBehavior: { name: 'soundCloudEmbedBehavior', displayName: 'Soundcloud Embed', + functional: true, match: { regex: '^https?:\\/\\/w\\.soundcloud\\.com\\/player\\/.+', }, @@ -532,36 +524,25 @@ module.exports = { updated: '2019-08-21T14:52:23-07:00', fileName: 'soundcloudEmbedBehavior.js', }, - twitterHashTagsBehavior: { - name: 'twitterHashTagsBehavior', - displayName: 'Twitter Hashtag', - match: { - regex: - '^(?:https?:\\/\\/(?:www\\.)?)?twitter\\.com\\/hashtag\\/[^?]+.*', - }, - description: - 'Capture every tweet in hashtag search, including embedded videos, images and replies.', - updated: '2019-08-21T14:52:23-07:00', - fileName: 'twitterHashTagsBehavior.js', - }, twitterTimelineBehavior: { name: 'twitterTimelineBehavior', displayName: 'Twitter Timeline', + functional: true, match: { - regex: - '^(?:https?:[\\/]{2}(?:www[.])?)?twitter[.]com[\\/]?(?:[^\\/]+[\\/]?)?$', + regex: '^(?:https?:[/]{2}(?:www[.])?)?twitter[.]com[/]?.*', }, description: - 'Capture every tweet, including embedded videos, images, replies and/or related tweets in thread.', - updated: '2019-08-21T14:52:23-07:00', - fileName: 'twitterTimelineBehavior.js', + 'Capture every tweet, including quotes, embedded videos, images, replies and/or related tweets in thread.', + updated: '2020-04-27T00:00:00Z', + fileName: 'twitterTwitterAllBehavior.js', }, yahooGroupConvoMessagesBehavior: { name: 'yahooGroupConvoMessagesBehavior', displayName: 'Yahoo Group Conversation Messages', + functional: true, match: { regex: - '^https?:\\/\\/(?:www\\.)?groups\\.yahoo\\.com\\/neo\\/groups\\/[^\\/]+\\/conversations\\/messages(?:[?].+)?$', + '^https?:\\/\\/(?:www\\.)?groups\\.yahoo\\.com\\/neo\\/groups\\/[^/]+\\/conversations\\/messages(?:[?].+)?$', }, description: 'Views conversation messages of a Yahoo Group', updated: '2019-10-23T15:04:10-04:00', diff --git a/test/status/README.md b/test/status/README.md new file mode 100644 index 0000000..8156550 --- /dev/null +++ b/test/status/README.md @@ -0,0 +1,35 @@ +Prerequisites: + +Python 2.x + +``` +pip install pywb +``` + +To test all behaviors, run + +``` +node all.js +``` + +You can test a single behavior by doing + +``` +./test-one-behavior.sh behaviorMetadataName +``` + +Where behaviorMetadataName is `test.metadata.name` found in `../tests/helpers/testedValues.js` + + +### Troublehsotoing + +If 8080 port already in use: + +```sh +$ ps -ef | grep wayback +okdistr+ 15492 3991 0 16:28 pts/9 00:00:00 /usr/bin/python3 /home/okdistribute/.local/bin/wayback --enable-auto-fetch --live --proxy-record --proxy slideShareBehavior -p 8080 +okdistr+ 16105 17956 0 16:30 pts/9 00:00:00 grep --color=auto wayback + +$ kill 15492 +``` + diff --git a/test/status/all.js b/test/status/all.js new file mode 100644 index 0000000..77410dc --- /dev/null +++ b/test/status/all.js @@ -0,0 +1,20 @@ +const { tests } = require('../helpers/testedValues') +const child = require('child_process') +const series = require('run-series') + +const tasks = [] + +tests.forEach((test) => { + tasks.push((done) => { + console.log('spawning', test.metadata.name) + var proc = child.spawn('bash', ['test-one-behavior.sh', test.metadata.name]) + proc.stderr.pipe(process.stderr) + proc.stdout.pipe(process.stdout) + proc.on('exit', () => done()) + }) +}) + +series(tasks, (err) => { + if (err) throw err + console.log('All done!') +}) diff --git a/test/_withPage.js b/test/status/lib/_withPage.js similarity index 69% rename from test/_withPage.js rename to test/status/lib/_withPage.js index afca533..8587ba7 100644 --- a/test/_withPage.js +++ b/test/status/lib/_withPage.js @@ -1,8 +1,9 @@ const puppeteer = require('puppeteer'); -export default async (t, run) => { +module.exports = async (t, run) => { const browser = await puppeteer.launch({ - ignoreHTTPSErrors: true + ignoreHTTPSErrors: true, + args: [ '--proxy-server=http://127.0.0.1:8080' ] }); const page = await browser.newPage({ waitUntil: 'networkIdle' diff --git a/test/status/lib/clean.sh b/test/status/lib/clean.sh new file mode 100755 index 0000000..a551960 --- /dev/null +++ b/test/status/lib/clean.sh @@ -0,0 +1 @@ +rm -rf collections templates static proxy-certs diff --git a/test/status/lib/one.js b/test/status/lib/one.js new file mode 100644 index 0000000..bbb651d --- /dev/null +++ b/test/status/lib/one.js @@ -0,0 +1,48 @@ +import { serial as test } from 'ava'; +import rp from 'request-promise-native'; +import crypto from 'crypto' +import { loadBehavior } from '../../helpers/utils'; +import { tests } from '../../helpers/testedValues'; +import startServer from '../../helpers/testServer'; +import withPage from './_withPage'; + +const WR_SELECTOR = 'WEBRECORDER_SELECTOR_TEST_' + crypto.randomBytes(4).toString('hex') +let server; + +test.before(async t => { + server = await startServer(); +}); + +test.after.always(t => { + t.timeout(60 * 1000); + return server.close(); +}); + +for (const aTest of tests) { + test(aTest.metadata.name, + withPage, async (t, page) => { + const response = await rp(aTest.behaviorURL); + var scriptToInject = await loadBehavior(aTest.metadata.fileName); + scriptToInject += createSelectorScript() + await page.goto(aTest.url); + await page.evaluate(scriptToInject) + // TODO: remove the waitFor(10000) once the WR_SELECTOR + // is created after the END of the behavior + await page.waitFor(10000); + await page.waitForSelector('#' + WR_SELECTOR); + t.pass() + }); +} + + +// This helps us know that the script was run on the page, +// TODO: it could be improved by making sure it's only +// run AFTER the behavior has completed. Is there a way to hook into +// that inside of the behaviors? +function createSelectorScript () { + return `var el = document.createElement("div"); +el.setAttribute('id', "${WR_SELECTOR}"); +el.innerHTML = "${WR_SELECTOR}"; +document.body.parentElement.appendChild(el); +` +} diff --git a/test/status/lib/output-status.js b/test/status/lib/output-status.js new file mode 100644 index 0000000..ef2b7d9 --- /dev/null +++ b/test/status/lib/output-status.js @@ -0,0 +1,23 @@ +const CDXJReader = require('cdxj') +const path = require('path') +const through = require('through2') +const pump = require('pump') + +const COLLECTION = process.argv[2] + +const CDXJ_PATH = path.join(__dirname, 'collections', COLLECTION, 'indexes', 'index.cdxj') + +const cdxjStream = CDXJReader.createReadStream(CDXJ_PATH) + +var parseEntries = through.obj((cdxjEntry, enc, next) => { + console.log(`The URL in surt form for this entry is: ${cdxjEntry.surt}`) + console.log(`The raw datetime for this entry is: ${cdxjEntry.dt}`) + console.log(`The json data for this entry is: ${JSON.stringify(cdxjEntry.json)}`) + next(null, cdxjEntry) +}) + +pump(cdxjStream, parseEntries, (err) => { + if (err) throw err +}) + + diff --git a/test/status/test-one-behavior.sh b/test/status/test-one-behavior.sh new file mode 100755 index 0000000..52184af --- /dev/null +++ b/test/status/test-one-behavior.sh @@ -0,0 +1,8 @@ +kill $(ps aux | grep 'wayback --enable-auto-fetch' | awk '{print $2}') +wb-manager init $1 +wayback --enable-auto-fetch --live --proxy-record --proxy $1 -p 8080 & endlessloop_pid=$! +echo $endlessloop_pid +echo $1 +../../node_modules/.bin/ava --verbose lib/one.js --match $1 +# node lib/output-status.js $1 +kill "$endlessloop_pid" diff --git a/test/test-behavior-api.js b/test/test-behavior-api.js index 7087532..3ca279f 100644 --- a/test/test-behavior-api.js +++ b/test/test-behavior-api.js @@ -3,14 +3,11 @@ import rp from 'request-promise-native'; import startServer from './helpers/testServer'; import { tests, allResult, defaultBMD } from './helpers/testedValues'; import { loadBehavior } from './helpers/utils'; -import withPage from './_withPage' import fs from 'fs' import path from 'path' const output = path.join(__dirname, 'output') -var stream = fs.createWriteStream(output) - /** * @type {fastify.FastifyInstance} */ @@ -26,17 +23,6 @@ test.after.always(t => { }); for (const aTest of tests) { - test(`Retrieving the behavior js for "${ - aTest.name - }" by URL should work`, withPage, async (t, page) => { - const response = await rp(aTest.behaviorURL); - const expectedBehavior = await loadBehavior(aTest.metadata.fileName); - t.is(response, expectedBehavior); - console.log(expectedBehavior) - await page.goto(aTest.url); - await page.addScriptTag({content: expectedBehavior}); - }); - test(`Retrieving the behavior info for "${ aTest.name }" by URL should work`, async t => { diff --git a/yarn.lock b/yarn.lock index cbf89d1..86ee2d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -451,6 +451,13 @@ resolved "https://registry.yarnpkg.com/@types/swagger-schema-official/-/swagger-schema-official-2.0.18.tgz#5ce35ec9949ff5b5bfec69b83f5bc3dd63a4dd97" integrity sha512-zQsYKjtPf7Hvnp6KR4DTypXZ12tlH7k670d4QXuxzkofefBy9e2GwRKyV06lgTi3qw/OH/JFTDYe/x3uQmnusQ== +"@types/yauzl@^2.9.1": + version "2.9.1" + resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.9.1.tgz#d10f69f9f522eef3cf98e30afb684a1e1ec923af" + integrity sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA== + dependencies: + "@types/node" "*" + abab@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" @@ -488,6 +495,11 @@ acorn@^7.1.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== +agent-base@5: + version "5.1.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c" + integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== + ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5, ajv@^6.8.1: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" @@ -880,6 +892,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +base64-js@^1.0.2: + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== + bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" @@ -892,6 +909,27 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== +binary-split@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/binary-split/-/binary-split-1.0.5.tgz#e1ec5645b65d7de6b1a73352d1165b57c6fb14f6" + integrity sha512-AQ5fcBrUU5hoIafkEvNKqxT+2xbqlSqAXef6IdCQr5wpHu9E7NGM6rTAlYJYbtxvAvjfx8nJkBy6rNlbPPI+Pw== + dependencies: + through2 "^2.0.3" + +bl@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.2.tgz#52b71e9088515d0606d9dd9cc7aa48dc1f98e73a" + integrity sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +bluebird@^3.5.0: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + bluebird@^3.5.5: version "3.5.5" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" @@ -936,11 +974,24 @@ braces@^3.0.1, braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" +buffer-crc32@~0.2.3: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= + buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== +buffer@^5.2.1, buffer@^5.5.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" + integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + bufferutil@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.1.tgz#3a177e8e5819a1243fe16b63a199951a7ad8d4a7" @@ -1010,6 +1061,18 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +cdxj@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cdxj/-/cdxj-1.0.2.tgz#e6055124620d19aafae107bc2789f4a56492696b" + integrity sha1-5gVRJGINGar64Qe8J4n0pWSSaWs= + dependencies: + binary-split "^1.0.3" + bluebird "^3.5.0" + eventemitter3 "^2.0.3" + fs-extra "^3.0.1" + through2 "^2.0.3" + untildify "^3.0.2" + chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1124,6 +1187,11 @@ chokidar@^3.2.1: optionalDependencies: fsevents "~2.1.0" +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + "chrome-remote-interface-extra@git+https://github.com/N0taN3rd/chrome-remote-interface-extra.git#pv-1.17.0-post": version "1.1.1" resolved "git+https://github.com/N0taN3rd/chrome-remote-interface-extra.git#38f9eb98cc8a93560578a2a56318563312f0e5d7" @@ -1430,7 +1498,7 @@ debug@2.6.9, debug@^2.6.8: dependencies: ms "2.0.0" -debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -1694,6 +1762,13 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" +end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + entities@1.0: version "1.0.0" resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" @@ -2033,6 +2108,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +eventemitter3@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-2.0.3.tgz#b5e1079b59fb5e1ba2771c0a993be060a58c99ba" + integrity sha1-teEHm1n7XhuidxwKmTvgYKWMmbo= + eventemitter3@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" @@ -2070,6 +2150,17 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" +extract-zip@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" + integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg== + dependencies: + debug "^4.1.1" + get-stream "^5.1.0" + yauzl "^2.10.0" + optionalDependencies: + "@types/yauzl" "^2.9.1" + extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -2205,6 +2296,13 @@ fastq@^1.6.0: dependencies: reusify "^1.0.0" +fd-slicer@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" + integrity sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4= + dependencies: + pend "~1.2.0" + figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -2345,6 +2443,11 @@ fresh@0.5.2: resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + fs-extra@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950" @@ -2363,6 +2466,15 @@ fs-extra@5.0.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291" + integrity sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE= + dependencies: + graceful-fs "^4.1.2" + jsonfile "^3.0.0" + universalify "^0.1.0" + fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -2655,6 +2767,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +https-proxy-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b" + integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg== + dependencies: + agent-base "5" + debug "4" + humanize-url@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/humanize-url/-/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff" @@ -2678,6 +2798,11 @@ iconv-lite@^0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +ieee754@^1.1.4: + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== + ignore-by-default@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" @@ -2737,7 +2862,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3146,6 +3271,13 @@ jsonfile@^2.1.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" + integrity sha1-pezG9l9T9mLEQVx2daAzHQmS7GY= + optionalDependencies: + graceful-fs "^4.1.6" + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -3502,6 +3634,11 @@ mime@1.4.1: resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== +mime@^2.0.3: + version "2.4.6" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1" + integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA== + mime@^2.4.4: version "2.4.4" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" @@ -3547,6 +3684,11 @@ minimist@1.2.0, minimist@^1.1.0, minimist@^1.2.0: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= +mkdirp-classic@^0.5.2: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -3910,6 +4052,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= + perf-regexes@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/perf-regexes/-/perf-regexes-1.0.1.tgz#6da1d62f5a94bf9353a0451bccacf69068b75d0b" @@ -4035,7 +4182,7 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -progress@^2.0.0: +progress@^2.0.0, progress@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -4056,6 +4203,11 @@ proxy-addr@^2.0.4: forwarded "~0.1.2" ipaddr.js "1.9.0" +proxy-from-env@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" @@ -4084,6 +4236,22 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +puppeteer@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-3.3.0.tgz#95839af9fdc0aa4de7e5ee073a4c0adeb9e2d3d7" + integrity sha512-23zNqRltZ1PPoK28uRefWJ/zKb5Jhnzbbwbpcna2o5+QMn17F0khq5s1bdH3vPlyj+J36pubccR8wiNA/VE0Vw== + dependencies: + debug "^4.1.0" + extract-zip "^2.0.0" + https-proxy-agent "^4.0.0" + mime "^2.0.3" + progress "^2.0.1" + proxy-from-env "^1.0.0" + rimraf "^3.0.2" + tar-fs "^2.0.0" + unbzip2-stream "^1.3.3" + ws "^7.2.3" + qs@^6.9.0: version "6.9.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.0.tgz#d1297e2a049c53119cb49cca366adbbacc80b409" @@ -4403,6 +4571,13 @@ rimraf@2.6.3, rimraf@^2.6.2, rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + rollup-plugin-alias@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-2.0.1.tgz#2f11b0a09e0bab1bbd1f130536fe99ef8f35c0dd" @@ -4457,6 +4632,11 @@ run-parallel@^1.1.9: resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== +run-series@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.8.tgz#2c4558f49221e01cd6371ff4e0a1e203e460fc36" + integrity sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg== + rxjs@^6.4.0: version "6.5.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" @@ -4873,6 +5053,27 @@ taffydb@2.7.3: resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.7.3.tgz#2ad37169629498fca5bc84243096d3cde0ec3a34" integrity sha1-KtNxaWKUmPylvIQkMJbTzeDsOjQ= +tar-fs@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.0.tgz#d1cdd121ab465ee0eb9ccde2d35049d3f3daf0d5" + integrity sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.0.0" + +tar-stream@^2.0.0: + version "2.1.3" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.3.tgz#1e2022559221b7866161660f118255e20fa79e41" + integrity sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA== + dependencies: + bl "^4.0.1" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + term-size@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" @@ -4885,7 +5086,7 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -through2@^2.0.2, through2@~2.0.3: +through2@^2.0.2, through2@^2.0.3, through2@~2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== @@ -4893,7 +5094,7 @@ through2@^2.0.2, through2@~2.0.3: readable-stream "~2.3.6" xtend "~4.0.1" -through@^2.3.6: +through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -5060,6 +5261,14 @@ uid2@0.0.3: resolved "https://registry.yarnpkg.com/uid2/-/uid2-0.0.3.tgz#483126e11774df2f71b8b639dcd799c376162b82" integrity sha1-SDEm4Rd03y9xuLY53NeZw3YWK4I= +unbzip2-stream@^1.3.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" + integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== + dependencies: + buffer "^5.2.1" + through "^2.3.8" + unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" @@ -5109,6 +5318,11 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +untildify@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9" + integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA== + update-notifier@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-3.0.1.tgz#78ecb68b915e2fd1be9f767f6e298ce87b736250" @@ -5271,6 +5485,11 @@ ws@^7.0.0: dependencies: async-limiter "^1.0.0" +ws@^7.2.3: + version "7.3.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8" + integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA== + xdg-basedir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" @@ -5302,3 +5521,11 @@ yargs-parser@^10.0.0: integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== dependencies: camelcase "^4.1.0" + +yauzl@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" + integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk= + dependencies: + buffer-crc32 "~0.2.3" + fd-slicer "~1.1.0" From bef611b290bc725af7e639e7d65a5e751fdd418b Mon Sep 17 00:00:00 2001 From: okdistribute <633012+okdistribute@users.noreply.github.com> Date: Thu, 24 Sep 2020 14:17:16 -0700 Subject: [PATCH 4/6] fix: update readme for installing pywb --- test/status/.gitignore | 1 + test/status/README.md | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 test/status/.gitignore diff --git a/test/status/.gitignore b/test/status/.gitignore new file mode 100644 index 0000000..0a764a4 --- /dev/null +++ b/test/status/.gitignore @@ -0,0 +1 @@ +env diff --git a/test/status/README.md b/test/status/README.md index 8156550..06fba51 100644 --- a/test/status/README.md +++ b/test/status/README.md @@ -1,11 +1,31 @@ -Prerequisites: +## Installation -Python 2.x +1. Install python3 +2. Install pip and virtualenv + +``` +python3 -m pip install --user --upgrade pip + +python3 -m pip install --user virtualenv +``` + +3. Create virtualenv ``` +python3 -m venv env +source env/bin/activate pip install pywb ``` +## Development + +Every time you open a new terminal and want to run the tests, you must activate +the python virtual environment: + +``` +source env/bin/activate +``` + To test all behaviors, run ``` From d848791d0293ca2be2f8e81bcf7bb08abd925a9e Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 24 Sep 2020 11:33:38 -1000 Subject: [PATCH 5/6] WIP --- package.json | 2 +- test/status/all.js | 11 ++++++++++- test/status/test-one-behavior.sh | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 68ae005..2f4d72d 100755 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "generate-stdlib-index": "node ./bin/cli-stdlib --gen-index", "generate-test-helper-values": "node ./internal/generateTestHelperValues.js", "publish-docs": "gh-pages -d docs", - "test": "ava --verbose", + "test": "node test/status/all.js", "format": "prettier --write test/**/*.js lib/**/*.js internal/**/*.js api/**/*.js behaviors/**/*.js", "updateBehaviorUpdatedDates": "node ./internal/updateBehaviorUpdatedTimes.js" }, diff --git a/test/status/all.js b/test/status/all.js index 77410dc..ab2c5c3 100644 --- a/test/status/all.js +++ b/test/status/all.js @@ -1,3 +1,12 @@ +/* + +if errors does it exit? + +*/ + + + + const { tests } = require('../helpers/testedValues') const child = require('child_process') const series = require('run-series') @@ -7,7 +16,7 @@ const tasks = [] tests.forEach((test) => { tasks.push((done) => { console.log('spawning', test.metadata.name) - var proc = child.spawn('bash', ['test-one-behavior.sh', test.metadata.name]) + var proc = child.spawn('bash', ['./test/status/test-one-behavior.sh', test.metadata.name]) proc.stderr.pipe(process.stderr) proc.stdout.pipe(process.stdout) proc.on('exit', () => done()) diff --git a/test/status/test-one-behavior.sh b/test/status/test-one-behavior.sh index 52184af..c976891 100755 --- a/test/status/test-one-behavior.sh +++ b/test/status/test-one-behavior.sh @@ -3,6 +3,6 @@ wb-manager init $1 wayback --enable-auto-fetch --live --proxy-record --proxy $1 -p 8080 & endlessloop_pid=$! echo $endlessloop_pid echo $1 -../../node_modules/.bin/ava --verbose lib/one.js --match $1 +./node_modules/.bin/ava --verbose ./test/status/lib/one.js --match $1 # node lib/output-status.js $1 kill "$endlessloop_pid" From a1bbf5b3c198b6d6ec8854177d70727aa41911c3 Mon Sep 17 00:00:00 2001 From: okdistribute <633012+okdistribute@users.noreply.github.com> Date: Tue, 20 Oct 2020 12:58:11 -1000 Subject: [PATCH 6/6] fix: generate indexes from wb-manager --- test/status/test-one-behavior.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/status/test-one-behavior.sh b/test/status/test-one-behavior.sh index c976891..0461488 100755 --- a/test/status/test-one-behavior.sh +++ b/test/status/test-one-behavior.sh @@ -5,4 +5,5 @@ echo $endlessloop_pid echo $1 ./node_modules/.bin/ava --verbose ./test/status/lib/one.js --match $1 # node lib/output-status.js $1 +wb-manager reindex $1 kill "$endlessloop_pid"