From 2893d9797fc087c7a5fdf2e72d8b8862a7d79715 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Fri, 13 Feb 2026 14:48:05 +0100 Subject: [PATCH 01/15] test: create useCaseTests --- .../lhcFill/GetAllLhcFillsUseCase.test.js | 587 ++++++++++-------- 1 file changed, 326 insertions(+), 261 deletions(-) diff --git a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js index 852c559da3..b5cfd718b9 100644 --- a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js +++ b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js @@ -24,297 +24,362 @@ module.exports = () => { beforeEach(async () => { getAllLhcFillsDto = await GetAllLhcFillsDto.validateAsync({}); }); - it('should return all the lhcFills', async () => { - const result = await new GetAllEnvironmentsUseCase() - .execute(getAllLhcFillsDto); - expect(result.environments).to.be.an('array'); - }); - - it('should only containing lhc fills with stable beams', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - - expect(lhcFills).to.be.an('array'); - lhcFills.forEach((lhcFill) => { - // Every lhcFill should have stableBeamsStart - expect(lhcFill.stableBeamsStart).to.not.be.null; - }); - }); - - // Fill number filter tests - - it('should only contain specified fill number', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '6' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(1) - - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillNumber).to.equal(6) - }); - }) - - it('should only contain specified fill numbers', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '6,3' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // it('should return all the lhcFills', async () => { + // const result = await new GetAllEnvironmentsUseCase() + // .execute(getAllLhcFillsDto); + // expect(result.environments).to.be.an('array'); + // }); + + // it('should only containing lhc fills with stable beams', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + // expect(lhcFills).to.be.an('array'); + // lhcFills.forEach((lhcFill) => { + // // Every lhcFill should have stableBeamssStart + // expect(lhcFill.stableBeamssStart).to.not.be.null; + // }); + // }); + + // // Fill number filter tests + + // it('should only contain specified fill number', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillNumber).to.equal(6) + // }); + // }) + + // it('should only contain specified fill numbers', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6,3' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(2) + // expect(lhcFills).to.be.an('array').and.lengthOf(2) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillNumber).oneOf([6,3]) - }); - }) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillNumber).oneOf([6,3]) + // }); + // }) - it('should only contain specified fill numbers, range', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '1-3,6' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // it('should only contain specified fill numbers, range', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '1-3,6' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(4) + // expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillNumber).oneOf([1,2,3,6]) - }); - }) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillNumber).oneOf([1,2,3,6]) + // }); + // }) - it('should only contain specified fill numbers, whitespace', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: ' 6 , 3 ' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // it('should only contain specified fill numbers, whitespace', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ' 6 , 3 ' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(2) + // expect(lhcFills).to.be.an('array').and.lengthOf(2) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillNumber).oneOf([6,3]) - }); - }) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillNumber).oneOf([6,3]) + // }); + // }) - it('should only contain specified fill numbers, comma misplacement', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: ',6,3,' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // it('should only contain specified fill numbers, comma misplacement', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ',6,3,' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(2) - - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillNumber).oneOf([6,3]) - }); - }) - - it('should only contain matching scheme name, one precise', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, schemeName: 'schemename' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - - expect(lhcFills).to.be.an('array').and.lengthOf(3) - - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillingSchemeName).to.equal('schemename') - }); - }) - - it('should only contain matching scheme name, one partial', async () => { - getAllLhcFillsDto.query = { filter: { schemeName: '25ns_2352b_2340_2004_2133' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // expect(lhcFills).to.be.an('array').and.lengthOf(2) + + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillNumber).oneOf([6,3]) + // }); + // }) + + // it('should only contain matching scheme name, one precise', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, schemeName: 'schemename' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + // expect(lhcFills).to.be.an('array').and.lengthOf(3) + + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillingSchemeName).to.equal('schemename') + // }); + // }) + + // it('should only contain matching scheme name, one partial', async () => { + // getAllLhcFillsDto.query = { filter: { schemeName: '25ns_2352b_2340_2004_2133' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.fillingSchemeName).to.equal('25ns_2352b_2340_2004_2133_108bpi_24inj') + // }); + // }) + + // // Beam duration filter tests + // it('should only contain specified stable beam durations, < 12:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + // expect(lhcFills).to.be.an('array').and.lengthOf(3) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.stableBeamssDuration).lessThan(43200) + // }); + // }); + + // it('should only contain specified stable beam durations, <= 12:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + // expect(lhcFills).to.be.an('array').and.lengthOf(4) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.stableBeamssDuration).lessThanOrEqual(43200) + // }); + // }) + + // it('should only contain specified stable beam durations, = 00:01:40', async () => { + // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + // expect(lhcFills).to.be.an('array').and.lengthOf(3) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.stableBeamssDuration).equal(100) + // }); + // }); + + // it('should only contain specified stable beam durations, >= 00:01:40', async () => { + // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(4) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.stableBeamssDuration).greaterThanOrEqual(100) + // }); + // }) + + // it('should only contain specified stable beam durations, > 00:01:40', async () => { + // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.stableBeamssDuration).greaterThan(100) + // }); + // }) + + // it('should only contain specified stable beam durations, = 00:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, beamDuration: {limit: '0', operator: '='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(0) + // }) + + // it('should only contain specified total run duration, < 00:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(0) + // }); + + // it('should only contain specified total run duration, > 00:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(0) + // }); + // }); + + // it('should only contain specified total run duration, <= 00:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(4) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).equals(0) + // }); + // }); + + // it('should only contain specified total run duration, >= 00:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(5) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThanOrEqual(0) + // }); + // }); + + + // it('should only contain specified total run duration, > 04:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '14400', operator: '>'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(14400) + // }); + // }) + + // it('should only contain specified total run duration, >= 05:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '>='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + // }); + // }) + + // it('should only contain specified total run duration, = 05:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + // }); + // }) + + // it('should only contain specified total run duration, = 00:00:00', async () => { + // // Tests the usecase's ability to replace the request for 0 to a request for null. + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(4) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).equals(0) + // }); + // }) + + // it('should only contain specified total run duration, <= 05:00:00', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '<='} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + // }); + // }) + + // it('should only contain specified total run duration, < 06:30:59', async () => { + // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '23459', operator: '<'} } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(1) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.statistics.runsCoverage).greaterThan(23459) + // }); + // }) + + // it('should only contain specified beam type, {p-p}', async () => { + // getAllLhcFillsDto.query = { filter: { beamTypes: 'p-p' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(2) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.beamType).to.equal('p-p') + // }); + // }) + + // it('should only contain specified beam types, {p-p, PROTON-PROTON, Pb-Pb}', async () => { + // const beamTypes = ['p-p', 'PROTON-PROTON', 'Pb-Pb'] + + // getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - expect(lhcFills).to.be.an('array').and.lengthOf(1) + // expect(lhcFills).to.be.an('array').and.lengthOf(4) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.beamType).oneOf(beamTypes) + // }); + // }) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.fillingSchemeName).to.equal('25ns_2352b_2340_2004_2133_108bpi_24inj') - }); - }) + // it('should ignore unknown beam types, {p-p, Hello-world, Pb-Pb}', async () => { + // const beamTypes = ['p-p', 'Hello-world', 'Pb-Pb'] + + // getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(3) + // lhcFills.forEach((lhcFill) => { + // expect(lhcFill.beamType).oneOf(['p-p', 'Pb-Pb']) + // }); + // }) + + // it('should be empty with unknown beam type, {Hello-world}', async () => { + // getAllLhcFillsDto.query = { filter: { beamTypes: 'Hello-world' } }; + // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + // expect(lhcFills).to.be.an('array').and.lengthOf(0) + // }) + + it('should return an array with only \'from\' values given', async () => { + getAllLhcFillsDto.query = { + filter: { + stableBeamsStart: { + from: 1647867600000, + }, + stableBeamsEnd: { + from: 1647867600000, + }, + }, + }; - // Beam duration filter tests - it('should only contain specified stable beam durations, < 12:00:00', async () => { - getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<'} } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - expect(lhcFills).to.be.an('array').and.lengthOf(3) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamsDuration).lessThan(43200) - }); - }); - it('should only contain specified stable beam durations, <= 12:00:00', async () => { - getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamsDuration).lessThanOrEqual(43200) - }); - }) - - it('should only contain specified stable beam durations, = 00:01:40', async () => { - getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - expect(lhcFills).to.be.an('array').and.lengthOf(3) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamsDuration).equal(100) - }); - }); - - it('should only contain specified stable beam durations, >= 00:01:40', async () => { - getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); - expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamsDuration).greaterThanOrEqual(100) - }); - }) - - it('should only contain specified stable beam durations, > 00:01:40', async () => { - getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>'} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamsDuration).greaterThan(100) - }); - }) - - it('should only contain specified stable beam durations, = 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeams: true, beamDuration: {limit: '0', operator: '='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(0) - }) - - it('should only contain specified total run duration, < 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<'} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(0) - }); - - it('should only contain specified total run duration, > 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>'} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(0) - }); + expect(lhcFills).to.be.an('array'); + expect(lhcFills).to.have.lengthOf(3); }); - it('should only contain specified total run duration, <= 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + it('should return an array with only \'to\' values given', async () => { + getAllLhcFillsDto.query = { + filter: { + stableBeamsStart: { + to: 2000000000000 + }, + stableBeamsEnd: { + to: 2000000000000 + }, + }, + }; - expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).equals(0) - }); - }); + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - it('should only contain specified total run duration, >= 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); + - expect(lhcFills).to.be.an('array').and.lengthOf(5) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThanOrEqual(0) - }); + expect(lhcFills).to.be.an('array'); + expect(lhcFills).to.have.lengthOf(4); }); + it('should return an array with fills on certain timestamps', async () => { + getAllLhcFillsDto.query = { + filter: { + stableBeamsStart: { + from: 1647867600000, + to: 1647867600000, + }, + stableBeamsEnd: { + from: 1647961200000, + to: 1647961200000, + }, + }, + }; - it('should only contain specified total run duration, > 04:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '14400', operator: '>'} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(14400) - }); - }) - - it('should only contain specified total run duration, >= 05:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '>='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - }); - }) - - it('should only contain specified total run duration, = 05:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - }); - }) - - it('should only contain specified total run duration, = 00:00:00', async () => { - // Tests the usecase's ability to replace the request for 0 to a request for null. - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).equals(0) - }); - }) - - it('should only contain specified total run duration, <= 05:00:00', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '<='} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - }); - }) - - it('should only contain specified total run duration, < 06:30:59', async () => { - getAllLhcFillsDto.query = { filter: { runDuration: {limit: '23459', operator: '<'} } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(1) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.statistics.runsCoverage).greaterThan(23459) - }); - }) - - it('should only contain specified beam type, {p-p}', async () => { - getAllLhcFillsDto.query = { filter: { beamTypes: 'p-p' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(2) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.beamType).to.equal('p-p') - }); - }) - - it('should only contain specified beam types, {p-p, PROTON-PROTON, Pb-Pb}', async () => { - const beamTypes = ['p-p', 'PROTON-PROTON', 'Pb-Pb'] - - getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(4) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.beamType).oneOf(beamTypes) - }); - }) + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - it('should ignore unknown beam types, {p-p, Hello-world, Pb-Pb}', async () => { - const beamTypes = ['p-p', 'Hello-world', 'Pb-Pb'] + console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); - getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - expect(lhcFills).to.be.an('array').and.lengthOf(3) - lhcFills.forEach((lhcFill) => { - expect(lhcFill.beamType).oneOf(['p-p', 'Pb-Pb']) - }); - }) - - it('should be empty with unknown beam type, {Hello-world}', async () => { - getAllLhcFillsDto.query = { filter: { beamTypes: 'Hello-world' } }; - const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - expect(lhcFills).to.be.an('array').and.lengthOf(0) - }) + expect(lhcFills).to.be.an('array'); + expect(lhcFills).to.have.lengthOf(3); + }); }; From 6c0248f2f5855a2c4ce1a6377fbd5e7102f3e8ea Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Fri, 13 Feb 2026 14:52:51 +0100 Subject: [PATCH 02/15] add stableBeamsStart and stableBeamsEnd to LhcFillsFilterDto --- lib/domain/dtos/filters/LhcFillsFilterDto.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/domain/dtos/filters/LhcFillsFilterDto.js b/lib/domain/dtos/filters/LhcFillsFilterDto.js index 3338f44517..3fe9578388 100644 --- a/lib/domain/dtos/filters/LhcFillsFilterDto.js +++ b/lib/domain/dtos/filters/LhcFillsFilterDto.js @@ -14,6 +14,7 @@ const Joi = require('joi'); const { validateRange, RANGE_INVALID } = require('../../../utilities/rangeUtils'); const { validateBeamTypes, BEAM_TYPE_INVALID } = require('../../../utilities/beamTypeUtils'); const { validateTimeDuration } = require('../../../utilities/validateTime'); +const { FromToFilterDto } = require('./FromToFilterDto.js'); exports.LhcFillsFilterDto = Joi.object({ hasStableBeams: Joi.boolean(), @@ -23,6 +24,8 @@ exports.LhcFillsFilterDto = Joi.object({ }), runDuration: validateTimeDuration, beamDuration: validateTimeDuration, + stableBeamsStart: FromToFilterDto, + stableBeamsEnd: FromToFilterDto, schemeName: Joi.string().trim().max(64), beamTypes: Joi.string() .trim() From b3fa2ab533dd4574f953b2b77aa84382708136dc Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Fri, 13 Feb 2026 15:15:49 +0100 Subject: [PATCH 03/15] filter by stableBeamsStart stableBeamsEnd in getAllLhcFillsUseCase --- lib/usecases/lhcFill/GetAllLhcFillsUseCase.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/usecases/lhcFill/GetAllLhcFillsUseCase.js b/lib/usecases/lhcFill/GetAllLhcFillsUseCase.js index 898ec5d3de..4315cf9e1a 100644 --- a/lib/usecases/lhcFill/GetAllLhcFillsUseCase.js +++ b/lib/usecases/lhcFill/GetAllLhcFillsUseCase.js @@ -47,12 +47,24 @@ class GetAllLhcFillsUseCase { let associatedStatisticsRequired = false; if (filter) { - const { hasStableBeams, fillNumbers, schemeName, beamDuration, runDuration, beamTypes } = filter; + const { hasStableBeams, fillNumbers, schemeName, beamDuration, stableBeamsStart, stableBeamsEnd, runDuration, beamTypes } = filter; if (hasStableBeams) { // For now, if a stableBeamsStart is present, then a beam is stable queryBuilder.where('stableBeamsStart').not().is(null); } + if (stableBeamsStart) { + const from = stableBeamsStart.from !== undefined ? stableBeamsStart.from : 0; + const to = stableBeamsStart.to !== undefined ? stableBeamsStart.to : new Date().getTime(); + queryBuilder.where('stableBeamsStart').between(from, to); + } + + if (stableBeamsEnd) { + const from = stableBeamsEnd.from !== undefined ? stableBeamsEnd.from : 0; + const to = stableBeamsEnd.to !== undefined ? stableBeamsEnd.to : new Date().getTime(); + queryBuilder.where('stableBeamsEnd').between(from, to); + } + if (fillNumbers) { const fillNumberCriteria = splitStringToStringsTrimmed(fillNumbers, SEARCH_ITEMS_SEPARATOR); From a70732744e678af1367533bb1478c5f6f713f840 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 07:57:32 +0100 Subject: [PATCH 04/15] chore: uncomment tests --- .../lhcFill/GetAllLhcFillsUseCase.test.js | 551 +++++++++--------- 1 file changed, 271 insertions(+), 280 deletions(-) diff --git a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js index b5cfd718b9..40fdb8392f 100644 --- a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js +++ b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js @@ -24,299 +24,299 @@ module.exports = () => { beforeEach(async () => { getAllLhcFillsDto = await GetAllLhcFillsDto.validateAsync({}); }); - // it('should return all the lhcFills', async () => { - // const result = await new GetAllEnvironmentsUseCase() - // .execute(getAllLhcFillsDto); - // expect(result.environments).to.be.an('array'); - // }); - - // it('should only containing lhc fills with stable beams', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - - // expect(lhcFills).to.be.an('array'); - // lhcFills.forEach((lhcFill) => { - // // Every lhcFill should have stableBeamssStart - // expect(lhcFill.stableBeamssStart).to.not.be.null; - // }); - // }); - - // // Fill number filter tests - - // it('should only contain specified fill number', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillNumber).to.equal(6) - // }); - // }) - - // it('should only contain specified fill numbers', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6,3' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + it('should return all the lhcFills', async () => { + const result = await new GetAllEnvironmentsUseCase() + .execute(getAllLhcFillsDto); + expect(result.environments).to.be.an('array'); + }); + + it('should only containing lhc fills with stable beams', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + expect(lhcFills).to.be.an('array'); + lhcFills.forEach((lhcFill) => { + // Every lhcFill should have stableBeamssStart + expect(lhcFill.stableBeamssStart).to.not.be.null; + }); + }); + + // Fill number filter tests + + it('should only contain specified fill number', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + expect(lhcFills).to.be.an('array').and.lengthOf(1) + + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillNumber).to.equal(6) + }); + }) + + it('should only contain specified fill numbers', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6,3' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(2) + expect(lhcFills).to.be.an('array').and.lengthOf(2) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillNumber).oneOf([6,3]) - // }); - // }) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillNumber).oneOf([6,3]) + }); + }) - // it('should only contain specified fill numbers, range', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '1-3,6' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + it('should only contain specified fill numbers, range', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '1-3,6' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(4) + expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillNumber).oneOf([1,2,3,6]) - // }); - // }) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillNumber).oneOf([1,2,3,6]) + }); + }) - // it('should only contain specified fill numbers, whitespace', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ' 6 , 3 ' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + it('should only contain specified fill numbers, whitespace', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ' 6 , 3 ' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(2) + expect(lhcFills).to.be.an('array').and.lengthOf(2) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillNumber).oneOf([6,3]) - // }); - // }) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillNumber).oneOf([6,3]) + }); + }) - // it('should only contain specified fill numbers, comma misplacement', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ',6,3,' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + it('should only contain specified fill numbers, comma misplacement', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ',6,3,' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(2) - - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillNumber).oneOf([6,3]) - // }); - // }) - - // it('should only contain matching scheme name, one precise', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, schemeName: 'schemename' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - - // expect(lhcFills).to.be.an('array').and.lengthOf(3) - - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillingSchemeName).to.equal('schemename') - // }); - // }) - - // it('should only contain matching scheme name, one partial', async () => { - // getAllLhcFillsDto.query = { filter: { schemeName: '25ns_2352b_2340_2004_2133' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.fillingSchemeName).to.equal('25ns_2352b_2340_2004_2133_108bpi_24inj') - // }); - // }) - - // // Beam duration filter tests - // it('should only contain specified stable beam durations, < 12:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - // expect(lhcFills).to.be.an('array').and.lengthOf(3) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.stableBeamssDuration).lessThan(43200) - // }); - // }); - - // it('should only contain specified stable beam durations, <= 12:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.stableBeamssDuration).lessThanOrEqual(43200) - // }); - // }) - - // it('should only contain specified stable beam durations, = 00:01:40', async () => { - // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(3) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.stableBeamssDuration).equal(100) - // }); - // }); - - // it('should only contain specified stable beam durations, >= 00:01:40', async () => { - // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + expect(lhcFills).to.be.an('array').and.lengthOf(2) + + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillNumber).oneOf([6,3]) + }); + }) + + it('should only contain matching scheme name, one precise', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, schemeName: 'schemename' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + expect(lhcFills).to.be.an('array').and.lengthOf(3) + + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillingSchemeName).to.equal('schemename') + }); + }) + + it('should only contain matching scheme name, one partial', async () => { + getAllLhcFillsDto.query = { filter: { schemeName: '25ns_2352b_2340_2004_2133' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + + lhcFills.forEach((lhcFill) => { + expect(lhcFill.fillingSchemeName).to.equal('25ns_2352b_2340_2004_2133_108bpi_24inj') + }); + }) + + // Beam duration filter tests + it('should only contain specified stable beam durations, < 12:00:00', async () => { + getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); + expect(lhcFills).to.be.an('array').and.lengthOf(3) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.stableBeamssDuration).lessThan(43200) + }); + }); + + it('should only contain specified stable beam durations, <= 12:00:00', async () => { + getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '43200', operator: '<='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + expect(lhcFills).to.be.an('array').and.lengthOf(4) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.stableBeamssDuration).lessThanOrEqual(43200) + }); + }) + + it('should only contain specified stable beam durations, = 00:01:40', async () => { + getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + expect(lhcFills).to.be.an('array').and.lengthOf(3) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.stableBeamssDuration).equal(100) + }); + }); + + it('should only contain specified stable beam durations, >= 00:01:40', async () => { + getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.stableBeamssDuration).greaterThanOrEqual(100) - // }); - // }) - - // it('should only contain specified stable beam durations, > 00:01:40', async () => { - // getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.stableBeamssDuration).greaterThan(100) - // }); - // }) - - // it('should only contain specified stable beam durations, = 00:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, beamDuration: {limit: '0', operator: '='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(0) - // }) - - // it('should only contain specified total run duration, < 00:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(0) - // }); - - // it('should only contain specified total run duration, > 00:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(0) - // }); - // }); - - // it('should only contain specified total run duration, <= 00:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).equals(0) - // }); - // }); - - // it('should only contain specified total run duration, >= 00:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(5) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThanOrEqual(0) - // }); - // }); - - - // it('should only contain specified total run duration, > 04:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '14400', operator: '>'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(14400) - // }); - // }) - - // it('should only contain specified total run duration, >= 05:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '>='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - // }); - // }) - - // it('should only contain specified total run duration, = 05:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - // }); - // }) - - // it('should only contain specified total run duration, = 00:00:00', async () => { - // // Tests the usecase's ability to replace the request for 0 to a request for null. - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).equals(0) - // }); - // }) - - // it('should only contain specified total run duration, <= 05:00:00', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '<='} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(18000) - // }); - // }) - - // it('should only contain specified total run duration, < 06:30:59', async () => { - // getAllLhcFillsDto.query = { filter: { runDuration: {limit: '23459', operator: '<'} } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(1) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.statistics.runsCoverage).greaterThan(23459) - // }); - // }) - - // it('should only contain specified beam type, {p-p}', async () => { - // getAllLhcFillsDto.query = { filter: { beamTypes: 'p-p' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - - // expect(lhcFills).to.be.an('array').and.lengthOf(2) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.beamType).to.equal('p-p') - // }); - // }) - - // it('should only contain specified beam types, {p-p, PROTON-PROTON, Pb-Pb}', async () => { - // const beamTypes = ['p-p', 'PROTON-PROTON', 'Pb-Pb'] + expect(lhcFills).to.be.an('array').and.lengthOf(4) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.stableBeamssDuration).greaterThanOrEqual(100) + }); + }) + + it('should only contain specified stable beam durations, > 00:01:40', async () => { + getAllLhcFillsDto.query = { filter: { beamDuration: {limit: '100', operator: '>'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.stableBeamssDuration).greaterThan(100) + }); + }) + + it('should only contain specified stable beam durations, = 00:00:00', async () => { + getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, beamDuration: {limit: '0', operator: '='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(0) + }) + + it('should only contain specified total run duration, < 00:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(0) + }); + + it('should only contain specified total run duration, > 00:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(0) + }); + }); + + it('should only contain specified total run duration, <= 00:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '<='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(4) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).equals(0) + }); + }); + + it('should only contain specified total run duration, >= 00:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '>='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(5) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThanOrEqual(0) + }); + }); + + + it('should only contain specified total run duration, > 04:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '14400', operator: '>'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(14400) + }); + }) + + it('should only contain specified total run duration, >= 05:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '>='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + }); + }) + + it('should only contain specified total run duration, = 05:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + }); + }) + + it('should only contain specified total run duration, = 00:00:00', async () => { + // Tests the usecase's ability to replace the request for 0 to a request for null. + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '0', operator: '='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(4) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).equals(0) + }); + }) + + it('should only contain specified total run duration, <= 05:00:00', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '18000', operator: '<='} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(18000) + }); + }) + + it('should only contain specified total run duration, < 06:30:59', async () => { + getAllLhcFillsDto.query = { filter: { runDuration: {limit: '23459', operator: '<'} } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(1) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.statistics.runsCoverage).greaterThan(23459) + }); + }) + + it('should only contain specified beam type, {p-p}', async () => { + getAllLhcFillsDto.query = { filter: { beamTypes: 'p-p' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + + expect(lhcFills).to.be.an('array').and.lengthOf(2) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.beamType).to.equal('p-p') + }); + }) + + it('should only contain specified beam types, {p-p, PROTON-PROTON, Pb-Pb}', async () => { + const beamTypes = ['p-p', 'PROTON-PROTON', 'Pb-Pb'] - // getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(4) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.beamType).oneOf(beamTypes) - // }); - // }) + expect(lhcFills).to.be.an('array').and.lengthOf(4) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.beamType).oneOf(beamTypes) + }); + }) - // it('should ignore unknown beam types, {p-p, Hello-world, Pb-Pb}', async () => { - // const beamTypes = ['p-p', 'Hello-world', 'Pb-Pb'] + it('should ignore unknown beam types, {p-p, Hello-world, Pb-Pb}', async () => { + const beamTypes = ['p-p', 'Hello-world', 'Pb-Pb'] - // getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + getAllLhcFillsDto.query = { filter: { beamTypes: beamTypes.join(',') } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(3) - // lhcFills.forEach((lhcFill) => { - // expect(lhcFill.beamType).oneOf(['p-p', 'Pb-Pb']) - // }); - // }) + expect(lhcFills).to.be.an('array').and.lengthOf(3) + lhcFills.forEach((lhcFill) => { + expect(lhcFill.beamType).oneOf(['p-p', 'Pb-Pb']) + }); + }) - // it('should be empty with unknown beam type, {Hello-world}', async () => { - // getAllLhcFillsDto.query = { filter: { beamTypes: 'Hello-world' } }; - // const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) + it('should be empty with unknown beam type, {Hello-world}', async () => { + getAllLhcFillsDto.query = { filter: { beamTypes: 'Hello-world' } }; + const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) - // expect(lhcFills).to.be.an('array').and.lengthOf(0) - // }) + expect(lhcFills).to.be.an('array').and.lengthOf(0) + }) it('should return an array with only \'from\' values given', async () => { getAllLhcFillsDto.query = { @@ -332,9 +332,6 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); - - expect(lhcFills).to.be.an('array'); expect(lhcFills).to.have.lengthOf(3); }); @@ -353,9 +350,6 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); - - expect(lhcFills).to.be.an('array'); expect(lhcFills).to.have.lengthOf(4); }); @@ -376,9 +370,6 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); - console.log(JSON.stringify(lhcFills.map(({stableBeamsStart, stableBeamsEnd})=> ({ stableBeamsStart, stableBeamsEnd })))); - - expect(lhcFills).to.be.an('array'); expect(lhcFills).to.have.lengthOf(3); }); From 12eab62d59aec6e9c3056bcf842a4374e9565096 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:31:39 +0100 Subject: [PATCH 05/15] create formats for stablebeam --- .../LhcFills/format/formatStableBeamsEnd.js | 43 +++++++++++++++++++ .../LhcFills/format/formatStableBeamsStart.js | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 lib/public/views/LhcFills/format/formatStableBeamsEnd.js create mode 100644 lib/public/views/LhcFills/format/formatStableBeamsStart.js diff --git a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js new file mode 100644 index 0000000000..63c841cf57 --- /dev/null +++ b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js @@ -0,0 +1,43 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * 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. + */ + +import { formatTimestamp } from '../../../utilities/formatting/formatTimestamp.js'; +import { h } from '/js/src/index.js'; +import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; + +/** + * Format a given the lhcFill's stable beam end date + * + * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted + * @param {object} [configuration] eventual display configuration + * @param {boolean} [configuration.inline] true if the date must be inlined + * @return {Component} the formatted end date + */ +export const formatStableBeamsEnd = (lhcFill, configuration) => { + const { inline = false } = configuration || {}; + const { stableBeamEnd } = lhcFill; + + if (stableBeamEnd === null || stableBeamEnd === undefined) return '-'; + + if (inline) { + return h('span', [ + h('.flex-row.items-center.g2', [ formatTimestamp(stableBeamEnd, inline) ]), + ]); + } else { + const { date, time } = getLocaleDateAndTime(stableBeamEnd); + return h('', [ + h('', date), + h('.flex-row.g2.items-center', [ h('', time) ]), + ]); + } +}; diff --git a/lib/public/views/LhcFills/format/formatStableBeamsStart.js b/lib/public/views/LhcFills/format/formatStableBeamsStart.js new file mode 100644 index 0000000000..c5440257ff --- /dev/null +++ b/lib/public/views/LhcFills/format/formatStableBeamsStart.js @@ -0,0 +1,43 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * 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. + */ + +import { formatTimestamp } from '../../../utilities/formatting/formatTimestamp.js'; +import { h } from '/js/src/index.js'; +import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; + +/** + * Format a given lhcFill's stable beam start date + * + * @param {LhcFill} lhcFill the lhcFill for which start date must be formatted + * @param {object} [configuration] eventual display configuration + * @param {boolean} [configuration.inline] true if the date must be inlined + * @return {Component} the formatted start date + */ +export const formatStableBeamsStart = (lhcFill, configuration) => { + const { inline = false } = configuration || {}; + const { stableBeamStart } = lhcFill; + + if (stableBeamStart === null || stableBeamStart === undefined) return '-'; + + if (inline) { + return h('span', [ + h('.flex-row.items-center.g2', [ formatTimestamp(stableBeamStart, inline) ]), + ]); + } else { + const { date, time } = getLocaleDateAndTime(stableBeamStart); + return h('', [ + h('', date), + h('.flex-row.g2.items-center', [h('', time)]), + ]); + } +}; From bced169ce35719dbb78a9d9995024893e4549aa5 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:34:00 +0100 Subject: [PATCH 06/15] start on lhcFillsActiveColumn --- .../ActiveColumns/lhcFillsActiveColumns.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js index 9dbd83ae4f..a71637b9cb 100644 --- a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js +++ b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js @@ -28,6 +28,8 @@ import { fillNumberFilter } from '../../../components/Filters/LhcFillsFilter/fil import { durationFilter } from '../../../components/Filters/LhcFillsFilter/durationFilter.js'; import { beamTypeFilter } from '../../../components/Filters/LhcFillsFilter/beamTypeFilter.js'; import { schemeNameFilter } from '../../../components/Filters/LhcFillsFilter/schemeNameFilter.js'; +import { formatStableBeamsStart } from '../format/formatStableBeamsStart.js'; +import { formatStableBeamsEnd } from '../format/formatStableBeamsEnd.js'; /** * List of active columns for a lhc fills table @@ -132,6 +134,72 @@ export const lhcFillsActiveColumns = { size: 'w-8', format: (duration, lhcFill) => formatLhcFillsTimeLoss(duration, lhcFill.efficiencyLossAtEnd, false), }, + stableBeamStart: { + name: 'Stable Beam Start', + visible: true, + classes: 'w-7 f6', + noEllipsis: true, + format: (_, run) => formatStableBeamsStart(run), + exportFormat: (timestamp) => formatTimestamp(timestamp), + + /** + * Stable Beam start filter component + * + * @param {RunsOverviewModel} runsOverviewModel the runs overview model + * @return {Component} the filter component + */ + filter: (runsOverviewModel) => "timeRangeFilter(runsOverviewModel.filteringModel.get('o2start').timeRangeInputModel)", + profiles: { + lhcFill: true, + environment: true, + home: { + classes: 'w-10 f6', + format: (_, run) => formatStableBeamsStart(run, { inline: true }), + }, + runsPerLhcPeriod: { + classes: 'f6 w-wrapped', + }, + runsPerDataPass: { + classes: 'f6 w-wrapped', + }, + runsPerSimulationPass: { + classes: 'f6 w-wrapped', + }, + }, + }, + stableBeamEnd: { + name: 'Stable Beam Stop', + visible: true, + classes: 'w-7 f6', + noEllipsis: true, + format: (_, run) => formatStableBeamsEnd(run), + exportFormat: (timestamp) => formatTimestamp(timestamp), + + /** + * Stable Beam end filter component + * + * @param {RunsOverviewModel} runsOverviewModel the runs overview model + * @return {Component} the filter component + */ + filter: (runsOverviewModel) => "timeRangeFilter(runsOverviewModel.filteringModel.get('o2end').timeRangeInputModel)", + profiles: { + lhcFill: true, + environment: true, + home: { + classes: 'w-10 f6', + format: (_, run) => formatStableBeamsEnd(run, { inline: true }), + }, + runsPerLhcPeriod: { + classes: 'f6 w-wrapped', + }, + runsPerDataPass: { + classes: 'f6 w-wrapped', + }, + runsPerSimulationPass: { + classes: 'f6 w-wrapped', + }, + }, + }, meanRunDuration: { name: 'Mean run duration', visible: true, From b6c5fe53415387de0cb289a016870cf4601690f4 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:38:51 +0100 Subject: [PATCH 07/15] improve format end --- lib/public/views/LhcFills/format/formatStableBeamsEnd.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js index 63c841cf57..cfebe89cb7 100644 --- a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js +++ b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js @@ -19,14 +19,12 @@ import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; * Format a given the lhcFill's stable beam end date * * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted + * @param {number} lhcFill.stableBeamEnd the time at which a beam would end * @param {object} [configuration] eventual display configuration * @param {boolean} [configuration.inline] true if the date must be inlined * @return {Component} the formatted end date */ -export const formatStableBeamsEnd = (lhcFill, configuration) => { - const { inline = false } = configuration || {}; - const { stableBeamEnd } = lhcFill; - +export const formatStableBeamsEnd = ({ stableBeamEnd }, { inline = false } = {}) => { if (stableBeamEnd === null || stableBeamEnd === undefined) return '-'; if (inline) { From 1d6826920d04bffef7688700b664494f2a7b165a Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:41:25 +0100 Subject: [PATCH 08/15] add two submodels to lhcOverviewmodel --- lib/public/views/LhcFills/Overview/LhcFillsOverviewModel.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/public/views/LhcFills/Overview/LhcFillsOverviewModel.js b/lib/public/views/LhcFills/Overview/LhcFillsOverviewModel.js index 910eacc644..c57ae69c25 100644 --- a/lib/public/views/LhcFills/Overview/LhcFillsOverviewModel.js +++ b/lib/public/views/LhcFills/Overview/LhcFillsOverviewModel.js @@ -19,6 +19,7 @@ import { OverviewPageModel } from '../../../models/OverviewModel.js'; import { addStatisticsToLhcFill } from '../../../services/lhcFill/addStatisticsToLhcFill.js'; import { BeamTypeFilterModel } from '../../../components/Filters/LhcFillsFilter/BeamTypeFilterModel.js'; import { TextComparisonFilterModel } from '../../../components/Filters/common/filters/TextComparisonFilterModel.js'; +import { TimeRangeFilterModel } from '../../../components/Filters/RunsFilter/TimeRangeFilter.js'; /** * Model for the LHC fills overview page @@ -39,6 +40,8 @@ export class LhcFillsOverviewModel extends OverviewPageModel { beamDuration: new TextComparisonFilterModel(), runDuration: new TextComparisonFilterModel(), hasStableBeams: new StableBeamFilterModel(), + stableBeamsStart: new TimeRangeFilterModel(), + stableBeamsEnd: new TimeRangeFilterModel(), beamTypes: new BeamTypeFilterModel(), schemeName: new RawTextFilterModel(), }); From 78d1800bbd307e4447313df2d0892ea4b4061e57 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:49:06 +0100 Subject: [PATCH 09/15] set activefilterColumns --- .../ActiveColumns/lhcFillsActiveColumns.js | 51 ++++--------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js index a71637b9cb..940d8e96a7 100644 --- a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js +++ b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js @@ -30,6 +30,7 @@ import { beamTypeFilter } from '../../../components/Filters/LhcFillsFilter/beamT import { schemeNameFilter } from '../../../components/Filters/LhcFillsFilter/schemeNameFilter.js'; import { formatStableBeamsStart } from '../format/formatStableBeamsStart.js'; import { formatStableBeamsEnd } from '../format/formatStableBeamsEnd.js'; +import { timeRangeFilter } from '../../../components/Filters/common/filters/timeRangeFilter.js'; /** * List of active columns for a lhc fills table @@ -136,69 +137,35 @@ export const lhcFillsActiveColumns = { }, stableBeamStart: { name: 'Stable Beam Start', - visible: true, + visible: false, classes: 'w-7 f6', noEllipsis: true, - format: (_, run) => formatStableBeamsStart(run), + format: (_, lhcFill) => formatStableBeamsStart(lhcFill), exportFormat: (timestamp) => formatTimestamp(timestamp), /** * Stable Beam start filter component * - * @param {RunsOverviewModel} runsOverviewModel the runs overview model + * @param {RunsOverviewModel} lhcFillsOverviewModel the lhcFills overview model * @return {Component} the filter component */ - filter: (runsOverviewModel) => "timeRangeFilter(runsOverviewModel.filteringModel.get('o2start').timeRangeInputModel)", - profiles: { - lhcFill: true, - environment: true, - home: { - classes: 'w-10 f6', - format: (_, run) => formatStableBeamsStart(run, { inline: true }), - }, - runsPerLhcPeriod: { - classes: 'f6 w-wrapped', - }, - runsPerDataPass: { - classes: 'f6 w-wrapped', - }, - runsPerSimulationPass: { - classes: 'f6 w-wrapped', - }, - }, + filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsStart').timeRangeInputModel) }, stableBeamEnd: { name: 'Stable Beam Stop', - visible: true, + visible: false, classes: 'w-7 f6', noEllipsis: true, - format: (_, run) => formatStableBeamsEnd(run), + format: (_, lhcFill) => formatStableBeamsEnd(lhcFill), exportFormat: (timestamp) => formatTimestamp(timestamp), /** * Stable Beam end filter component * - * @param {RunsOverviewModel} runsOverviewModel the runs overview model + * @param {LhcFillsOverviewModel} lhcFillsOverviewModel the lhcFills overview model * @return {Component} the filter component */ - filter: (runsOverviewModel) => "timeRangeFilter(runsOverviewModel.filteringModel.get('o2end').timeRangeInputModel)", - profiles: { - lhcFill: true, - environment: true, - home: { - classes: 'w-10 f6', - format: (_, run) => formatStableBeamsEnd(run, { inline: true }), - }, - runsPerLhcPeriod: { - classes: 'f6 w-wrapped', - }, - runsPerDataPass: { - classes: 'f6 w-wrapped', - }, - runsPerSimulationPass: { - classes: 'f6 w-wrapped', - }, - }, + filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsEnd').timeRangeInputModel) }, meanRunDuration: { name: 'Mean run duration', From 4454965623afeebc26c4545f205b2743e21330ac Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:56:33 +0100 Subject: [PATCH 10/15] improve both formatters --- .../views/LhcFills/format/formatStableBeamsEnd.js | 2 +- .../LhcFills/format/formatStableBeamsStart.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js index cfebe89cb7..d89076cd06 100644 --- a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js +++ b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js @@ -19,7 +19,7 @@ import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; * Format a given the lhcFill's stable beam end date * * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted - * @param {number} lhcFill.stableBeamEnd the time at which a beam would end + * @param {number} [lhcFill.stableBeamEnd] the time at which a beam would end * @param {object} [configuration] eventual display configuration * @param {boolean} [configuration.inline] true if the date must be inlined * @return {Component} the formatted end date diff --git a/lib/public/views/LhcFills/format/formatStableBeamsStart.js b/lib/public/views/LhcFills/format/formatStableBeamsStart.js index c5440257ff..ba467804c2 100644 --- a/lib/public/views/LhcFills/format/formatStableBeamsStart.js +++ b/lib/public/views/LhcFills/format/formatStableBeamsStart.js @@ -18,17 +18,17 @@ import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; /** * Format a given lhcFill's stable beam start date * - * @param {LhcFill} lhcFill the lhcFill for which start date must be formatted + * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted + * @param {number} [lhcFill.stableBeamStart] the time at which a beam would start * @param {object} [configuration] eventual display configuration * @param {boolean} [configuration.inline] true if the date must be inlined * @return {Component} the formatted start date */ -export const formatStableBeamsStart = (lhcFill, configuration) => { - const { inline = false } = configuration || {}; - const { stableBeamStart } = lhcFill; - - if (stableBeamStart === null || stableBeamStart === undefined) return '-'; - +export const formatStableBeamsStart = ({ stableBeamStart }, { inline = false } = {}) => { + if (stableBeamStart == null) { // ... == null also checks for undefined because javascript + return '-'; + } + if (inline) { return h('span', [ h('.flex-row.items-center.g2', [ formatTimestamp(stableBeamStart, inline) ]), From c62100526576efff2c9a9a93923cfcb644295853 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 08:59:13 +0100 Subject: [PATCH 11/15] remove stablebeam formatters at they aren't used --- .../ActiveColumns/lhcFillsActiveColumns.js | 4 -- .../LhcFills/format/formatStableBeamsEnd.js | 41 ------------------ .../LhcFills/format/formatStableBeamsStart.js | 43 ------------------- 3 files changed, 88 deletions(-) delete mode 100644 lib/public/views/LhcFills/format/formatStableBeamsEnd.js delete mode 100644 lib/public/views/LhcFills/format/formatStableBeamsStart.js diff --git a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js index 940d8e96a7..bec45fee97 100644 --- a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js +++ b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js @@ -28,8 +28,6 @@ import { fillNumberFilter } from '../../../components/Filters/LhcFillsFilter/fil import { durationFilter } from '../../../components/Filters/LhcFillsFilter/durationFilter.js'; import { beamTypeFilter } from '../../../components/Filters/LhcFillsFilter/beamTypeFilter.js'; import { schemeNameFilter } from '../../../components/Filters/LhcFillsFilter/schemeNameFilter.js'; -import { formatStableBeamsStart } from '../format/formatStableBeamsStart.js'; -import { formatStableBeamsEnd } from '../format/formatStableBeamsEnd.js'; import { timeRangeFilter } from '../../../components/Filters/common/filters/timeRangeFilter.js'; /** @@ -140,7 +138,6 @@ export const lhcFillsActiveColumns = { visible: false, classes: 'w-7 f6', noEllipsis: true, - format: (_, lhcFill) => formatStableBeamsStart(lhcFill), exportFormat: (timestamp) => formatTimestamp(timestamp), /** @@ -156,7 +153,6 @@ export const lhcFillsActiveColumns = { visible: false, classes: 'w-7 f6', noEllipsis: true, - format: (_, lhcFill) => formatStableBeamsEnd(lhcFill), exportFormat: (timestamp) => formatTimestamp(timestamp), /** diff --git a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js b/lib/public/views/LhcFills/format/formatStableBeamsEnd.js deleted file mode 100644 index d89076cd06..0000000000 --- a/lib/public/views/LhcFills/format/formatStableBeamsEnd.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @license - * Copyright CERN and copyright holders of ALICE O2. This software is - * distributed under the terms of the GNU General Public License v3 (GPL - * Version 3), copied verbatim in the file "COPYING". - * - * See http://alice-o2.web.cern.ch/license for full licensing information. - * - * 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. - */ - -import { formatTimestamp } from '../../../utilities/formatting/formatTimestamp.js'; -import { h } from '/js/src/index.js'; -import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; - -/** - * Format a given the lhcFill's stable beam end date - * - * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted - * @param {number} [lhcFill.stableBeamEnd] the time at which a beam would end - * @param {object} [configuration] eventual display configuration - * @param {boolean} [configuration.inline] true if the date must be inlined - * @return {Component} the formatted end date - */ -export const formatStableBeamsEnd = ({ stableBeamEnd }, { inline = false } = {}) => { - if (stableBeamEnd === null || stableBeamEnd === undefined) return '-'; - - if (inline) { - return h('span', [ - h('.flex-row.items-center.g2', [ formatTimestamp(stableBeamEnd, inline) ]), - ]); - } else { - const { date, time } = getLocaleDateAndTime(stableBeamEnd); - return h('', [ - h('', date), - h('.flex-row.g2.items-center', [ h('', time) ]), - ]); - } -}; diff --git a/lib/public/views/LhcFills/format/formatStableBeamsStart.js b/lib/public/views/LhcFills/format/formatStableBeamsStart.js deleted file mode 100644 index ba467804c2..0000000000 --- a/lib/public/views/LhcFills/format/formatStableBeamsStart.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @license - * Copyright CERN and copyright holders of ALICE O2. This software is - * distributed under the terms of the GNU General Public License v3 (GPL - * Version 3), copied verbatim in the file "COPYING". - * - * See http://alice-o2.web.cern.ch/license for full licensing information. - * - * 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. - */ - -import { formatTimestamp } from '../../../utilities/formatting/formatTimestamp.js'; -import { h } from '/js/src/index.js'; -import { getLocaleDateAndTime } from '../../../utilities/dateUtils.mjs'; - -/** - * Format a given lhcFill's stable beam start date - * - * @param {LhcFill} lhcFill the lhcFill for which end date must be formatted - * @param {number} [lhcFill.stableBeamStart] the time at which a beam would start - * @param {object} [configuration] eventual display configuration - * @param {boolean} [configuration.inline] true if the date must be inlined - * @return {Component} the formatted start date - */ -export const formatStableBeamsStart = ({ stableBeamStart }, { inline = false } = {}) => { - if (stableBeamStart == null) { // ... == null also checks for undefined because javascript - return '-'; - } - - if (inline) { - return h('span', [ - h('.flex-row.items-center.g2', [ formatTimestamp(stableBeamStart, inline) ]), - ]); - } else { - const { date, time } = getLocaleDateAndTime(stableBeamStart); - return h('', [ - h('', date), - h('.flex-row.g2.items-center', [h('', time)]), - ]); - } -}; From 583f41f4038da9fe37294d1e4f133656722634c9 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 09:13:45 +0100 Subject: [PATCH 12/15] move filters to existing columns --- .../ActiveColumns/lhcFillsActiveColumns.js | 46 +++++++------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js index bec45fee97..b2657c8cfd 100644 --- a/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js +++ b/lib/public/views/LhcFills/ActiveColumns/lhcFillsActiveColumns.js @@ -66,6 +66,14 @@ export const lhcFillsActiveColumns = { visible: true, size: 'w-8', format: (timestamp) => formatTimestamp(timestamp, false), + + /** + * Stable Beam start filter component + * + * @param {RunsOverviewModel} lhcFillsOverviewModel the lhcFills overview model + * @return {Component} the filter component + */ + filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsStart').timeRangeInputModel), profiles: { lhcFill: true, environment: true, @@ -81,6 +89,14 @@ export const lhcFillsActiveColumns = { visible: true, size: 'w-8', format: (timestamp) => formatTimestamp(timestamp, false), + + /** + * Stable Beam end filter component + * + * @param {LhcFillsOverviewModel} lhcFillsOverviewModel the lhcFills overview model + * @return {Component} the filter component + */ + filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsEnd').timeRangeInputModel), profiles: { lhcFill: true, environment: true, @@ -133,36 +149,6 @@ export const lhcFillsActiveColumns = { size: 'w-8', format: (duration, lhcFill) => formatLhcFillsTimeLoss(duration, lhcFill.efficiencyLossAtEnd, false), }, - stableBeamStart: { - name: 'Stable Beam Start', - visible: false, - classes: 'w-7 f6', - noEllipsis: true, - exportFormat: (timestamp) => formatTimestamp(timestamp), - - /** - * Stable Beam start filter component - * - * @param {RunsOverviewModel} lhcFillsOverviewModel the lhcFills overview model - * @return {Component} the filter component - */ - filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsStart').timeRangeInputModel) - }, - stableBeamEnd: { - name: 'Stable Beam Stop', - visible: false, - classes: 'w-7 f6', - noEllipsis: true, - exportFormat: (timestamp) => formatTimestamp(timestamp), - - /** - * Stable Beam end filter component - * - * @param {LhcFillsOverviewModel} lhcFillsOverviewModel the lhcFills overview model - * @return {Component} the filter component - */ - filter: (lhcFillsOverviewModel) => timeRangeFilter(lhcFillsOverviewModel.filteringModel.get('stableBeamsEnd').timeRangeInputModel) - }, meanRunDuration: { name: 'Mean run duration', visible: true, From 9f2cbfa3d88ced444bcdfa701f16d793c51b2279 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Mon, 16 Feb 2026 15:38:58 +0100 Subject: [PATCH 13/15] add tests for overview --- test/public/lhcFills/overview.test.js | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/test/public/lhcFills/overview.test.js b/test/public/lhcFills/overview.test.js index 2d1f72bb28..bdb4b1c7c5 100644 --- a/test/public/lhcFills/overview.test.js +++ b/test/public/lhcFills/overview.test.js @@ -26,6 +26,8 @@ const { openFilteringPanel, expectAttributeValue, fillInput, + getPeriodInputsSelectors, + getPopoverSelector, } = require('../defaults.js'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); @@ -354,6 +356,69 @@ module.exports = () => { await waitForTableLength(page, 2); }); + it('should successfully apply stableBeamStart filter', async () => { + const popoverTrigger = '.stableBeamsStart-filter .popover-trigger'; + + await goToPage(page, 'lhc-fill-overview'); + await waitForTableLength(page, 5); + await page.waitForSelector('.column-stableBeamsStart'); + + const filterButton = await page.waitForSelector('#openFilterToggle'); + const popoverKey = await filterButton.evaluate((button) => { + return button.parentElement.getAttribute('data-popover-key'); + }); + + const filterPanelSelector = `.popover[data-popover-key="${popoverKey}"]`; + + await openFilteringPanel(page); + await page.waitForSelector(filterPanelSelector, { visible: true }); + await page.waitForSelector(popoverTrigger); + + const popOverSelector = await getPopoverSelector(await page.$(popoverTrigger)); + const { fromDateSelector, toDateSelector, fromTimeSelector, toTimeSelector } = getPeriodInputsSelectors(popOverSelector); + console.log({ fromDateSelector, toDateSelector, fromTimeSelector, toTimeSelector }); + + + await fillInput(page, fromDateSelector, '2019-08-08', ['change']); + await fillInput(page, toDateSelector, '2019-08-08', ['change']); + await fillInput(page, fromTimeSelector, '10:00', ['change']); + await fillInput(page, toTimeSelector, '12:00', ['change']); + + await openFilteringPanel(page); + await pressElement(page, popoverTrigger); + await waitForTableLength(page, 1); + }); + + it('should successfully apply stableBeamEnd filter', async () => { + const popoverTrigger = '.stableBeamsEnd-filter .popover-trigger'; + + await goToPage(page, 'lhc-fill-overview'); + await waitForTableLength(page, 5); + await page.waitForSelector('.column-stableBeamsEnd'); + + const filterButton = await page.waitForSelector('#openFilterToggle'); + const popoverKey = await filterButton.evaluate((button) => { + return button.parentElement.getAttribute('data-popover-key'); + }); + + const filterPanelSelector = `.popover[data-popover-key="${popoverKey}"]`; + + await openFilteringPanel(page); + await page.waitForSelector(filterPanelSelector, { visible: true }); + await page.waitForSelector(popoverTrigger); + + const popOverSelector = await getPopoverSelector(await page.$(popoverTrigger)); + const { fromDateSelector, toDateSelector, fromTimeSelector, toTimeSelector } = getPeriodInputsSelectors(popOverSelector); + + await fillInput(page, fromDateSelector, '2022-03-22', ['change']); + await fillInput(page, toDateSelector, '2022-03-22', ['change']); + await fillInput(page, fromTimeSelector, '01:00', ['change']); + await fillInput(page, toTimeSelector, '23:59', ['change']); + await openFilteringPanel(page); + await pressElement(page, popoverTrigger); + await waitForTableLength(page, 3); + }); + it('should successfully apply scheme name filter', async () => { const filterSchemeNameInputField= '.fillingSchemeName-filter input'; await goToPage(page, 'lhc-fill-overview'); From 1b02bd3721cde602b20b0ef0d784b212099fc7e2 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Tue, 17 Feb 2026 13:18:24 +0100 Subject: [PATCH 14/15] test: fix mis-spelling issue --- .../lhcFill/GetAllLhcFillsUseCase.test.js | 30 +++++++++---------- test/public/lhcFills/overview.test.js | 10 +++++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js index 40fdb8392f..8fbb5f2781 100644 --- a/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js +++ b/test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js @@ -31,20 +31,20 @@ module.exports = () => { }); it('should only containing lhc fills with stable beams', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); expect(lhcFills).to.be.an('array'); lhcFills.forEach((lhcFill) => { - // Every lhcFill should have stableBeamssStart - expect(lhcFill.stableBeamssStart).to.not.be.null; + // Every lhcFill should have stableBeamsStart + expect(lhcFill.stableBeamsStart).to.not.be.null; }); }); // Fill number filter tests it('should only contain specified fill number', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '6' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); expect(lhcFills).to.be.an('array').and.lengthOf(1) @@ -54,7 +54,7 @@ module.exports = () => { }) it('should only contain specified fill numbers', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '6,3' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '6,3' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); @@ -66,7 +66,7 @@ module.exports = () => { }) it('should only contain specified fill numbers, range', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: '1-3,6' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: '1-3,6' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); @@ -78,7 +78,7 @@ module.exports = () => { }) it('should only contain specified fill numbers, whitespace', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ' 6 , 3 ' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: ' 6 , 3 ' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); @@ -90,7 +90,7 @@ module.exports = () => { }) it('should only contain specified fill numbers, comma misplacement', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, fillNumbers: ',6,3,' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, fillNumbers: ',6,3,' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); @@ -102,7 +102,7 @@ module.exports = () => { }) it('should only contain matching scheme name, one precise', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, schemeName: 'schemename' } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, schemeName: 'schemename' } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); expect(lhcFills).to.be.an('array').and.lengthOf(3) @@ -129,7 +129,7 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto); expect(lhcFills).to.be.an('array').and.lengthOf(3) lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamssDuration).lessThan(43200) + expect(lhcFill.stableBeamsDuration).lessThan(43200) }); }); @@ -138,7 +138,7 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) expect(lhcFills).to.be.an('array').and.lengthOf(4) lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamssDuration).lessThanOrEqual(43200) + expect(lhcFill.stableBeamsDuration).lessThanOrEqual(43200) }); }) @@ -147,7 +147,7 @@ module.exports = () => { const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) expect(lhcFills).to.be.an('array').and.lengthOf(3) lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamssDuration).equal(100) + expect(lhcFill.stableBeamsDuration).equal(100) }); }); @@ -157,7 +157,7 @@ module.exports = () => { expect(lhcFills).to.be.an('array').and.lengthOf(4) lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamssDuration).greaterThanOrEqual(100) + expect(lhcFill.stableBeamsDuration).greaterThanOrEqual(100) }); }) @@ -167,12 +167,12 @@ module.exports = () => { expect(lhcFills).to.be.an('array').and.lengthOf(1) lhcFills.forEach((lhcFill) => { - expect(lhcFill.stableBeamssDuration).greaterThan(100) + expect(lhcFill.stableBeamsDuration).greaterThan(100) }); }) it('should only contain specified stable beam durations, = 00:00:00', async () => { - getAllLhcFillsDto.query = { filter: { hasStableBeamss: true, beamDuration: {limit: '0', operator: '='} } }; + getAllLhcFillsDto.query = { filter: { hasStableBeams: true, beamDuration: {limit: '0', operator: '='} } }; const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto) expect(lhcFills).to.be.an('array').and.lengthOf(0) diff --git a/test/public/lhcFills/overview.test.js b/test/public/lhcFills/overview.test.js index bdb4b1c7c5..b92002de91 100644 --- a/test/public/lhcFills/overview.test.js +++ b/test/public/lhcFills/overview.test.js @@ -274,12 +274,14 @@ module.exports = () => { it('should successfully display filter elements', async () => { const filterSBExpect = { selector: '.stableBeams-filter .w-30', value: 'Stable Beams Only' }; const filterFillNRExpect = {selector: 'div.items-baseline:nth-child(1) > div:nth-child(1)', value: 'Fill #'}; - const filterSBDurationExpect = {selector: 'div.items-baseline:nth-child(3) > div:nth-child(1)', value: 'SB Duration'}; + const filterSBStartExpect = {selector: 'div.items-baseline:nth-child(2) > div:nth-child(1)', value: 'SB START'}; + const filterSBEndExpect = {selector: 'div.items-baseline:nth-child(3) > div:nth-child(1)', value: 'SB END'}; + const filterSBDurationExpect = {selector: 'div.items-baseline:nth-child(5) > div:nth-child(1)', value: 'SB Duration'}; const filterSBDurationPlaceholderExpect = {selector: '#beam-duration-filter-operand', value: 'e.g 16:14:15 (HH:MM:SS)'} - const filterRunDurationExpect = {selector: 'div.flex-row:nth-child(4) > div:nth-child(1)', value: 'Total runs duration'} + const filterRunDurationExpect = {selector: 'div.flex-row:nth-child(6) > div:nth-child(1)', value: 'Total runs duration'} const filterRunDurationPlaceholderExpect = {selector: '#run-duration-filter-operand', value: 'e.g 16:14:15 (HH:MM:SS)'}; const filterSBDurationOperatorExpect = { value: true }; - const filterBeamTypeExpect = {selector: 'div.flex-row:nth-child(5) > div:nth-child(1)', value: 'Beam Type'} + const filterBeamTypeExpect = {selector: 'div.flex-row:nth-child(7) > div:nth-child(1)', value: 'Beam Type'} const filterSchemeNamePlaceholderExpect = {selector: '.fillingSchemeName-filter input', value: 'e.g. Single_12b_8_1024_8_2018'} await goToPage(page, 'lhc-fill-overview'); @@ -289,6 +291,8 @@ module.exports = () => { expect(await page.evaluate(() => document.querySelector('#beam-duration-filter-operator > option:nth-child(3)').selected)).to.equal(filterSBDurationOperatorExpect.value); await expectInnerText(page, filterSBExpect.selector, filterSBExpect.value); await expectInnerText(page, filterFillNRExpect.selector, filterFillNRExpect.value); + await expectInnerText(page, filterSBStartExpect.selector, filterSBStartExpect.value); + await expectInnerText(page, filterSBEndExpect.selector, filterSBEndExpect.value); await expectInnerText(page, filterSBDurationExpect.selector, filterSBDurationExpect.value); await expectAttributeValue(page, filterSBDurationPlaceholderExpect.selector, 'placeholder', filterSBDurationPlaceholderExpect.value); await expectInnerText(page, filterRunDurationExpect.selector, filterRunDurationExpect.value); From 49a2053b5cc0ef9614983264a85f23d033410799 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Tue, 17 Feb 2026 14:47:38 +0100 Subject: [PATCH 15/15] test: fix last and final test --- test/public/lhcFills/overview.test.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/public/lhcFills/overview.test.js b/test/public/lhcFills/overview.test.js index b92002de91..d93daeee5e 100644 --- a/test/public/lhcFills/overview.test.js +++ b/test/public/lhcFills/overview.test.js @@ -163,16 +163,19 @@ module.exports = () => { }); it('fill dropdown menu should be correct', async() => { - // activate the popover - await pressElement(page, `#row6-fillNumber-text > div:nth-child(1) > div:nth-child(2)`) - await page.waitForSelector(`body > div:nth-child(3) > div:nth-child(1)`); - await expectInnerText(page, `#copy-6 > div:nth-child(1)`, 'Copy Fill Number') + const popoverTrigger = '#row6-fillNumber-text > div:nth-child(1) > div:nth-child(2)'; - await expectLink(page, 'body > div:nth-child(4) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(3)', { + await pressElement(page, popoverTrigger); + await expectInnerText(page, '#copy-6 > div:nth-child(1)', 'Copy Fill Number'); + + const popoverSelector = await getPopoverSelector(await page.waitForSelector(popoverTrigger)); + + + await expectLink(page, `${popoverSelector} a:nth-of-type(2)`, { href: `http://localhost:4000/?page=log-create&lhcFillNumbers=6`, innerText: ' Add log to this fill' }) // disable the popover - await pressElement(page, `#row6-fillNumber-text > div:nth-child(1) > div:nth-child(2)`) + await pressElement(page, popoverTrigger) }) it('can set how many lhcFills are available per page', async () => {