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

Correction des tests du TD45

parent f0b5c246
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,11 @@ if (progression >= 27) { ...@@ -69,7 +69,11 @@ if (progression >= 27) {
const browser = await puppeteer.launch(); const browser = await puppeteer.launch();
const page = await browser.newPage(); const page = await browser.newPage();
const consoleLogs = []; 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}`); await page.goto(`http://localhost:${fastify.server.address().port}`);
const content = await page.content(); const content = await page.content();
const dom = new JSDOM(content); const dom = new JSDOM(content);
...@@ -96,6 +100,7 @@ if (progression >= 28 && progression < 30) { ...@@ -96,6 +100,7 @@ if (progression >= 28 && progression < 30) {
const args = consoleObj.args(); const args = consoleObj.args();
const arg0 = args[0]; const arg0 = args[0];
const json = await arg0.jsonValue(); const json = await arg0.jsonValue();
if (json == undefined) return;
consoleLogs.push(json) consoleLogs.push(json)
}); });
await page.goto(`http://localhost:${fastify.server.address().port}`); await page.goto(`http://localhost:${fastify.server.address().port}`);
...@@ -122,6 +127,7 @@ if (progression == 29) { ...@@ -122,6 +127,7 @@ if (progression == 29) {
const args = consoleObj.args(); const args = consoleObj.args();
const arg0 = args[0]; const arg0 = args[0];
const json = await arg0.jsonValue(); const json = await arg0.jsonValue();
if (json == undefined) return;
consoleLogs.push(json) consoleLogs.push(json)
}); });
await page.goto(`http://localhost:${fastify.server.address().port}`); 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 register or to comment