1

I was trying to automate the UI testing of an application with Intern js.

But I am having a problem finding the way to wait until the page is fully loaded. After researching for a while, I found that pollUntil might be the solution I'm looking for but that too doesn't seem to work (maybe my implementation is wrong).

Currently my code doesn't wait at all. Can someone please help me with this?

My Code:

 define([
  'intern!object',
  'intern/chai!assert',
  'Automation/ConfigFiles/dataurl',
  'Automation/pages/login/loginpage',
  'intern/dojo/node!fs',
  'intern/dojo/node!leadfoot/helpers/pollUntil'
   ], function (registerSuite, assert,dataurl, LoginPage,fs,pollUntil) {
     registerSuite(function () {
      var loginPage;
      var values;
      return {
         setup: function () {
            var data = fs.readFileSync(loginpage, 'utf8');
            json=JSON.parse(data);
            console.log('###########Setting Up Login Page Test##########')
            this.remote
             .get(require.toUrl(json.locator.URL))
           .then(pollUntil(this.remote.findById('uname').isDisplayed(),6000)// here i want  to wait until page is loaded
.waitForDeletedByClassName('loading').end().sleep(600000)// here i want to wait until loading component is disappered
    values = json.values;
    loginPage = new LoginPage(this.remote,json.locator);
   },
'successful login': function () {
    console.log('##############Login Success Test############')
    return loginPage
        .login(values.unamevalue,values.pwdvalue)
      },

// …additional tests…
     };
   });
  });
  • Instead, can you find more elements on the page (elements that might give you some indication the page has fully loaded) and waits until they load? – Chris Kenst Jan 17 '17 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.