Run Integration Tests in Browser (#1468)

* ci: Adds github actions testing for webpacked integration test
This commit is contained in:
Nathan Nichols
2021-08-02 14:29:35 -07:00
committed by GitHub
parent 25a2bcd3be
commit 76780c8a8e
9 changed files with 3518 additions and 3142 deletions

View File

@@ -0,0 +1,30 @@
import assert from 'assert'
import puppeteer from 'puppeteer'
describe("Browser Tests", () => {
it("Integration Tests", async () => {
const browser = await puppeteer.launch({"headless": true});
try {
const page = await browser.newPage().catch();
await page.goto(`file:///${__dirname}/../localintegrationrunner.html`);
await page.waitForFunction('document.querySelector("body").innerText.includes("submit multisigned transaction")');
const fails = await page.evaluate(() => {
return document.querySelector('.failures').textContent
})
const passes = await page.evaluate(() => {
return document.querySelector('.passes').textContent
})
assert.equal(fails, "failures: 0")
assert.notEqual(passes, "passes: 0")
} catch (err) {
console.log(err)
assert(false)
} finally {
await browser.close();
}
}).timeout(40000)
})

View File

@@ -12,10 +12,12 @@ import {isValidSecret} from 'ripple-api/common/utils'
const TIMEOUT = 20000
const INTERVAL = 1000 // how long to wait between checks for validated ledger
const HOST = process.env.HOST ?? "127.0.0.1"
const HOST = process.env.HOST ?? "0.0.0.0"
const PORT = process.env.PORT ?? "6006"
const serverUrl = `ws://${HOST}:${PORT}`
console.log(serverUrl)
function acceptLedger(api) {
return api.connection.request({command: 'ledger_accept'})
}

View File

@@ -3,13 +3,13 @@
<meta charset="utf-8">
<!-- encoding must be set for mocha's special characters to render properly -->
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
<script src="./vendor/lodash.min.js"></script>
</head>
<body>
<div id="deb"></div>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="hacks/phantomhacks.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.20/lodash.min.js" integrity="sha512-90vH1Z83AJY9DmlWa8WkjkV79yfS2n2Oxhsi2dZbIv0nC4E6m5AbH8Nh156kkM7JePmqD6tcZsfad1ueoaovww==" crossorigin="anonymous"></script>
<script src="../build/ripple-latest.js"></script>
<script>
if (window.initMochaPhantomJS) {
@@ -18,7 +18,7 @@
mocha.ui('bdd')
</script>
<script src="../test-compiled-for-web/integration/integration-test.js"></script>
<script src="../test-compiled-for-web/integration-test.js"></script>
<script>
mocha.run()

View File

@@ -1,6 +1,3 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"noEmit": true,
}
}