Angular testing e2e at non-Angular login

I have an angular application working with a non-w500> login page. The angular app only loads if the user is registered.

What I've done:

I have proven my e2e- not Angular login page with a protractor & jasmine , following this the post , running my test code, located in e2e/login.spec.js, and use browser.ignoreSynchronization = trueto prevent the loading angular.

What I want to do:

I would like to run some kind of test against my angular application now , but I cannot, because the backend is redirected to the login page. This means that I need to register testUser for each angular view test. Not very effective if there are many tests.

I know there is a solution when the login page is on the angular side, mocking my backend API (see the same post ), but cannot work with what I have.

Question:

Is there a way for a user to log in? What is it? Or any other work around? Do I need to embed the dev login page in my angular app just for testing?

+4
source share
2 answers

onPrepare . :

global.loginFn = function loginFn() {

  usernameInput.sendKeys(username);
  passwordInput.sendKeys(password);
  login.click();
};

browser.ignoreSynchronization, , :

global.loginFn = function loginFn() {
  browser.ignoreSynchronization = true;
  usernameInput.sendKeys(username);
  passwordInput.sendKeys(password);
  login.click();
};

spec.js :

beforeAll(function () {
 browser.get('myUrl');
 loginFn();
};

browser.ignoreSynchronization = false;

angular.

beforeAll(function () {
 browser.get('myUrl');
 loginFn();
 browser.ignoreSynchronization = false;
};

, , .

, , , , .

, onPrepare, , .

+4

, , :

  • , beforeEach() - , ,
  • " " (, URL)
  • , , 20 , 1- . , . 150 4-5 , .
+2

All Articles