How do we iterate the multiple data from JSOIN file?
See original GitHub issueI have JSON file as my test data which has multiple Iteration. It is throwing an error when executing multiple iterations. Could you please guide me here?
Below is my code.
/// <reference types="cypress" />
describe('Testsuite', function()
{
beforeEach(function()
{
cy.fixture('WebshopDatatable/MultipleDataGiftcards').then((TestData) =>
{
this.data = TestData
})
})
it('AddingGiftCards', function()
{
//Launch the url
cy.visit('http://demowebshop.tricentis.com/')
// Enter the login details
cy.get('.ico-login').click()
cy.get('#Email').type(this.data.email)
cy.get('#Password').type(this.data.password)
cy.get('.button-1.login-button').click()
})
})
JSON Test Data:
{
"Gift Cards": [
{
"url": "http://demowebshop.tricentis.com/",
"email": "boy@mail.com",
"password": "Boy123",
"categories": "Gift Cards",
"orderby": "Price: Low to High",
"pagesize": "4",
"viewmode": "List",
"productName": "$5 Virtual Gift Card"
},
{
"url": "http://demowebshop.tricentis.com/",
"email": "boy@mail.com",
"password": "Boy123",
"categories": "Gift Cards",
"orderby": "Price: Low to High",
"pagesize": "4",
"viewmode": "List",
"productName": "$5 Virtual Gift Card"
},
{
"url": "http://demowebshop.tricentis.com/",
"email": "boy@mail.com",
"password": "Boy123",
"categories": "Gift Cards",
"orderby": "Price: Low to High",
"pagesize": "4",
"viewmode": "List",
"productName": "$5 Virtual Gift Card"
}
]
}
Error:
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Iterating through multiple objects in JSON file - Stack Overflow
If you have a JSONArray of JSONObjects of your Offer JSON (which you would if you add the brackets like I suggested), then...
Read more >How do I loop through a JSON file with multiple keys/sub-keys ...
How do I loop through a JSON file with multiple keys/sub-keys in Python? - You can parse JSON files using the json module...
Read more >How to Loop Through the Array of JSON Objects in JavaScript
This tutorial will guide you on how to loop the array of JSON objects in JavaScript. We'll explain the types of loops and...
Read more >How to iterate and process data in different arrays/objects of a ...
How to iterate and process data in different arrays/objects of a JSON file? Hi community,. given following example: {.
Read more >Python Parse multiple JSON objects from file - PYnative
To parse a JSON file with multiple JSON objects read one JSON object at a time and Convert it into Python dict using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Mate, please find the code below, I was able to fix it.
Thanks Senthil.M
Hi All,
Have you created a
.json
file in the fixture folder? If yesIt should defiantly work…
Thanks Senthil.M