-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const console = require("node:console"); | ||
const {writeFile} = require("node:fs/promises"); | ||
const {createServer} = require("node:http"); | ||
const process = require("node:process"); | ||
const puppeteer = require("puppeteer"); | ||
const handler = require("serve-handler"); | ||
|
||
// Run the test suite. | ||
(async function main() { | ||
const browser = await puppeteer.launch(); | ||
const server = createServer((req, res) => handler(req, res, {public: "var"})); | ||
|
||
const page = await browser.newPage(); | ||
page.on("console", message => console.log(message.text())); | ||
page.on("pageerror", error => console.error(error)); | ||
|
||
await page.evaluate(() => console.log(navigator.userAgent)); | ||
await page.exposeFunction("exit", async code => { | ||
await browser.close(); | ||
server.close(); | ||
process.exit(code); | ||
}); | ||
|
||
await writeFile("var/tests.html", ` | ||
<!DOCTYPE html> | ||
<html dir="ltr" lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script defer src="tests.js"></script> | ||
</head> | ||
<body></body> | ||
</html> | ||
`); | ||
|
||
server.listen(0, "127.0.0.1", () => { | ||
const {address, port} = server.address(); | ||
page.goto(`http://${address}:${port}/tests.html`); | ||
}); | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
--library tink_unittest | ||
--main RunTests | ||
share/build.hxml | ||
--cmd node etc/puppeteer.mjs | ||
--cmd node etc/puppeteer.js |