Browse Source

test/cypress: download csv data verification ignoring order

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/1876/head
Raju Udava 3 years ago
parent
commit
3c9aac6039
  1. 45
      scripts/cypress/integration/common/6b_downloadCsv.js

45
scripts/cypress/integration/common/6b_downloadCsv.js

@ -23,28 +23,39 @@ export const genTest = (apiType, dbType) => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
// let storedRecords = [
// `Country,CityList`,
// `Afghanistan,Kabul`,
// `Algeria,"Batna, Bchar, Skikda"`,
// `American Samoa,Tafuna`,
// `Angola,"Benguela, Namibe"`,
// ];
let storedRecords = [
`Country,CityList`,
`Afghanistan,Kabul`,
`Algeria,"Batna, Bchar, Skikda"`,
`American Samoa,Tafuna`,
`Angola,"Benguela, Namibe"`,
['Country','CityList'],
['Afghanistan','Kabul'],
['Algeria','Skikda', 'Bchar', 'Batna'],
['American Samoa','Tafuna'],
['Angola','Benguela', 'Namibe'],
];
if (isPostgres()) {
// order of second entry is different
storedRecords = [
`Country,CityList`,
`Afghanistan,Kabul`,
`Algeria,"Skikda, Bchar, Batna"`,
`American Samoa,Tafuna`,
`Angola,"Benguela, Namibe"`,
];
}
// if (isPostgres()) {
// // order of second entry is different
// storedRecords = [
// `Country,CityList`,
// `Afghanistan,Kabul`,
// `Algeria,"Skikda, Bchar, Batna"`,
// `American Samoa,Tafuna`,
// `Angola,"Benguela, Namibe"`,
// ];
// }
for (let i = 0; i < storedRecords.length - 1; i++) {
cy.log(retrievedRecords[i]);
expect(retrievedRecords[i]).to.be.equal(storedRecords[i]);
for(let j=0; j<storedRecords[i].length; j++)
expect(retrievedRecords[i]).to.have.string(storedRecords[i][j])
// often, the order in which records "Skikda, Bchar, Batna" appear, used to toggle
// hence verifying record contents separately
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i]);
}
};

Loading…
Cancel
Save