Call test script function [Protractor]

Asked

Viewed 89 times

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?

  • I never used it, the best way would be to make a callback?

  • 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 do rotas.rotas().then(meuCadastro.cadastro);

  • I’ll try with the promise then and see if it works.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.