diff --git a/InfoLogger/public/logFilter/LogFilter.js b/InfoLogger/public/logFilter/LogFilter.js index 7e70dd646..310007dfd 100644 --- a/InfoLogger/public/logFilter/LogFilter.js +++ b/InfoLogger/public/logFilter/LogFilter.js @@ -429,8 +429,8 @@ export default class LogFilter extends Observable { $in: ['I', 'W', 'E', 'F'], }, level: { - max: 1, - $max: 1, + max: null, + $max: null, }, }; this.notify(); diff --git a/InfoLogger/test/mocha-index.js b/InfoLogger/test/mocha-index.js index 96df009d6..aa2ab23b6 100644 --- a/InfoLogger/test/mocha-index.js +++ b/InfoLogger/test/mocha-index.js @@ -10,15 +10,15 @@ * In applying this license CERN does not waive the privileges and immunities * granted to it by virtue of its status as an Intergovernmental Organization * or submit itself to any jurisdiction. -*/ + */ /* eslint-disable no-console */ const puppeteer = require('puppeteer'); const assert = require('assert'); -const {spawn} = require('child_process'); +const { spawn } = require('child_process'); const config = require('./test-config.js'); -const {createServer, closeServer} = require('./live-simulator/infoLoggerServer.js'); +const { createServer, closeServer } = require('./live-simulator/infoLoggerServer.js'); // APIs: // https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md @@ -28,16 +28,16 @@ const {createServer, closeServer} = require('./live-simulator/infoLoggerServer.j // Network and rendering can have delays this can leads to random failures // if they are tested just after their initialization. -describe('InfoLogger', function() { +describe('InfoLogger', function () { let browser; let page; let subprocess; // web-server runs into a subprocess let subprocessOutput = ''; let ilgServer; - + this.timeout(30000); this.slow(1000); - + const baseUrl = `http://${config.http.hostname}:${config.http.port}/`; before(async () => { @@ -62,26 +62,27 @@ describe('InfoLogger', function() { ilgServer = createServer(); // Start web-server in background - subprocess = spawn('node', ['index.js', 'test/test-config.js'], {stdio: 'pipe'}); + subprocess = spawn('node', ['index.js', 'test/test-config.js'], { stdio: 'pipe' }); subprocess.stdout.on('data', (chunk) => subprocessOutput += chunk.toString()); subprocess.stderr.on('data', (chunk) => subprocessOutput += chunk.toString()); - subprocess.on('error', (error) => console.error(`Server failed due to: ${error}`)) + subprocess.on('error', (error) => console.error(`Server failed due to: ${error}`)); // Start browser to test UI - browser = await puppeteer.launch({headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox']}); + browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] }); page = await browser.newPage(); await page.setViewport({ width: 1440, height: 900 }); // 15" screen equivalent // Export page and configurations for the other mocha files exports.page = page; - exports.helpers = {baseUrl, jwt: config.jwt}; + + exports.helpers = { baseUrl, jwt: config.jwt }; }); it('should load first page "/"', async () => { // try many times until backend server is ready for (let i = 0; i < 10; i++) { try { - await page.goto(baseUrl, {waitUntil: 'networkidle0'}); + await page.goto(baseUrl, { waitUntil: 'networkidle0' }); break; // connection ok, this test passed } catch (e) { if (e.message.includes('net::ERR_CONNECTION_REFUSED')) { @@ -93,12 +94,12 @@ describe('InfoLogger', function() { } }); - it('should have redirected to default page "/?q={"severity":{"in":"I W E F"},"level":{"max":1}}"', async function() { - await page.goto(baseUrl, {waitUntil: 'networkidle0'}); + it('should have redirected to default page "/?q={"severity":{"in":"I W E F"}}"', async () => { + await page.goto(baseUrl, { waitUntil: 'networkidle0' }); const location = await page.evaluate(() => window.location); const search = decodeURIComponent(location.search); - assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"},"level":{"max":1}}'); + assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"}}'); }); require('./public/user-actions-mocha'); @@ -118,7 +119,5 @@ describe('InfoLogger', function() { console.log('---------------------------------------------'); subprocess.kill(); closeServer(ilgServer); - }); }); - diff --git a/InfoLogger/test/public/live-mode-mocha.js b/InfoLogger/test/public/live-mode-mocha.js index 0b7cef97e..e7e7aac63 100644 --- a/InfoLogger/test/public/live-mode-mocha.js +++ b/InfoLogger/test/public/live-mode-mocha.js @@ -27,7 +27,7 @@ describe('Live Mode test-suite', async () => { const location = await page.evaluate(() => window.location); const search = decodeURIComponent(location.search); - assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"},"level":{"max":1}}'); + assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"}}'); }); it('should successfully enable LIVE mode', async () => { diff --git a/InfoLogger/test/public/log-filter-actions-mocha.js b/InfoLogger/test/public/log-filter-actions-mocha.js index 21eb8a098..32a4afa87 100644 --- a/InfoLogger/test/public/log-filter-actions-mocha.js +++ b/InfoLogger/test/public/log-filter-actions-mocha.js @@ -95,7 +95,7 @@ describe('Filter actions test-suite', async () => { }); it('should redirect to default filters and show JSON parse error on malformed q in URI', async () => { - const expectedDefaultParams = '?q={"severity":{"in":"I W E F"},"level":{"max":1}}'; + const expectedDefaultParams = '?q={"severity":{"in":"I W E F"}}'; const locationAndNotification = await page.evaluate(() => { const params = { q: '{"severity":{"in":"W I E F"' }; @@ -116,8 +116,8 @@ describe('Filter actions test-suite', async () => { it('should update URI with new encoded "match" criteria', async () => { /* eslint-disable max-len */ - const decodedParams = '?q={"hostname":{"match":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"},"level":{"max":1}}'; - const expectedParams = '?q={%22hostname%22:{%22match%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22},%22level%22:{%22max%22:1}}'; + const decodedParams = '?q={"hostname":{"match":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"}}'; + const expectedParams = '?q={%22hostname%22:{%22match%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22}}'; const searchParams = await page.evaluate(() => { window.model.log.filter.setCriteria('hostname', 'match', '"%ald_qdip01%'); window.model.updateRouteOnModelChange(); @@ -130,8 +130,8 @@ describe('Filter actions test-suite', async () => { it('should update URI with new encoded "exclude" criteria', async () => { /* eslint-disable max-len */ - const decodedParams = '?q={"hostname":{"exclude":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"},"level":{"max":1}}'; - const expectedParams = '?q={%22hostname%22:{%22exclude%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22},%22level%22:{%22max%22:1}}'; + const decodedParams = '?q={"hostname":{"exclude":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"}}'; + const expectedParams = '?q={%22hostname%22:{%22exclude%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22}}'; const searchParams = await page.evaluate(() => { window.model.log.filter.resetCriteria(); window.model.log.filter.setCriteria('hostname', 'exclude', '"%ald_qdip01%');