Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions test/public/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

if (jsClick) {
await elementHandler.evaluate((element) => element.click());
} else {
await elementHandler.click(selector);
return true;
},
{},
selector, jsClick
);

if (!jsClick) {
await page.click(selector);
}
};

Expand Down Expand Up @@ -855,10 +869,10 @@ module.exports.testTableSortingByColumn = async (page, columnId) => {
* @return {Promise<void>} 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})`,
Expand Down
9 changes: 9 additions & 0 deletions test/public/runs/overview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -912,6 +920,7 @@ module.exports = () => {
});

it('should successfully export filtered runs', async () => {
await waitForExportButton();
const targetFileName = 'data.json';

// First export
Expand Down
2 changes: 1 addition & 1 deletion test/public/runs/runsPerDataPass.overview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading