1
Hello, I have a file that calls several test methods that I created with Protractor, it looks like this:
import {MeuCadastro} from './MeuCadastro/MeuCadastro.spec';
import {Rotas} from './Rotas/rotas.spec';
let rotas: Rotas = new Rotas();
let meuCadastro: MeuCadastro = new MeuCadastro();
rotas.rotas();
meuCadastro.cadastro();
The problem is that the test "My registration" does not wait for the "routes" to finish, and ends up generating an error in the tests expect.
What is the best way to use these methods to make them work after the top one is finished?
Thank you in advance for any help.
Usas callbacks, async/await or Promises?
– Sergio
I never used it, the best way would be to make a callback?
– Kappyh
It’s indifferent, it depends on what you’re most used to or mis practical for the code. If that
rotas.rotas();
were a Promise you could dorotas.rotas().then(meuCadastro.cadastro);
– Sergio
I’ll try with the promise then and see if it works.
– Kappyh