From 0fb608ce492a2e7508e20e7c53225f51f78f3e08 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Thu, 19 Mar 2026 12:43:52 +0100 Subject: [PATCH 1/4] feat: make pressElement more robust by using waitForFunction --- test/public/defaults.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/test/public/defaults.js b/test/public/defaults.js index d841c4bc05..b2a564126c 100644 --- a/test/public/defaults.js +++ b/test/public/defaults.js @@ -275,12 +275,26 @@ exports.waitForNavigation = waitForNavigation; * @returns {Promise} Whether the element was clickable or not. */ module.exports.pressElement = async (page, selector, jsClick = false) => { - const elementHandler = await page.waitForSelector(selector); + await page.waitForFunction( + (sel, isJsClick) => { + const element = document.querySelector(sel); + + if (!element) { + return false; + } + + if (isJsClick) { + element.click(); + } + + return true; + }, + {}, + selector, jsClick + ); - if (jsClick) { - await elementHandler.evaluate((element) => element.click()); - } else { - await elementHandler.click(selector); + if (!jsClick) { + await page.click(selector); } }; From d4f9e7216a0d110e76db952a6f6aa5f6ee4e0bad Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Thu, 19 Mar 2026 12:44:35 +0100 Subject: [PATCH 2/4] feat: make validateData wait for tablecolumns --- test/public/defaults.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/public/defaults.js b/test/public/defaults.js index b2a564126c..f15b01a9ab 100644 --- a/test/public/defaults.js +++ b/test/public/defaults.js @@ -869,10 +869,10 @@ module.exports.testTableSortingByColumn = async (page, columnId) => { * @return {Promise} resolve once data was successfully validated */ module.exports.validateTableData = async (page, validators) => { - await page.waitForSelector('table tbody'); for (const [columnId, validator] of validators) { + await page.waitForSelector(`table tbody .column-${columnId}`); + const columnData = await getColumnCellsInnerTexts(page, columnId); - expect(columnData, `Too few values for column ${columnId} or there is no such column`).to.be.length.greaterThan(0); expect( columnData.every((cellData) => validator(cellData)), `Invalid data in column ${columnId}: (${columnData})`, From 3c64037d8341356c47be16e049289a0d62b359c9 Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Thu, 19 Mar 2026 12:45:16 +0100 Subject: [PATCH 3/4] fix: fix export tests by having waiting for the button to become enabled before pressing it. --- test/public/runs/overview.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/public/runs/overview.test.js b/test/public/runs/overview.test.js index 807b821ffc..f4f5e0fb0d 100644 --- a/test/public/runs/overview.test.js +++ b/test/public/runs/overview.test.js @@ -867,6 +867,12 @@ module.exports = () => { describe("Export", () => { const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-data-trigger'; + const waitForExportButton = async () => + await page.waitForFunction((selector) => { + const button = document.querySelector(selector); + return button && !button.disabled; + }, {}, EXPORT_RUNS_TRIGGER_SELECTOR); + before(() => goToPage(page, 'run-overview')); @@ -885,6 +891,7 @@ module.exports = () => { let exportModal = await page.$('#export-data-modal'); expect(exportModal).to.be.null; + await waitForExportButton(); await page.$eval(EXPORT_RUNS_TRIGGER_SELECTOR, (button) => button.click()); await page.waitForSelector('#export-data-modal', { timeout: 5000 }); exportModal = await page.$('#export-data-modal'); @@ -893,6 +900,7 @@ module.exports = () => { }); it('should successfully display information when export will be truncated', async () => { + await waitForExportButton(); await pressElement(page, EXPORT_RUNS_TRIGGER_SELECTOR, true); const truncatedExportWarning = await page.waitForSelector('#export-data-modal #truncated-export-warning'); @@ -912,6 +920,7 @@ module.exports = () => { }); it('should successfully export filtered runs', async () => { + await waitForExportButton(); const targetFileName = 'data.json'; // First export From c7c6527e8615ffeecb4ffcfbc9a2b89b0b5e7cdf Mon Sep 17 00:00:00 2001 From: GuustMetz Date: Thu, 19 Mar 2026 13:01:57 +0100 Subject: [PATCH 4/4] fix: store table comparison by storing the table html before the change trigger occurs rather than after --- test/public/runs/runsPerDataPass.overview.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/public/runs/runsPerDataPass.overview.test.js b/test/public/runs/runsPerDataPass.overview.test.js index 5eeef9c018..73f977a303 100644 --- a/test/public/runs/runsPerDataPass.overview.test.js +++ b/test/public/runs/runsPerDataPass.overview.test.js @@ -665,8 +665,8 @@ module.exports = () => { // Press again actions dropdown to re-trigger render await pressElement(page, '#actions-dropdown-button .popover-trigger', true); setConfirmationDialogToBeAccepted(page); - await pressElement(page, `${popoverSelector} button:nth-child(4)`, true); const oldTable = await page.waitForSelector('table').then((table) => table.evaluate((t) => t.innerHTML)); + await pressElement(page, `${popoverSelector} button:nth-child(4)`, true); await pressElement(page, '#actions-dropdown-button .popover-trigger', true); await waitForTableLength(page, 3, undefined, oldTable); // Processing of data might take a bit of time, but then expect QC flag button to be there