Skip to content

Commit

Permalink
Fix QC flag types randomly failing (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboulais authored Jan 30, 2025
1 parent e539a88 commit f3937b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/public/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ module.exports.expectInnerText = async (page, selector, innerText) => {
} catch (_) {
const actualInnerText = await getInnerText(elementHandle);
await elementHandle.dispose();
if (actualInnerText === innerText) {
// Timeout issue resolved by itself, simply return (kind of retry for free)
return;
}
throw new Error(`Expected innerText for ${selector} to be "${innerText}", got "${actualInnerText}"`);
}
await elementHandle.dispose();
Expand Down
11 changes: 10 additions & 1 deletion test/public/qcFlagTypes/creation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const {
expectInnerText,
waitForNavigation,
expectUrlParams,
waitForTableLength,
expectAttributeValue,
} = require('../defaults.js');
const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js');

Expand Down Expand Up @@ -75,8 +77,15 @@ module.exports = () => {

await waitForNavigation(page, () => pressElement(page, 'button#submit', true));
expectUrlParams(page, { page: 'qc-flag-types-overview' });
await waitForTableLength(page, 8);

// Expect newly created flag to appear and have correct color
await expectInnerText(page, '[style*="rgb(240, 0, 240)"]', 'AAA+');
await expectAttributeValue(
page,
'#row21-name-text .badge',
'style',
'border-color: rgb(240, 0, 240); background-color: rgb(240, 0, 240); color: white;',
);
await expectInnerText(page, '#row21-name-text', 'AAA+');
});
};

0 comments on commit f3937b5

Please sign in to comment.