Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call another protractor test from another test

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 ! :)

like image 728
Yoann Picquenot Avatar asked Sep 18 '26 18:09

Yoann Picquenot


1 Answers

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.

like image 70
Leo Gallucci Avatar answered Sep 20 '26 07:09

Leo Gallucci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!