Skip to content

Commit

Permalink
Fix QC flags tests (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboulais authored Jan 9, 2025
1 parent 31b44ca commit 86f5f39
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 56 deletions.
24 changes: 14 additions & 10 deletions lib/public/components/qcFlags/qcFlagsBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,33 @@ export const qcFlagsBreadcrumbs = ({ remoteDataPass, remoteSimulationPass, remot
}

return breadcrumbs([
h('h2', header),
remoteDataPass && remoteDataPass.match({
Success: ({ id, name }) => h('h2', frontLink(name, 'runs-per-data-pass', { dataPassId: id })),
h('h2#breadcrumb-header', header),
remoteDataPass?.match({
Success: ({ id, name }) => h('h2#breadcrumb-data-pass-name', frontLink(name, 'runs-per-data-pass', { dataPassId: id })),
Failure: () => tooltip(h('.f3', iconWarning()), 'Not able to load data pass info'),
Loading: () => h('', spinner({ size: 2, absolute: false })),
NotAsked: () => tooltip(h('.f3', iconWarning()), 'No data pass data was asked for'),
}),
remoteSimulationPass && remoteSimulationPass.match({
Success: ({ id, name }) => h('h2', frontLink(name, 'runs-per-simulation-pass', { simulationPassId: id })),
remoteSimulationPass?.match({
Success: ({ id, name }) => h(
'h2#breadcrumb-simulation-pass-name',
frontLink(name, 'runs-per-simulation-pass', { simulationPassId: id }),
),
Failure: () => tooltip(h('.f3', iconWarning()), 'Not able to load simulation pass info'),
Loading: () => h('', spinner({ size: 2, absolute: false })),
NotAsked: () => tooltip(h('.f3', iconWarning()), 'No simulation pass data was asked for'),
}),
remoteRun.match({
Success: ({ runNumber, runQuality }) => runQuality === RunQualities.BAD
? h('h2.danger', frontLink(runNumber, 'run-detail', { runNumber }))
: h('h2', frontLink(runNumber, 'run-detail', { runNumber })),
Success: ({ runNumber, runQuality }) => h(
`h2#breadcrumb-run-number${runQuality === RunQualities.BAD ? '.danger' : ''}`,
frontLink(runNumber, 'run-detail', { runNumber }),
),
Failure: () => tooltip(h('.f3', iconWarning()), 'Not able to load run info'),
Loading: () => h('', spinner({ size: 2, absolute: false })),
NotAsked: () => tooltip(h('.f3', iconWarning()), 'No run data was asked for'),
}),
remoteDplDetector && remoteDplDetector.match({
Success: (dplDetector) => h('h2', dplDetector.name),
remoteDplDetector?.match({
Success: (dplDetector) => h('h2#breadcrumb-detector-name', dplDetector.name),
Failure: () => tooltip(h('.f3', iconWarning()), 'Not able to load detector info'),
Loading: () => h('', spinner({ size: 2, absolute: false })),
NotAsked: () => tooltip(h('.f3', iconWarning()), 'No detector data was asked for'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const DataPassesPerSimulationPassOverviewPage = ({ dataPasses: {

const { items, simulationPass, pagination } = dataPassesPerSimulationPassOverviewModel;

const commonTitle = h('h2', 'Data Passes per MC');
const commonTitle = h('h2#breadcrumb-header', 'Data Passes per MC');

return h('', {
onremove: () => dataPassesPerSimulationPassOverviewModel.reset(),
Expand All @@ -63,7 +63,7 @@ export const DataPassesPerSimulationPassOverviewPage = ({ dataPasses: {
h(
'.flex-row.g1.items-center',
simulationPass.match({
Success: (payload) => breadcrumbs([commonTitle, h('h2', payload.name)]),
Success: (payload) => breadcrumbs([commonTitle, h('h2#breadcrumb-simulation-pass-name', payload.name)]),
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to load simulation pass info')],
Loading: () => [commonTitle, h('', spinner({ size: 2, absolute: false }))],
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const RunsPerDataPassOverviewPage = ({
),
};

const commonTitle = h('h2', { style: 'white-space: nowrap;' }, 'Physics Runs');
const commonTitle = h('h2#breadcrumb-header', { style: 'white-space: nowrap;' }, 'Physics Runs');

return h('', { onremove: () => perDataPassOverviewModel.reset(false) }, [
h('.flex-row.justify-between.items-center.g2', [
Expand All @@ -210,7 +210,7 @@ export const RunsPerDataPassOverviewPage = ({
'.flex-row.g1.items-center',
remoteDataPass.match({
Success: (dataPass) => h('.flex-row.items-center.g1', [
breadcrumbs([commonTitle, h('h2', dataPass.name)]),
breadcrumbs([commonTitle, h('h2#breadcrumb-data-pass-name', dataPass.name)]),
h('#skimmableControl', skimmableControl(
dataPass,
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ export const RunsPerSimulationPassOverviewPage = ({
),
};

const commonTitle = h('h2', 'Runs per MC');
const commonTitle = h('h2#breadcrumb-header', 'Runs per MC');
return h('', [
h('.flex-row.justify-between.items-center.g2', [
h(
'.flex-row.g1.items-center',
remoteSimulationPass.match({
Success: ({ name }) => breadcrumbs([commonTitle, h('h2', name)]),
Success: ({ name }) => breadcrumbs([commonTitle, h('h2#breadcrumb-simulation-pass-name', name)]),
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to load simulation pass info')],
Loading: () => [commonTitle, h('', spinner({ size: 2, absolute: false }))],
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const AnchoredSimulationPassesOverviewPage = ({

const { items, dataPass, pagination } = anchoredSimulationPassesOverviewModel;

const commonTitle = h('h2', { style: 'white-space: nowrap;' }, 'Anchored MC');
const commonTitle = h('h2#breadcrumb-header', { style: 'white-space: nowrap;' }, 'Anchored MC');

return h(
'',
Expand All @@ -54,7 +54,7 @@ export const AnchoredSimulationPassesOverviewPage = ({
h(
'.flex-row.g1.items-center',
dataPass.match({
Success: (payload) => breadcrumbs([commonTitle, h('h2', payload.name)]),
Success: (payload) => breadcrumbs([commonTitle, h('h2#breadcrumb-simulation-pass-name', payload.name)]),
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to load data pass info')],
Loading: () => [commonTitle, spinner({ size: 2, absolute: false })],
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const SimulationPassesPerLhcPeriodOverviewPage = ({ simulationPasses: {

const { items: simulationPasses, lhcPeriod } = simulationPassesPerLhcPeriodOverviewModel;

const commonTitle = h('h2', { style: 'white-space: nowrap;' }, 'Monte Carlo');
const commonTitle = h('h2#breadcrumb-header', { style: 'white-space: nowrap;' }, 'Monte Carlo');

return h('', {
onremove: () => simulationPassesPerLhcPeriodOverviewModel.reset(),
Expand All @@ -50,7 +50,7 @@ export const SimulationPassesPerLhcPeriodOverviewPage = ({ simulationPasses: {
h(
'.flex-row.g1.items-center',
lhcPeriod.match({
Success: (payload) => breadcrumbs([commonTitle, h('h2', payload.name)]),
Success: (payload) => breadcrumbs([commonTitle, h('h2#breadcrumb-lhc-period-name', payload.name)]),
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to load LHC Period info')],
Loading: () => [commonTitle, spinner({ size: 2, absolute: false })],
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
Expand Down
12 changes: 6 additions & 6 deletions test/public/qcFlags/forDataPassCreation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'QC');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC22b_apass1');
await expectInnerText(page, 'h2:nth-of-type(3)', '106');
await expectInnerText(page, 'h2:nth-of-type(4)', 'CPV');
await expectInnerText(page, '#breadcrumb-header', 'QC');
await expectInnerText(page, '#breadcrumb-data-pass-name', 'LHC22b_apass1');
await expectInnerText(page, '#breadcrumb-run-number', '106');
await expectInnerText(page, '#breadcrumb-detector-name', 'CPV');
});

it('can navigate to runs per data pass page from breadcrumbs link', async () => {
Expand All @@ -77,7 +77,7 @@ module.exports = () => {
},
});

await waitForNavigation(page, () => pressElement(page, '.breadcrumbs *:nth-child(3) a'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-data-pass-name a'));
expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId: '1' });
});

Expand All @@ -90,7 +90,7 @@ module.exports = () => {
},
});

await waitForNavigation(page, () => pressElement(page, '.breadcrumbs *:nth-child(5) a'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-run-number a'));
expectUrlParams(page, { page: 'run-detail', runNumber: '106' });
});

Expand Down
14 changes: 7 additions & 7 deletions test/public/qcFlags/forDataPassOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'QC');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC22b_apass1');
await expectInnerText(page, 'h2:nth-of-type(3)', '106');
await expectInnerText(page, 'h2:nth-of-type(4)', 'CPV');
await expectInnerText(page, '#breadcrumb-header', 'QC');
await expectInnerText(page, '#breadcrumb-data-pass-name', 'LHC22b_apass1');
await expectInnerText(page, '#breadcrumb-run-number', '106');
await expectInnerText(page, '#breadcrumb-detector-name', 'CPV');
});

it('can navigate to runs per data pass page from breadcrumbs link', async () => {
Expand All @@ -72,7 +72,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-data-pass-name'));
expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId: '1' });
});

Expand All @@ -83,7 +83,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(3)'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-run-number'));
expectUrlParams(page, { page: 'run-detail', runNumber: '106' });
});

Expand Down Expand Up @@ -118,7 +118,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await page.waitForSelector('.breadcrumbs *:nth-child(5).danger a');
await page.waitForSelector('#breadcrumb-run-number.danger a');
const title = 'Quality of the run was changed to bad so it is no more subject to QC';
await page.waitForSelector(`button.btn.btn-primary[disabled][title="${title}"]`);
});
Expand Down
12 changes: 6 additions & 6 deletions test/public/qcFlags/forSimulationPassCreation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'QC');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC23k6c');
await expectInnerText(page, 'h2:nth-of-type(3)', '106');
await expectInnerText(page, 'h2:nth-of-type(4)', 'CPV');
await expectInnerText(page, '#breadcrumb-header', 'QC');
await expectInnerText(page, '#breadcrumb-simulation-pass-name', 'LHC23k6c');
await expectInnerText(page, '#breadcrumb-run-number', '106');
await expectInnerText(page, '#breadcrumb-detector-name', 'CPV');
});

it('can navigate to runs per simulation pass page from breadcrumbs link', async () => {
Expand All @@ -77,7 +77,7 @@ module.exports = () => {
},
});

await waitForNavigation(page, () => pressElement(page, '.breadcrumbs *:nth-child(3) a'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-simulation-pass-name a'));
expectUrlParams(page, { page: 'runs-per-simulation-pass', simulationPassId: '1' });
});

Expand All @@ -90,7 +90,7 @@ module.exports = () => {
},
});

await waitForNavigation(page, () => pressElement(page, '.breadcrumbs *:nth-child(5) a'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-run-number a'));
expectUrlParams(page, { page: 'run-detail', runNumber: '106' });
});

Expand Down
12 changes: 6 additions & 6 deletions test/public/qcFlags/forSimulationPassOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'QC');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC23k6c');
await expectInnerText(page, 'h2:nth-of-type(3)', '106');
await expectInnerText(page, 'h2:nth-of-type(4)', 'CPV');
await expectInnerText(page, '#breadcrumb-header', 'QC');
await expectInnerText(page, '#breadcrumb-simulation-pass-name', 'LHC23k6c');
await expectInnerText(page, '#breadcrumb-run-number', '106');
await expectInnerText(page, '#breadcrumb-detector-name', 'CPV');
});

it('can navigate to runs per simulation pass page from breadcrumbs link', async () => {
Expand All @@ -73,7 +73,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-simulation-pass-name'));
expectUrlParams(page, { page: 'runs-per-simulation-pass', simulationPassId: '1' });
});

Expand All @@ -84,7 +84,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(3)'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-run-number'));
expectUrlParams(page, { page: 'run-detail', runNumber: '106' });
});

Expand Down
10 changes: 5 additions & 5 deletions test/public/qcFlags/gaqOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'GAQ');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC22b_apass1');
await expectInnerText(page, 'h2:nth-of-type(3)', '106');
await expectInnerText(page, '#breadcrumb-header', 'GAQ');
await expectInnerText(page, '#breadcrumb-data-pass-name', 'LHC22b_apass1');
await expectInnerText(page, '#breadcrumb-run-number', '106');
});

it('shows correct datatypes in respective columns', async () => {
Expand Down Expand Up @@ -98,15 +98,15 @@ module.exports = () => {
],
]);

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2) a', true));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-data-pass-name a', true));
await waitForNavigation(page, () => pressElement(page, '#row106-EMC a', true));
await pressElement(page, '#flag-type-panel .popover-trigger', true);
await pressElement(page, '#flag-type-dropdown-option-3', true);

await page.waitForSelector('button#submit[disabled]', { hidden: true, timeout: 250 });
await waitForNavigation(page, () => pressElement(page, 'button#submit', true));

await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2) a', true));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-data-pass-name a', true));
await waitForNavigation(page, () => pressElement(page, '#row106-globalAggregatedQuality a', true));

await waitForTableLength(page, 7);
Expand Down
8 changes: 4 additions & 4 deletions test/public/qcFlags/synchronousOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ module.exports = () => {
expect(response.status()).to.equal(200);
expect(await page.title()).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'Sync QC');
await expectInnerText(page, 'h2:nth-of-type(2)', '56');
await expectInnerText(page, 'h2:nth-of-type(3)', 'FT0');
await expectInnerText(page, '#breadcrumb-header', 'Sync QC');
await expectInnerText(page, '#breadcrumb-run-number', '56');
await expectInnerText(page, '#breadcrumb-detector-name', 'FT0');
});

it('shows correct datatypes in respective columns', async () => {
Expand All @@ -81,7 +81,7 @@ module.exports = () => {
});

it('can navigate to run details page from breadcrumbs link', async () => {
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
await waitForNavigation(page, () => pressElement(page, '#breadcrumb-run-number'));
expectUrlParams(page, { page: 'run-detail', runNumber: '56' });
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ module.exports = () => {
const title = await page.title();
expect(title).to.equal('AliceO2 Bookkeeping');

await expectInnerText(page, 'h2:nth-of-type(1)', 'Anchored MC');
await expectInnerText(page, 'h2:nth-of-type(2)', 'LHC22a_apass1');
await expectInnerText(page, '#breadcrumb-header', 'Anchored MC');
await expectInnerText(page, '#breadcrumb-simulation-pass-name', 'LHC22a_apass1');
});

it('shows correct datatypes in respective columns', async () => {
Expand Down

0 comments on commit 86f5f39

Please sign in to comment.