Search code examples
codeceptjs

How to check url change after login


How can I check if URL change after login to know that the login was success....

'use strict';

let I;

module.exports = {

  _init() {
   I = actor();
  },

   fields: {
    email: '[bo-email]',
    password: '[bo-password]'
  },
  submitButton:'button',

  sendForm(email, password,utills) {
    I.fillField(this.fields.email, email);
    I.fillField(this.fields.password, password);
    I.click(this.submitButton);
  //how to check if navigation was success...

Tnx!


Solution

  • I.seeInCurrentUrl("page=2");
    

    This method is the only way you can check if there is a URL change and you need not bother about using a wait method because this method would not execute until there is a URL change. However, you would need to increase your method timeout, to accommodate the long wait probably because of bad internet access.