Files
xahau.js/test/browser/browserIntegration.ts
Mayukha Vadari 9d28540710 Lint integration test files and browser test files (#1612)
* clean up utils

* more cleanup

* remove client.sign

* remove unneeded tests

* remove unneeded infra

* move helper functions to separate files

* fix linter issues

* more cleanup

* make helper functions more generally useful

* fix test account funding

* add import note to README

* lint browser tests

* run eslint --fix
2021-09-14 17:14:34 -04:00

41 lines
1.2 KiB
TypeScript

import path from 'path'
import { expect, assert } from 'chai'
import puppeteer from 'puppeteer'
describe('Browser Tests', function () {
it('Integration Tests', async function () {
const browser = await puppeteer.launch({ headless: true })
try {
const page = await browser.newPage().catch()
await page.goto(
path.join('file:///', __dirname, '../localIntegrationRunner.html'),
)
await page.waitForFunction(
'document.querySelector("body").innerText.includes("submit multisigned transaction")',
)
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)
})