0

The login function is passed successfully, but the test run end directly after it, and doesn't continue to the other code line in entryPre function -i tried with other simple functions with console.log() and it passes successfully-

I have in an x_test.js file :

Scenario('Check Employees', async ({I, entryPage, mainPage}) => {

  await entryPage.entryPre(user,y);
  .
  . 
  . 
});

and on entryPage.js :

entryPre(user, y){
  try {
    mainPage.login(user);
    console.log(y);
    //pause();
    
  } catch (err) {
  console.error(err);
  }
},

and at mainPage.js :

login() {
    I.say("User Login");
    I.amOutsideAngularApp();
    I.amOnPage('/')
    .
    .
    .
    I.click(this.loginBtn);
  },
anasz3z3
  • 13
  • 1
  • 6

1 Answers1

0

Beyond the issue I would like to point out a conceptual problem of your design: You should not import any page object into another page object. If you look at it from the main purpose of page object concept's perspective, there is only one page is opened at any time on a website. So any page is independant and should be isolated in your framework.

In your situation entryPage and mainPage are different pages so they don't need to (and also should not) refer to each other. If you want to modularize any meta-page action including multiple pages you can use stepObjects to model these kind of behaviors.

aefluke
  • 190
  • 1
  • 5