In protractor I search for a LinkText Login thats worked fine. I were redirect to the login site (non angular) and type in the username and pw. Clicking the submit button i came back to the first site. Now the Login Button is a Logout button. But protractor cannot see a angular site I only can find the button with selenium indicators.
The spec.js file:
it ('should have a login Button to click', function() {
loginPage.clickLoginButton();
});
it('should be on idm to login', function() {
var url = browser.driver.getCurrentUrl();
expect( url ).toEqual('http://localhost/webapp/login');
});
it('should have access with the given user', function() {
var idmPage = require('./idmPage.js');
idmPage.setUsername('bla');
idmPage.setPassword('secret');
idmPage.clickSubmitButton();
});
The pageobject.js:
var IdmPage = function() {
var userField = browser.driver.findElement(by.id('id_login'));
var passwordField = browser.driver.findElement(by.id('id_password'));
var submitButton = browser.driver.findElement(by.id('authentication-button'));
this.setUsername = function(username) {
userField.sendKeys(username);
};
this.setPassword = function(password) {
passwordField.sendKeys(password);
};
this.clickSubmitButton = function() {
submitButton.click();
}; }; module.exports = new IdmPage();
The conf.js
'use strict';
var baseDir = 'test/e2e'; exports.config = {
// The adress of a runnung selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
//Capabilities to be passed to the webdirver instance.
capabilities: {
browserName: 'chrome'
},
//Spec patterns are relative to the current working directly when protractor is called
suites: {
login: baseDir + '/login/**/*_spec.js',
content: [baseDir + '/content/*_spec.js']
},
//Options to be passed to Jasmine-node
jasmineNodeOpts: {
onComplete: null,
isVerbose: true,
showColors: true,
includeStackTrace: false,
defaultTimeoutInterval: 11000
}
};