mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Remove internet archive integration tests
This commit is contained in:
parent
48ef4eeff2
commit
c0d4960dd3
6 changed files with 4 additions and 204 deletions
29
.github/workflows/ia-integration-tests.yml
vendored
29
.github/workflows/ia-integration-tests.yml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
name: "Internet Archive Integration Tests"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# schedule:
|
||||
# - cron: "0 8 * * *"
|
||||
|
||||
jobs:
|
||||
ia-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Run Tests
|
||||
run: |
|
||||
cd packages/archive-org-webamp-integration-tests
|
||||
yarn
|
||||
node ./index.js
|
||||
env:
|
||||
CI: true
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: error
|
||||
path: packages/webamp/experiments/archive-org-integration-tests/error.png
|
||||
|
|
@ -24,7 +24,6 @@ Webamp uses a [monorepo](https://en.wikipedia.org/wiki/Monorepo) approach, so in
|
|||
- [`packages/skin-database`](https://github.com/captbaritone/webamp/tree/master/packages/skin-database): The server component of https://skins.webamp.org which also runs our [Twitter bot](https://twitter.com/winampskins), and a Discord bot for our community chat
|
||||
- [`packages/skin-museum-client`](https://github.com/captbaritone/webamp/tree/master/packages/skin-museum-client): The front-end component of https://skins.webamp.org.
|
||||
- [`packages/winamp-eqf`](https://github.com/captbaritone/webamp/tree/master/packages/winamp-eqf): An NPM module for parsing and constructing Winamp equalizer preset files (`.eqf`)
|
||||
- [`packages/archive-org-webamp-integration-tests`](https://github.com/captbaritone/webamp/tree/master/packages/archive-org-webamp-integration-tests): An integration that confirms that archive.org's Webamp integration is working as expected
|
||||
- [`packages/webamp-modern`](https://github.com/captbaritone/webamp/tree/master/packages/webamp-modern): A prototype exploring rendering "modern" Winamp skins in the browser
|
||||
- [`examples`](https://github.com/captbaritone/webamp/tree/master/examples): A few examples showing how to use the NPM module
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
# Archive.org Webamp Integration Test
|
||||
|
||||
This package contains an automated test to ensure that the [Webamp](https://webamp.org) integration on https://archive.org is still working correectly. It's run twice a day via a GitHub Action, which can be found [here](../../.github/workflows/ia-integration-tests.yml).
|
||||
## Run
|
||||
|
||||
```sh
|
||||
yarn
|
||||
node index.js
|
||||
```
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
const puppeteer = require("puppeteer");
|
||||
|
||||
// Handle a few different cases since specialized pages use specialized classes.
|
||||
const webampButtonSelector =
|
||||
".js-webamp-use_skin_for_audio_items, .webamp-link";
|
||||
|
||||
// Create our own log function so we can mute it if we want
|
||||
function log(message) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
const TIMEOUT = 10000;
|
||||
|
||||
async function expectSelector(page, selector) {
|
||||
log(`Waiting for selector ${selector}...`);
|
||||
await page.waitForSelector(selector, { visible: true, timeout: TIMEOUT });
|
||||
log(`Found selector ✅`);
|
||||
}
|
||||
|
||||
async function testPage({ url, name, firstTrackText }) {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
try {
|
||||
log(`🏁 [${name}] ${url}`);
|
||||
await page.goto(url);
|
||||
await expectSelector(page, webampButtonSelector);
|
||||
log("Going to click the Webamp button");
|
||||
// For some reason `page.click` often fails with `Error: Node is either not
|
||||
// visible or not an HTMLElement` so we use `page.evaluate` instead.
|
||||
// https://stackoverflow.com/a/52336777
|
||||
// await page.click(webampButtonSelector, { timeout: TIMEOUT });
|
||||
await page.evaluate(() => {
|
||||
document
|
||||
.querySelector(".js-webamp-use_skin_for_audio_items, .webamp-link")
|
||||
.click();
|
||||
});
|
||||
await expectSelector(page, "#webamp #main-window");
|
||||
log("Looking for first track...");
|
||||
const firstTrack = await page.$(".track-cell.current");
|
||||
if (firstTrack == null) {
|
||||
throw new Error("Could not find first track");
|
||||
}
|
||||
log("Getting text of first track...");
|
||||
const actualFirstTrackText = await page.evaluate(
|
||||
(_) => _.textContent,
|
||||
firstTrack
|
||||
);
|
||||
|
||||
if (!actualFirstTrackText.includes(firstTrackText)) {
|
||||
throw new Error(
|
||||
`Could not find track title '${firstTrackText}' in "${actualFirstTrackText}"`
|
||||
);
|
||||
}
|
||||
|
||||
log("Clicking play...");
|
||||
await page.click("#webamp #main-window #play", { timeout: TIMEOUT });
|
||||
await expectSelector(page, "#webamp #main-window.play");
|
||||
log("✅ Success! Test passed.");
|
||||
} catch (e) {
|
||||
log(`🛑 Errored in [${name}]. Wrote screenshot to ./error.png`);
|
||||
await page.screenshot({ path: "error.png", fullPage: true });
|
||||
throw e;
|
||||
} finally {
|
||||
log("DONE");
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
async function testPageAndRetry(options) {
|
||||
let retries = 5;
|
||||
while (retries--) {
|
||||
try {
|
||||
await testPage(options);
|
||||
return;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (retries > 0) {
|
||||
console.warn(`Retrying... ${retries} retries left.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error("Failed to pass even after 5 retries");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await testPageAndRetry({
|
||||
name: "Popular",
|
||||
url: "https://archive.org/details/gd73-06-10.sbd.hollister.174.sbeok.shnf",
|
||||
firstTrackText: "Grateful Dead - Morning Dew",
|
||||
});
|
||||
await testPageAndRetry({
|
||||
name: "Regular",
|
||||
url: "https://archive.org/details/78_mambo-no.-5_perez-prado-and-his-orchestra-d.-perez-prado_gbia0009774b",
|
||||
firstTrackText: "Mambo No. 5",
|
||||
});
|
||||
await testPageAndRetry({
|
||||
name: "Samples Only",
|
||||
url: "https://archive.org/details/lp_smokey-and-the-bandit-2-original-soundtrac_various-brenda-lee-burt-reynolds-don-willi",
|
||||
firstTrackText: "Texas Bound And Flyin",
|
||||
});
|
||||
await testPageAndRetry({
|
||||
name: "Stream Only",
|
||||
url: "https://archive.org/details/cd_a-sweeter-music_sarah-cahill",
|
||||
firstTrackText: "Be Kind to One Another",
|
||||
});
|
||||
await testPageAndRetry({
|
||||
name: "Another",
|
||||
url: "https://archive.org/details/78_house-of-the-rising-sun_josh-white-and-his-guitar_gbia0001628b",
|
||||
firstTrackText: "House Of The Rising Sun",
|
||||
});
|
||||
}
|
||||
|
||||
(async function () {
|
||||
try {
|
||||
await main();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// Ensure process returns an error exit code so that other tools know the test failed.
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"name": "archive-org-integration-tests",
|
||||
"version": "1.0.0",
|
||||
"description": "Automated tests to ensure the Internet Archive's Webamp integration is working",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"prettier": {},
|
||||
"dependencies": {
|
||||
"puppeteer": "^3.0.4"
|
||||
}
|
||||
}
|
||||
37
yarn.lock
37
yarn.lock
|
|
@ -7143,11 +7143,6 @@ address@^1.0.1:
|
|||
resolved "https://registry.npmjs.org/address/-/address-1.2.2.tgz"
|
||||
integrity sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==
|
||||
|
||||
agent-base@5:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz"
|
||||
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
|
||||
|
||||
agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2:
|
||||
version "6.0.2"
|
||||
resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz"
|
||||
|
|
@ -12101,7 +12096,7 @@ extglob@^2.0.4:
|
|||
snapdragon "^0.8.1"
|
||||
to-regex "^3.0.1"
|
||||
|
||||
extract-zip@2.0.1, extract-zip@^2.0.0:
|
||||
extract-zip@2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz"
|
||||
integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==
|
||||
|
|
@ -14012,14 +14007,6 @@ https-proxy-agent@5, https-proxy-agent@5.0.1, https-proxy-agent@^5.0.0, https-pr
|
|||
agent-base "6"
|
||||
debug "4"
|
||||
|
||||
https-proxy-agent@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz"
|
||||
integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==
|
||||
dependencies:
|
||||
agent-base "5"
|
||||
debug "4"
|
||||
|
||||
https-proxy-agent@^7.0.2, https-proxy-agent@^7.0.3:
|
||||
version "7.0.4"
|
||||
resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz"
|
||||
|
|
@ -21222,7 +21209,7 @@ process-nextick-args@~2.0.0:
|
|||
resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
|
||||
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
||||
|
||||
progress@2.0.3, progress@^2.0.0, progress@^2.0.1:
|
||||
progress@2.0.3, progress@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz"
|
||||
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
||||
|
|
@ -21447,22 +21434,6 @@ puppeteer@^22.2.0:
|
|||
devtools-protocol "0.0.1262051"
|
||||
puppeteer-core "22.6.2"
|
||||
|
||||
puppeteer@^3.0.4:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.npmjs.org/puppeteer/-/puppeteer-3.3.0.tgz"
|
||||
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"
|
||||
|
||||
pure-rand@^6.0.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz"
|
||||
|
|
@ -24813,7 +24784,7 @@ unbox-primitive@^1.0.2:
|
|||
has-symbols "^1.0.3"
|
||||
which-boxed-primitive "^1.0.2"
|
||||
|
||||
unbzip2-stream@1.4.3, unbzip2-stream@^1.0.9, unbzip2-stream@^1.3.3:
|
||||
unbzip2-stream@1.4.3, unbzip2-stream@^1.0.9:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz"
|
||||
integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==
|
||||
|
|
@ -25956,7 +25927,7 @@ ws@8.7.0:
|
|||
resolved "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz"
|
||||
integrity sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==
|
||||
|
||||
ws@^7.2.3, ws@^7.3.0, ws@^7.3.1, ws@^7.4.4, ws@^7.4.5, ws@^7.4.6:
|
||||
ws@^7.3.0, ws@^7.3.1, ws@^7.4.4, ws@^7.4.5, ws@^7.4.6:
|
||||
version "7.5.9"
|
||||
resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz"
|
||||
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue