Files
xahau.js/test/browser/browserIntegration.ts
Nathan Nichols 9e3654d7d6 fix: fix error handling in generateFaucetWallet (#1671)
* fix: handle error correctly in generateFaucetWallet
* test: Adds generateFaucetWallet integration + browser tests
2021-10-04 14:11:26 -04:00

47 lines
1.3 KiB
TypeScript

import path from 'path'
import { expect, assert } from 'chai'
import puppeteer from 'puppeteer'
const TIMEOUT = 60000
describe('Browser Tests', function () {
this.timeout(TIMEOUT)
it('Integration Tests', async function () {
const browser = await puppeteer.launch({ headless: true })
try {
const page = await browser.newPage().catch()
page.setDefaultNavigationTimeout(0)
await page.goto(
path.join('file:///', __dirname, '../localIntegrationRunner.html'),
)
await page.waitForFunction(
'document.querySelector("body").innerText.includes("submit multisigned transaction")',
{ timeout: TIMEOUT },
)
const fails = await page.evaluate(() => {
const element = document.querySelector('.failures')
return element == null ? null : element.textContent
})
const passes = await page.evaluate(() => {
const element = document.querySelector('.passes')
return element == null ? null : element.textContent
})
expect(fails).to.equal('failures: 0')
expect(passes).to.not.equal('passes: 0')
} catch (err) {
// eslint-disable-next-line no-console -- only prints if something goes wrong
console.log(err)
assert(false)
} finally {
await browser.close()
}
}).timeout(40000)
})