0

I'm trying to incorporate the Page Object pattern in my Protractor testing but for some reason I don't know it's not working. I must say that before doing any change, everything was running perfect.

In test folder I have the file test.spec.js with this:

'use strict';

  var LoginPage = require('../pages/login.page.js');

describe('Login --> ', function(){

    'use strict';

    var ptor;
    var page;
    beforeEach(function () {
        page = new LoginPage();
        ptor = protractor.getInstance();
        ptor.waitForAngular();
    });


    describe('False Login --> ', function(){

        it('It should be false login with PIN --> ', function(){

            /* some code */
        });
    });
});

and in same folder I got another one called "pages" and inside of it the file login.page.js. But when I run tests it doesn't find login.page.js.

"Error: Cannot find module '../pages/login.page.js'"

Anyone knows why?

Thanks guys ;)

Cremix_hellven
  • 895
  • 2
  • 7
  • 13

1 Answers1

1

If the folder pages is located in the same folder as test.spec.js you have to use require('./pages/login.page.js');

mschoe
  • 314
  • 1
  • 3
  • 10
  • OK. Because if I write `require('../pages/login.page.js');` what I mean is that `pages` is located in root folder project, right? – Cremix_hellven Aug 20 '14 at 11:46
  • `'../pages'` is a reltive path and means that `pages` is located in the parent directory. – mschoe Aug 20 '14 at 12:03