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

Modification des tests du TD45

parent 7672728f
Branches
No related tags found
No related merge requests found
...@@ -9,12 +9,14 @@ import puppeteer from 'puppeteer'; ...@@ -9,12 +9,14 @@ import puppeteer from 'puppeteer';
let ServerGame = null; let ServerGame = null;
let serverData = null; let serverData = null;
let data = undefined;
let Game = null; let Game = null;
let data = null;
async function asyncImport() { async function asyncImport() {
if (progression >= 28) { if (progression >= 28) {
Game = (await import('./static/game.js')).Game; Game = (await import('./static/game.js')).Game;
}
if (progression <= 47) {
data = (await import('./static/data.js')).data; data = (await import('./static/data.js')).data;
} }
if (progression >= 39) { if (progression >= 39) {
...@@ -69,11 +71,7 @@ if (progression >= 27) { ...@@ -69,11 +71,7 @@ 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 => { page.on('console', async consoleObj => { consoleLogs.push(await consoleObj.args()[0]?.jsonValue()) });
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);
...@@ -99,7 +97,6 @@ if (progression >= 28 && progression < 30) { ...@@ -99,7 +97,6 @@ if (progression >= 28 && progression < 30) {
page.on('console', async consoleObj => { page.on('console', async consoleObj => {
const args = consoleObj.args(); const args = consoleObj.args();
const arg0 = args[0]; const arg0 = args[0];
if (arg0 == undefined) return;
const json = await arg0.jsonValue(); const json = await arg0.jsonValue();
consoleLogs.push(json) consoleLogs.push(json)
}); });
...@@ -126,7 +123,6 @@ if (progression == 29) { ...@@ -126,7 +123,6 @@ if (progression == 29) {
page.on('console', async consoleObj => { page.on('console', async consoleObj => {
const args = consoleObj.args(); const args = consoleObj.args();
const arg0 = args[0]; const arg0 = args[0];
if (arg0 == undefined) return;
const json = await arg0.jsonValue(); const json = await arg0.jsonValue();
consoleLogs.push(json) consoleLogs.push(json)
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment