I am trying to create some sort of dynamic tests. Dynamic in a sense that these tests are created within a loop. The amount of cycles in that loop is dependent on an array that first need to be created!
So here is the basic concept:
- build array of DOM elements
- loop array
- for every loop cycle create a test:
it('Check ' + array[i].find('.person-name').value() + ' for a-tag', ()=> {
//check current DOM element for a tag
})
I got the 1st one already and I also know how to loop an array... so 1. and 2. are not the problem. I do know how to build an array and how to iterate through it.
The problem I'm having right now is, that all those tests in that loop seem to be created before the array is (fully) built. Because of that, I get the undefined whenever I am accessing that array. My guess is that i need to use promises or hooks, which I have tried, but without a lot of success.
I have seen other people use cy.wait(...)
, but that is not a good option in my opinion.
Aucun commentaire:
Enregistrer un commentaire