1010 * In applying this license CERN does not waive the privileges and immunities
1111 * granted to it by virtue of its status as an Intergovernmental Organization
1212 * or submit itself to any jurisdiction.
13- */
13+ */
1414
1515/* eslint-disable no-console */
1616const puppeteer = require ( 'puppeteer' ) ;
1717const assert = require ( 'assert' ) ;
18- const { spawn} = require ( 'child_process' ) ;
18+ const { spawn } = require ( 'child_process' ) ;
1919
2020const config = require ( './test-config.js' ) ;
21- const { createServer, closeServer} = require ( './live-simulator/infoLoggerServer.js' ) ;
21+ const { createServer, closeServer } = require ( './live-simulator/infoLoggerServer.js' ) ;
2222
2323// APIs:
2424// https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md
@@ -28,16 +28,16 @@ const {createServer, closeServer} = require('./live-simulator/infoLoggerServer.j
2828// Network and rendering can have delays this can leads to random failures
2929// if they are tested just after their initialization.
3030
31- describe ( 'InfoLogger' , function ( ) {
31+ describe ( 'InfoLogger' , function ( ) {
3232 let browser ;
3333 let page ;
3434 let subprocess ; // web-server runs into a subprocess
3535 let subprocessOutput = '' ;
3636 let ilgServer ;
37-
37+
3838 this . timeout ( 30000 ) ;
3939 this . slow ( 1000 ) ;
40-
40+
4141 const baseUrl = `http://${ config . http . hostname } :${ config . http . port } /` ;
4242
4343 before ( async ( ) => {
@@ -62,26 +62,27 @@ describe('InfoLogger', function() {
6262 ilgServer = createServer ( ) ;
6363
6464 // Start web-server in background
65- subprocess = spawn ( 'node' , [ 'index.js' , 'test/test-config.js' ] , { stdio : 'pipe' } ) ;
65+ subprocess = spawn ( 'node' , [ 'index.js' , 'test/test-config.js' ] , { stdio : 'pipe' } ) ;
6666 subprocess . stdout . on ( 'data' , ( chunk ) => subprocessOutput += chunk . toString ( ) ) ;
6767 subprocess . stderr . on ( 'data' , ( chunk ) => subprocessOutput += chunk . toString ( ) ) ;
68- subprocess . on ( 'error' , ( error ) => console . error ( `Server failed due to: ${ error } ` ) )
68+ subprocess . on ( 'error' , ( error ) => console . error ( `Server failed due to: ${ error } ` ) ) ;
6969
7070 // Start browser to test UI
71- browser = await puppeteer . launch ( { headless : true , args : [ '--no-sandbox' , '--disable-setuid-sandbox' ] } ) ;
71+ browser = await puppeteer . launch ( { headless : true , args : [ '--no-sandbox' , '--disable-setuid-sandbox' ] } ) ;
7272 page = await browser . newPage ( ) ;
7373 await page . setViewport ( { width : 1440 , height : 900 } ) ; // 15" screen equivalent
7474
7575 // Export page and configurations for the other mocha files
7676 exports . page = page ;
77- exports . helpers = { baseUrl, jwt : config . jwt } ;
77+
78+ exports . helpers = { baseUrl, jwt : config . jwt } ;
7879 } ) ;
7980
8081 it ( 'should load first page "/"' , async ( ) => {
8182 // try many times until backend server is ready
8283 for ( let i = 0 ; i < 10 ; i ++ ) {
8384 try {
84- await page . goto ( baseUrl , { waitUntil : 'networkidle0' } ) ;
85+ await page . goto ( baseUrl , { waitUntil : 'networkidle0' } ) ;
8586 break ; // connection ok, this test passed
8687 } catch ( e ) {
8788 if ( e . message . includes ( 'net::ERR_CONNECTION_REFUSED' ) ) {
@@ -93,12 +94,12 @@ describe('InfoLogger', function() {
9394 }
9495 } ) ;
9596
96- it ( 'should have redirected to default page "/?q={"severity":{"in":"I W E F"},"level":{"max":1}} "' , async function ( ) {
97- await page . goto ( baseUrl , { waitUntil : 'networkidle0' } ) ;
97+ it ( 'should have redirected to default page "/?q={"severity":{"in":"I W E F"}} "' , async ( ) => {
98+ await page . goto ( baseUrl , { waitUntil : 'networkidle0' } ) ;
9899 const location = await page . evaluate ( ( ) => window . location ) ;
99100 const search = decodeURIComponent ( location . search ) ;
100101
101- assert . deepStrictEqual ( search , '?q={"severity":{"in":"I W E F"},"level":{"max":1} }' ) ;
102+ assert . deepStrictEqual ( search , '?q={"severity":{"in":"I W E F"}}' ) ;
102103 } ) ;
103104
104105 require ( './public/user-actions-mocha' ) ;
@@ -118,7 +119,5 @@ describe('InfoLogger', function() {
118119 console . log ( '---------------------------------------------' ) ;
119120 subprocess . kill ( ) ;
120121 closeServer ( ilgServer ) ;
121-
122122 } ) ;
123123} ) ;
124-
0 commit comments