0

I'm using CodeceptJS + Puppeteer for my tests.

I have created several scenarios, they work fine, but once I created another one with a button which has an AJAX request I faced with a problem that my tests stuck in a progress once API responds with 401.

I thought that I could wait for some time, but failed. That process just stops and never continues.

I haven't found anything about this, because looks like that everything should be fine, but I don't know what can I do here.

This is my scenario:

Scenario('invalid credentials', I => {
  I.fillField('._user .form-control', '123');
  I.fillField('._pass .form-control', '123');
  I.click('._login .btn');

  I.waitForElement('.login-box .alert-danger', 5);
});

This is a console log:

I click "._login .btn"
Emitted | step.passed (I click "._login .btn")
Step finished in 0.121 sec
Emitted | step.finish (I click "._login .btn")
Emitted | step.start (I wait for element ".login-box .alert-danger", 5)
I wait for element ".login-box .alert-danger", 5
Emitted | step.passed (I wait for element ".login-box .alert-danger", 5)
Step finished in 0.004 sec
Emitted | step.finish (I wait for element ".login-box .alert-danger", 5)
Emitted | step.start (I wait for element "Invalid Login Credentials", ".login-box .alert-danger")
I wait for element "Invalid Login Credentials", ".login-box .alert-danger"
> [Browser:Error] Failed to load resource: the server responded with a status of 401 (Unauthorized)
Costa Rassco
  • 169
  • 11

1 Answers1

0

Using I.seeElement instead of I.waitForElement helped me

Costa Rassco
  • 169
  • 11