From 6d6dc1e8ba59a0f15241ec05ac2dbea8d92bca3d Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sat, 4 Jan 2020 14:22:25 -0800 Subject: [PATCH] Experiment with action to run IA tests (#961) * Experiment with action to run IA tests * Split out IA tests * Don't try on push * Also on push * Make an error an error * Introduce failing test * Return an error exit code * Remove failing test --- .github/workflows/ia-integration-tests.yml | 23 +++++++++++++++++++ .../archive-org-integration-tests/index.js | 12 ++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ia-integration-tests.yml mode change 100644 => 100755 experiments/archive-org-integration-tests/index.js diff --git a/.github/workflows/ia-integration-tests.yml b/.github/workflows/ia-integration-tests.yml new file mode 100644 index 00000000..33a3a51e --- /dev/null +++ b/.github/workflows/ia-integration-tests.yml @@ -0,0 +1,23 @@ +name: "Internet Archvie Integration Tests" + +on: + 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 experiments/archive-org-integration-tests + yarn + node ./index.js + env: + CI: true diff --git a/experiments/archive-org-integration-tests/index.js b/experiments/archive-org-integration-tests/index.js old mode 100644 new mode 100755 index 4f1f0b4a..f1b086e1 --- a/experiments/archive-org-integration-tests/index.js +++ b/experiments/archive-org-integration-tests/index.js @@ -49,7 +49,7 @@ async function testPage({ url, name, firstTrackText }) { } catch (e) { log(`🛑 Errored in [${name}]. Wrote screenshot to ./error.png`); await page.screenshot({ path: "error.png", fullPage: true }); - console.error(e); + throw e; } finally { log("DONE"); await browser.close(); @@ -87,4 +87,12 @@ async function main() { }); } -main(); +(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); + } +})();