I have a fixture file which have both positive and negative amounts.
I have a dropdown which makes me select ALL,positive and negative amount.
when i select negative for example the table does not get refreshed with negative amounts.
This is the dropdown html This is my code test:
cy.intercept('/api/amounts/***/*****', {fixture: 'amount.json'}).as('amount')
cy.wait('@amount')
cy.get('.dropdown-header-title').eq(3).click()
cy.get('.dropdown-list-item').contains('Negative').then(option =>{
option[0].click()
cy.get('.dropdown-header-title').contains('Negative')
})
The json file can be as below:
{
amount: ['-200,000', '40000', '400', '-200']
}
For info i have added just dummy test data but the file is larger thank you
You can use readfile instead of fixture
cy.readFile("cypress/fixtures/amount.json").then((profile) => {
cy.intercept('/api/amounts/***/*****', { fixture: 'amount.json' }).as('amount')
cy.wait('@amount')
cy.get('.dropdown-header-title').eq(3).click()
cy.get('.dropdown-list-item').contains('Negative').then(option => {
option[0].click()
cy.get('.dropdown-header-title').contains('Negative')
})
})