Skip to main content
Sign in
Snippets Groups Projects
Commit 5268bb10 authored by ESTELLON Bertrand's avatar ESTELLON Bertrand
Browse files

Correction des tests du TD45

parent f0b5c246
Branches
No related tags found
No related merge requests found
......@@ -69,7 +69,11 @@ if (progression >= 27) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const consoleLogs = [];
page.on('console', async consoleObj => { consoleLogs.push(await consoleObj.args()[0]?.jsonValue()) });
page.on('console', async consoleObj => {
const line = await consoleObj.args()[0]?.jsonValue();
if (line == undefined) return;
consoleLogs.push(line)
});
await page.goto(`http://localhost:${fastify.server.address().port}`);
const content = await page.content();
const dom = new JSDOM(content);
......@@ -96,6 +100,7 @@ if (progression >= 28 && progression < 30) {
const args = consoleObj.args();
const arg0 = args[0];
const json = await arg0.jsonValue();
if (json == undefined) return;
consoleLogs.push(json)
});
await page.goto(`http://localhost:${fastify.server.address().port}`);
......@@ -122,6 +127,7 @@ if (progression == 29) {
const args = consoleObj.args();
const arg0 = args[0];
const json = await arg0.jsonValue();
if (json == undefined) return;
consoleLogs.push(json)
});
await page.goto(`http://localhost:${fastify.server.address().port}`);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment