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"); mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => { const verifyCsv = (retrievedRecords) => {
// expected output, statically configured // expected output, statically configured
// let storedRecords = [
// `Country,CityList`,
// `Afghanistan,Kabul`,
// `Algeria,"Batna, Bchar, Skikda"`,
// `American Samoa,Tafuna`,
// `Angola,"Benguela, Namibe"`,
// ];
let storedRecords = [ let storedRecords = [
`Country,CityList`, ['Country','CityList'],
`Afghanistan,Kabul`, ['Afghanistan','Kabul'],
`Algeria,"Batna, Bchar, Skikda"`, ['Algeria','Skikda', 'Bchar', 'Batna'],
`American Samoa,Tafuna`, ['American Samoa','Tafuna'],
`Angola,"Benguela, Namibe"`, ['Angola','Benguela', 'Namibe'],
]; ];
if (isPostgres()) { // if (isPostgres()) {
// order of second entry is different // // order of second entry is different
storedRecords = [ // storedRecords = [
`Country,CityList`, // `Country,CityList`,
`Afghanistan,Kabul`, // `Afghanistan,Kabul`,
`Algeria,"Skikda, Bchar, Batna"`, // `Algeria,"Skikda, Bchar, Batna"`,
`American Samoa,Tafuna`, // `American Samoa,Tafuna`,
`Angola,"Benguela, Namibe"`, // `Angola,"Benguela, Namibe"`,
]; // ];
} // }
for (let i = 0; i < storedRecords.length - 1; i++) { for (let i = 0; i < storedRecords.length - 1; i++) {
cy.log(retrievedRecords[i]); for(let j=0; j<storedRecords[i].length; j++)
expect(retrievedRecords[i]).to.be.equal(storedRecords[i]); 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