JSON example:
{
[
{"username":"User1", "password":"Password1"},
{"username":"User2", "password":"Password2"},
{"username":"User3", "password":"Password3"}
]
}
You may store data in a json file and simply read into a variable and use it as required:
var testData = require('../example/Test Data/Test.json');
describe('LoginPage', function() {
it("data.description", function () {
browser.get("http://127.0.0.1:8080/#/login");
element(by.model("username")).sendKeys(testData[0].username);
element(by.model("password")).sendKeys(testData[0].passwordFieldpassword);
element(by.buttonText("Authenticate")).click();
});
});
});
JSON example:
{
"employees":[
{"firstName":"John", "lastName":"Doe"}, );
{"firstName":"Anna", "lastName":"Smith" },);
{"firstName":"Peter", "lastName":"Jones"}
]
});