Skip to content

Commit

Permalink
test: fix TableParameters invalid files test break
Browse files Browse the repository at this point in the history
  • Loading branch information
nborde-CSM committed Jul 4, 2022
1 parent bdf629f commit 89f4f14
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cypress/commons/actions/brewery/BreweryParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,27 +339,28 @@ function deleteExampleDatasetPart3() {
FileParameters.delete(getExampleDatasetPart3());
}

function checkErrorsPanelFromList(errors, table) {
function checkErrorsPanelFromList(errors, getTable) {
const errorsCount = errors.length;
BreweryParameters.getErrorsPanel(table).should('be.visible');
BreweryParameters.getErrorsHeader(table).should('have.text', `File load failed. ${errorsCount} errors occurred:`);
BreweryParameters.getErrorsAccordions(table).should('have.length', errorsCount);
// function call is absolutely required as parameter to avoid issue with regex selector in 'find'
TableParameters.getErrorsPanel(getTable()).should('be.visible');
TableParameters.getErrorsHeader(getTable()).should('have.text', `File load failed. ${errorsCount} errors occurred:`);
TableParameters.getErrorsAccordions(getTable()).should('have.length', errorsCount);
errors.forEach((error, index) => {
if (error.summary) {
BreweryParameters.getErrorSummary(table, index).should('have.text', error.summary);
TableParameters.getErrorSummary(getTable(), index).should('have.text', error.summary);
}
if (error.loc) {
BreweryParameters.getErrorLoc(table, index).should('have.text', error.loc);
TableParameters.getErrorLoc(getTable(), index).should('have.text', error.loc);
}
});
}

function checkCustomersErrorsPanelFromList(errors) {
checkErrorsPanelFromList(errors, getCustomersTable());
checkErrorsPanelFromList(errors, getCustomersTable);
}

function checkEventsErrorsPanelFromList(errors) {
checkErrorsPanelFromList(errors, getEventsTable());
checkErrorsPanelFromList(errors, getEventsTable);
}

export const BreweryParameters = {
Expand Down

0 comments on commit 89f4f14

Please sign in to comment.