jeudi 30 juillet 2015

Multiple level of sections in page_objects in nightwatch.js

I have just started out using nightwatch.js , and I am using page_objects to access elements in my tests. So what I was wondering is there anyway we can have sections within sections in page objects? I know that we can specify one level of section. What I have done is something like this :

module.exports = {
  url : 'http://ift.tt/1Mz9PPh',
  sections : {
    topContainer : {
      selector : '.top_container',
      elements : {
        logo : {
          selector : '.logo'
        },
        settingsButton : {
          selector :'.dropdown'
        },
        searchBox : {
          selector : '.search_box'
        },
        sortOrderButton : {
          selector : '.icond'
        }
      }
    },
    library : {
      selector : '.library',
      bookList : {
        selector : 'ul.library_container'
      }
    }
  }
};

Can we have sections inside sections , and in case not , how do we select in test case with @variable

client.elements('css selector','@top_container ul.dropdown-menu li', function (result) {
      if ( result.value.length == 3 ) {
        this.verify.ok(result.value.length, '3 languages loaded');
      }
    });

Thanks !

Aucun commentaire:

Enregistrer un commentaire