Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142353

Cypress - How to restrict a constant value?

$
0
0

I am loading a fixture via constant (there are some reasons why I am not using cy.fixture) . I loop through a group of users - Cypress._.range(3, 19).

        import users from '../../../fixtures/users.json';
        describe('Emergency Code', () => {

        Cypress._.range(3, 19).forEach((k) => {
        const user = users[k]


            it('Should generate Emergency Code for ' + user.Product_Code, function () {

                cy.userAssginDongle(user);
                cy.get('.col-md-12 > .row > .col-md-12 > #sideButtonGroup > .btn:nth-child(2)').click();
                cy.get('.modal-content > .modal-body > .row > .col-md-12 > #copyInput').click();
                cy.get('.modal-content > .modal-body > .row > .col-md-12 >     #copyInput').invoke('val').should('not.be.empty')

            })


        })
        })

In users.json there is a field that defines Emergency Code as Yes or No. "Emergency_Code": "Yes", "Emergency_Code": "No",

How do I start this test restricting the Fixture JSON data based on this field? Something like if Emergency is yes: load the user into the test, if it's no, do not load if it's something else do not load.


Viewing all articles
Browse latest Browse all 142353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>