Mocha - How to Update parameterized test parameters from before hook

23 Views Asked by At
describe('', () => {
   let ids = [];
   before('',() => {
   cypress.api('GET', 'http://localhost:3000/api/id-list').then((response) => {
      response.body.foreach((id) => {
         ids.push(id);
      });
   });
});

ids.foreach((id) => {
   it('',()={});
   });
});

When running above tests, I got 'No tests found' reason is ids array is empty. If I add five values into ids like let ids = [1,2,3,4,5] test will run five times. Is there any way that I can wupdate the parameters list from before hook?

0

There are 0 best solutions below