Drive your test using test data
Now you can drive your protractor tests using CSV data:
I have created an npm package that reads CSV synchronously and converts it into an array of properties:
Demo CSV: (just copy it to notepad and save as 1.csv)
a,b,c
1,2,3
1,5,6
2,4,6
Output:

npm package:
https://www.npmjs.com/package/csv-parser-sync-plus-promise
Usage:
importing:
let parser = require('csv-parser-sync-plus-promise')
Use as sync:
let a=parser.readCsvSync('')
Use as Promise:
let b=parser.readCsvPromise('')
it('test {Regression} {Sanity} {Sanity}', async function () {
console.log(await b);
});
Protractor test:
Use the demo csv ‘1.csv’
'use strict';
let parser = require('csv-parser-sync-plus-promise')
let testdata=parser.readCsvSync('<full_path>/1.csv');
describe('Validate dfsfdsf 1 behaviour', function () {
for(let i of testdata){
it('test {Regression} {Sanity} {Sanity}', async function () {
console.log(i.a);
console.log(i.b);
console.log(i.c);
expect(Number(i.a)+Number(i.b)).toBe(Number(i.c))
});
}
});
Output:
