3

I would like to know if it is possible to call a protractor test inside another protractor. For exemple :

 it('should go on edit profile', function() {
    browser.get('http://localhost:9100/#/');
    browser.setLocation('profile');
    browser.getCurrentUrl().then(function(actualUrl) {
        if (actualUrl.indexOf("/login") > 0) {
            require('../login/login.js');
            // call test of login.js ???
        }
    });
});

Thanks for yours answers ! :)

Yoann Picquenot
  • 640
  • 10
  • 26

1 Answers1

3

The accepted most convenient way is to reuse code through page objects, just wrap the shared functionality in a function like I explain at https://stackoverflow.com/a/24046016/511069

Regarding what to do after require is related to NodeJS modules, see for example var AngularPage = require('../pages/angular.page.js'); at thoughtworks blog post on the topic.

Community
  • 1
  • 1
Leo Gallucci
  • 16,355
  • 12
  • 77
  • 110