diff --git a/.github/workflows/bookkeeping.yml b/.github/workflows/bookkeeping.yml index 364556cc47..47a2974476 100644 --- a/.github/workflows/bookkeeping.yml +++ b/.github/workflows/bookkeeping.yml @@ -30,6 +30,7 @@ jobs: logs, envs, runs, + runs-per-period-or-pass, tags, flps, home, diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index f782a26d3d..344dcc4a32 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -8,6 +8,7 @@ services: NODE_ENV: development DATABASE_LOGGING: "${DATABASE_LOGGING-True}" JWT_SECRET: BOOKKEEPING-DEV + PAGE_ITEMS_LIMIT: 100 GRPC_INTERNAL_ORIGIN: '[::]:4001' GRPC_AUTHENTICATED_ORIGIN: '[::]:4002' ports: diff --git a/test/public/index.js b/test/public/index.js index 293d9a9e94..6acacbeb69 100644 --- a/test/public/index.js +++ b/test/public/index.js @@ -28,6 +28,7 @@ const SimulationPassesSuite = require('./simulationPasses'); const QcFlagTypesSuite = require('./qcFlagTypes'); const QcFlagsSuite = require('./qcFlags'); const FilterSuite = require('./Filters'); +const RunsPerPeriodOrPass = require('./runsPerPeriodOrPass'); module.exports = () => { describe('Components', ComponentsSuite); @@ -37,6 +38,7 @@ module.exports = () => { describe('Logs', LogsSuite); describe('Envs', EnvsSuite); describe('Runs', RunsSuite); + describe('RunsPerDataPassesAndPeriods', RunsPerPeriodOrPass); describe('Tags', TagsSuite); describe('Flps', FlpsSuite); describe('Home', HomeSuite); diff --git a/test/public/qcFlags/detailsForDataPass.test.js b/test/public/qcFlags/detailsForDataPass.test.js index 3c46f0d6a1..50d328c5c4 100644 --- a/test/public/qcFlags/detailsForDataPass.test.js +++ b/test/public/qcFlags/detailsForDataPass.test.js @@ -27,7 +27,7 @@ const { waitForTableLength, } = require('../defaults.js'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); -const { navigateToRunsPerDataPass } = require('../runs/navigationUtils.js'); +const { navigateToRunsPerDataPass } = require('../runsPerPeriodOrPass/dataPassesUtilities.js'); const { expect } = chai; diff --git a/test/public/qcFlags/forDataPassCreation.test.js b/test/public/qcFlags/forDataPassCreation.test.js index 3c49eb4bde..47e3692d47 100644 --- a/test/public/qcFlags/forDataPassCreation.test.js +++ b/test/public/qcFlags/forDataPassCreation.test.js @@ -28,7 +28,7 @@ const { getTableContent, } = require('../defaults.js'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); -const { navigateToRunsPerDataPass } = require('../runs/navigationUtils.js'); +const { navigateToRunsPerDataPass } = require('../runsPerPeriodOrPass/dataPassesUtilities.js'); const { expect } = chai; diff --git a/test/public/runs/dataPassesUtilities.js b/test/public/runs/dataPassesUtilities.js deleted file mode 100644 index 420940c95a..0000000000 --- a/test/public/runs/dataPassesUtilities.js +++ /dev/null @@ -1,21 +0,0 @@ -const { waitForNavigation, pressElement, getInnerText, expectUrlParams, waitForTableLength } = require('../defaults.js'); - -/** - * Navigate to Runs per Data Pass page - * - * @param {Puppeteer.Page} page page - * @param {number} lhcPeriodId id of lhc period on LHC Period overview page - * @param {number} dataPassId id of data pass on Data Passes per LHC Period page - * @param {number} expectedRowsCount expected number of rows on runs per data pass page - * @return {Promise} promise - */ -exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expectedRowsCount) => { - await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - const pdpBeamTypes = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-pdpBeamTypes`)); - await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true)); - expectUrlParams(page, { page: 'data-passes-per-lhc-period-overview', lhcPeriodId }); - await page.waitForSelector('th#description'); - await waitForNavigation(page, () => pressElement(page, `#row${dataPassId}-associatedRuns a`, true)); - expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId, pdpBeamTypes }); - await waitForTableLength(page, expectedRowsCount); -}; diff --git a/test/public/runs/index.js b/test/public/runs/index.js index 1f183327cd..d41f96315f 100644 --- a/test/public/runs/index.js +++ b/test/public/runs/index.js @@ -13,14 +13,8 @@ const OverviewSuite = require('./overview.test'); const DetailSuite = require('./detail.test'); -const RunsPerPeriodOverviewSuite = require('./runsPerLhcPeriod.overview.test'); -const RunsPerDataPassOverviewPage = require('./runsPerDataPass.overview.test'); -const RunsPerSimulationPassOverviewPage = require('./runsPerSimulationPass.overview.test'); module.exports = () => { describe('Overview Page', OverviewSuite); describe('Detail Page', DetailSuite); - describe('Runs Per LHC Period Overview Page', RunsPerPeriodOverviewSuite); - describe('Runs Per Data Pass Overview Page', RunsPerDataPassOverviewPage); - describe('Runs Per Simulation Pass Overview Page', RunsPerSimulationPassOverviewPage); }; diff --git a/test/public/runs/navigationUtils.js b/test/public/runs/navigationUtils.js index c728991911..bb5913cbef 100644 --- a/test/public/runs/navigationUtils.js +++ b/test/public/runs/navigationUtils.js @@ -22,58 +22,3 @@ const { waitForNavigation, pressElement, expectUrlParams, waitForTableLength } = exports.navigateToRunsOverview = async (page) => { await waitForNavigation(page, () => pressElement(page, 'a#run-overview', true)); }; - - -/** - * Navigate to Runs per LHC period - * - * @param {Puppeteer.Page} page page - * @param {number} lhcPeriodId id of lhc period on LHC Period overview page - * @param {number} expectedRowsCount expected number of rows on runs per data pass page - * @return {Promise} promise - */ -exports.navigateToRunsPerLhcPeriod = async (page, lhcPeriodId, expectedRowsCount) => { - await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedRuns a`, true)); - expectUrlParams(page, { page: 'runs-per-lhc-period', lhcPeriodId }, ['pdpBeamType']); - await waitForTableLength(page, expectedRowsCount); -}; - -/** - * Navigate to Runs per Data Pass page - * - * @param {Puppeteer.Page} page page - * @param {number} lhcPeriodId id of lhc period on LHC Period overview page - * @param {number} dataPassId id of data pass on Data Passes per LHC Period page - * @param {number} expectedRowsCount expected number of rows on runs per data pass page - * @return {Promise} promise - */ -exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expectedRowsCount) => { - await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true)); - expectUrlParams(page, { page: 'data-passes-per-lhc-period-overview', lhcPeriodId }); - await page.waitForSelector('th#description'); - await waitForNavigation(page, () => pressElement(page, `#row${dataPassId}-associatedRuns a`, true)); - expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId }, ['pdpBeamType']); - await waitForTableLength(page, expectedRowsCount); -}; - - -/** - * Navigate to Runs per Simulation Pass page - * - * @param {Puppeteer.Page} page page - * @param {number} lhcPeriodId id of lhc period on LHC Period overview page - * @param {number} simulationPassId id of data pass on Data Passes per LHC Period page - * @param {number} expectedRowsCount expected number of rows on runs per data pass page - * @return {Promise} promise - */ -exports.navigateToRunsPerSimulationPass = async (page, lhcPeriodId, simulationPassId, expectedRowsCount) => { - await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedSimulationPasses a`, true)); - expectUrlParams(page, { page: 'simulation-passes-per-lhc-period-overview', lhcPeriodId }); - await page.waitForSelector('th#description'); - await waitForNavigation(page, () => pressElement(page, `#row${simulationPassId}-associatedRuns a`, true)); - expectUrlParams(page, { page: 'runs-per-simulation-pass', simulationPassId }); - await waitForTableLength(page, expectedRowsCount); -}; diff --git a/test/public/runsPerPeriodOrPass/dataPassesUtilities.js b/test/public/runsPerPeriodOrPass/dataPassesUtilities.js new file mode 100644 index 0000000000..b9b83e29c7 --- /dev/null +++ b/test/public/runsPerPeriodOrPass/dataPassesUtilities.js @@ -0,0 +1,55 @@ +const { waitForNavigation, pressElement, getInnerText, expectUrlParams, waitForTableLength } = require('../defaults.js'); + +/** + * Navigate to Runs per LHC period + * + * @param {Puppeteer.Page} page page + * @param {number} lhcPeriodId id of lhc period on LHC Period overview page + * @param {number} expectedRowsCount expected number of rows on runs per data pass page + * @return {Promise} promise + */ +exports.navigateToRunsPerLhcPeriod = async (page, lhcPeriodId, expectedRowsCount) => { + await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); + await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedRuns a`, true)); + expectUrlParams(page, { page: 'runs-per-lhc-period', lhcPeriodId }, ['pdpBeamType']); + await waitForTableLength(page, expectedRowsCount); +}; + +/** + * Navigate to Runs per Data Pass page + * + * @param {Puppeteer.Page} page page + * @param {number} lhcPeriodId id of lhc period on LHC Period overview page + * @param {number} dataPassId id of data pass on Data Passes per LHC Period page + * @param {number} expectedRowsCount expected number of rows on runs per data pass page + * @return {Promise} promise + */ +exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expectedRowsCount) => { + await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); + await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true)); + expectUrlParams(page, { page: 'data-passes-per-lhc-period-overview', lhcPeriodId }); + await page.waitForSelector('th#description'); + await waitForNavigation(page, () => pressElement(page, `#row${dataPassId}-associatedRuns a`, true)); + expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId }, ['pdpBeamType']); + await waitForTableLength(page, expectedRowsCount); +}; + + +/** + * Navigate to Runs per Simulation Pass page + * + * @param {Puppeteer.Page} page page + * @param {number} lhcPeriodId id of lhc period on LHC Period overview page + * @param {number} simulationPassId id of data pass on Data Passes per LHC Period page + * @param {number} expectedRowsCount expected number of rows on runs per data pass page + * @return {Promise} promise + */ +exports.navigateToRunsPerSimulationPass = async (page, lhcPeriodId, simulationPassId, expectedRowsCount) => { + await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); + await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedSimulationPasses a`, true)); + expectUrlParams(page, { page: 'simulation-passes-per-lhc-period-overview', lhcPeriodId }); + await page.waitForSelector('th#description'); + await waitForNavigation(page, () => pressElement(page, `#row${simulationPassId}-associatedRuns a`, true)); + expectUrlParams(page, { page: 'runs-per-simulation-pass', simulationPassId }); + await waitForTableLength(page, expectedRowsCount); +}; diff --git a/test/public/runsPerPeriodOrPass/index.js b/test/public/runsPerPeriodOrPass/index.js new file mode 100644 index 0000000000..e607cc7590 --- /dev/null +++ b/test/public/runsPerPeriodOrPass/index.js @@ -0,0 +1,22 @@ +/** + * @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. + */ + +const RunsPerPeriodOverviewSuite = require('./runsPerLhcPeriod.overview.test'); +const RunsPerDataPassOverviewPage = require('./runsPerDataPass.overview.test'); +const RunsPerSimulationPassOverviewPage = require('./runsPerSimulationPass.overview.test'); + +module.exports = () => { + describe('Runs Per LHC Period Overview Page', RunsPerPeriodOverviewSuite); + describe('Runs Per Data Pass Overview Page', RunsPerDataPassOverviewPage); + describe('Runs Per Simulation Pass Overview Page', RunsPerSimulationPassOverviewPage); +}; diff --git a/test/public/runs/runsPerDataPass.overview.test.js b/test/public/runsPerPeriodOrPass/runsPerDataPass.overview.test.js similarity index 99% rename from test/public/runs/runsPerDataPass.overview.test.js rename to test/public/runsPerPeriodOrPass/runsPerDataPass.overview.test.js index 6a9ecf34ca..31aad4c819 100644 --- a/test/public/runs/runsPerDataPass.overview.test.js +++ b/test/public/runsPerPeriodOrPass/runsPerDataPass.overview.test.js @@ -40,7 +40,7 @@ const { const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); const DataPassRepository = require('../../../lib/database/repositories/DataPassRepository.js'); const { BkpRoles } = require('../../../lib/domain/enums/BkpRoles.js'); -const { navigateToRunsPerDataPass } = require('./navigationUtils.js'); +const { navigateToRunsPerDataPass } = require('./dataPassesUtilities.js'); const { expect } = chai; diff --git a/test/public/runs/runsPerLhcPeriod.overview.test.js b/test/public/runsPerPeriodOrPass/runsPerLhcPeriod.overview.test.js similarity index 99% rename from test/public/runs/runsPerLhcPeriod.overview.test.js rename to test/public/runsPerPeriodOrPass/runsPerLhcPeriod.overview.test.js index 98f6e955ed..ddadf1c2ce 100644 --- a/test/public/runs/runsPerLhcPeriod.overview.test.js +++ b/test/public/runsPerPeriodOrPass/runsPerLhcPeriod.overview.test.js @@ -37,7 +37,7 @@ const { const { RUN_QUALITIES, RunQualities } = require('../../../lib/domain/enums/RunQualities.js'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); const { RunDefinition } = require('../../../lib/domain/enums/RunDefinition.js'); -const { navigateToRunsPerLhcPeriod } = require('./navigationUtils.js'); +const { navigateToRunsPerLhcPeriod } = require('./dataPassesUtilities.js'); const { expect } = chai; diff --git a/test/public/runs/runsPerSimulationPass.overview.test.js b/test/public/runsPerPeriodOrPass/runsPerSimulationPass.overview.test.js similarity index 99% rename from test/public/runs/runsPerSimulationPass.overview.test.js rename to test/public/runsPerPeriodOrPass/runsPerSimulationPass.overview.test.js index d4c4413a5b..b7ae7cac34 100644 --- a/test/public/runs/runsPerSimulationPass.overview.test.js +++ b/test/public/runsPerPeriodOrPass/runsPerSimulationPass.overview.test.js @@ -35,9 +35,9 @@ const { } = require('../defaults.js'); const { expect } = chai; -const { qcFlagService } = require('../../../lib/server/services/qualityControlFlag/QcFlagService'); +const { qcFlagService } = require('../../../lib/server/services/qualityControlFlag/QcFlagService.js'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); -const { navigateToRunsPerSimulationPass } = require('./navigationUtils.js'); +const { navigateToRunsPerSimulationPass } = require('./dataPassesUtilities.js'); const DETECTORS = [ 'CPV', diff --git a/test/scripts/parallel-local/main.js b/test/scripts/parallel-local/main.js index ea15c0b426..305f2b25ab 100644 --- a/test/scripts/parallel-local/main.js +++ b/test/scripts/parallel-local/main.js @@ -17,6 +17,7 @@ const testSuites = [ 'logs', 'envs', 'runs', + 'runs-per-period-or-pass', 'tags', 'flps', 'home', diff --git a/test/scripts/test-runs-per-period-or-pass.js b/test/scripts/test-runs-per-period-or-pass.js new file mode 100644 index 0000000000..9322c7744f --- /dev/null +++ b/test/scripts/test-runs-per-period-or-pass.js @@ -0,0 +1,34 @@ +/** + * @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. + */ + +const application = require('../../lib/application'); +const RunsPerPeriodOverviewSuite = require('../public/runsPerPeriodOrPass/runsPerLhcPeriod.overview.test'); +const RunsPerDataPassOverviewPage = require('../public/runsPerPeriodOrPass/runsPerDataPass.overview.test'); +const RunsPerSimulationPassOverviewPage = require('../public/runsPerPeriodOrPass/runsPerSimulationPass.overview.test'); + +describe('Bookkeeping', () => { + before(async () => { + await application.run(); + await application.connectDatabase(); + }); + + after(async () => { + await application.stop(true); + }); + + describe('Runs', () => { + describe('Runs Per LHC Period Overview Page', RunsPerPeriodOverviewSuite); + describe('Runs Per Data Pass Overview Page', RunsPerDataPassOverviewPage); + describe('Runs Per Simulation Pass Overview Page', RunsPerSimulationPassOverviewPage); + }); +}); diff --git a/test/scripts/test-runs.js b/test/scripts/test-runs.js index 0708a9549e..81eba1b22f 100644 --- a/test/scripts/test-runs.js +++ b/test/scripts/test-runs.js @@ -14,9 +14,6 @@ const application = require('../../lib/application'); const OverviewSuite = require('../public/runs/overview.test'); const DetailSuite = require('../public/runs/detail.test'); -const RunsPerPeriodOverviewSuite = require('../public/runs/runsPerLhcPeriod.overview.test'); -const RunsPerDataPassOverviewPage = require('../public/runs/runsPerDataPass.overview.test'); -const RunsPerSimulationPassOverviewPage = require('../public/runs/runsPerSimulationPass.overview.test'); describe('Bookkeeping', () => { before(async () => { @@ -31,8 +28,5 @@ describe('Bookkeeping', () => { describe('Runs', () => { describe('Overview Page', OverviewSuite); describe('Detail Page', DetailSuite); - describe('Runs Per LHC Period Overview Page', RunsPerPeriodOverviewSuite); - describe('Runs Per Data Pass Overview Page', RunsPerDataPassOverviewPage); - describe('Runs Per Simulation Pass Overview Page', RunsPerSimulationPassOverviewPage); }); });