Commit e6769e0c authored by Xavier Guimard's avatar Xavier Guimard

Merge branch 'master' into v2.0

parents 94679c3d 504e892e
Pipeline #3885 passed with stages
in 10 minutes and 15 seconds
......@@ -130,7 +130,7 @@ Copyright: 2009-2013 Jeff Mott
License: Expat
Files: lemonldap-ng-manager/site/htdocs/static/bwr/es5-shim/*
Copyright: 2009-2015, Kristopher Michael Kowal and contributors
Copyright: 2009-2015, contributors
License: Expat
Files: lemonldap-ng-manager/site/htdocs/static/bwr/file-saver.js/*
......
......@@ -120,6 +120,7 @@ VHOSTLISTEN="*:$(PORT)"
TESTWEBSERVER=apache
TESTWEBSERVERPORT=19876
TESTUSESSL=0
E2E_TESTS='portal/*.js'
# LDAP backend test
LLNGTESTLDAP_SLAPD_BIN=/usr/sbin/slapd
......@@ -548,7 +549,7 @@ launch_protractor:
# Start e2e tests
# NB: you must have protractor installed (using npm install -g protractor)
# and have run update-webdriver at least once and have a node.js > 4.0
@TESTWEBSERVERPORT=$(TESTWEBSERVERPORT) protractor e2e-tests/protractor-conf.js
@E2E_TESTS=$(E2E_TESTS) TESTWEBSERVERPORT=$(TESTWEBSERVERPORT) protractor e2e-tests/protractor-conf.js
stop_web_server:
# Stop web server
......@@ -568,7 +569,7 @@ plackup:
-F >e2e-tests/conf/fastcgi.log 2>&1 &
install_test:
@TESTWEBSERVERPORT=$(PORT) protractor e2e-tests/protractor-conf.js
@E2E_TESTS=$(E2E_TESTS) TESTWEBSERVERPORT=$(PORT) protractor e2e-tests/protractor-conf.js
# Install targets
# ---------------
......
......@@ -75,7 +75,7 @@
"description" : "Official LemonLDAP::NG Website",
"display" : "on",
"logo" : "network.png",
"name" : "Offical Website",
"name" : "Official Website",
"uri" : "http://lemonldap-ng.org/"
},
"type" : "application"
......@@ -86,7 +86,7 @@
"authentication" : "Demo",
"cfgAuthor" : "The LemonLDAP::NG team",
"cfgNum" : 1,
"cfgVersion" : "2.0.0",
"cfgVersion" : "2.0.1",
"cookieName" : "lemonldap",
"demoExportedVars" : {
"cn" : "cn",
......
lemonldap-ng (2.1.0) artful; urgency=medium
lemonldap-ng (2.0.1) artful; urgency=medium
* Bugs:
......
......@@ -277,6 +277,7 @@ Suggests: libcrypt-u2f-server-perl,
libglib-perl,
libgssapi-perl,
libimage-magick-perl,
libipc-run-perl,
liblasso-perl,
libnet-facebook-oauth2-perl (>= 0.10),
libnet-openid-consumer-perl,
......
......@@ -130,7 +130,7 @@ Copyright: 2009-2013 Jeff Mott
License: Expat
Files: lemonldap-ng-manager/site/htdocs/static/bwr/es5-shim/*
Copyright: 2009-2015, Kristopher Michael Kowal and contributors
Copyright: 2009-2015, contributors
License: Expat
Files: lemonldap-ng-manager/site/htdocs/static/bwr/file-saver.js/*
......
#End 2 End Testing (Protractor)
To run the end-2-end tests against the application you use [Protractor](https://github.com/angular/protractor).
## Testing with Protractor
As a one-time setup, download webdriver.
```
npm run update-webdriver
```
Start the Protractor test runner using the e2e configuration:
```
make e2e_test
```
## Devel tips
{
locator_: {
using: 'css selector',
value: '[ng-click="getLanguage(lang)"]'
},
parentElementFinder_: null,
opt_actionResult_: {
then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending]
},
opt_index_: 1,
click: [Function],
sendKeys: [Function],
getTagName: [Function],
getCssValue: [Function],
getAttribute: [Function],
getText: [Function],
getSize: [Function],
getLocation: [Function],
isEnabled: [Function],
isSelected: [Function],
submit: [Function],
clear: [Function],
isDisplayed: [Function],
getOuterHtml: [Function],
getInnerHtml: [Function],
toWireValue: [Function]
}
......@@ -57,6 +57,16 @@
},
"type": "application"
},
"0008-app": {
"options": {
"description": "Explore WebSSO 2FA sessions",
"display": "auto",
"logo": "database.png",
"name": "2FA Sessions explorer",
"uri": "http://manager.example.com:__port__/2ndfa.html"
},
"type": "application"
},
"type": "category"
},
"0008-cat": {
......@@ -76,7 +86,7 @@
"description": "Official LemonLDAP::NG Website",
"display": "on",
"logo": "network.png",
"name": "Offical Website",
"name": "Official Website",
"uri": "http://lemonldap-ng.org/"
},
"type": "application"
......
......@@ -3,14 +3,13 @@
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('00 Lemonldap::NG', function() {
describe('Auth mechanism', function() {
it('should want to authenticate', function() {
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
// Login attempt
browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
});
});
});
\ No newline at end of file
});
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('01 Lemonldap::NG Manager', function() {
describe('Tree display -> General Parameters', function() {
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
// Portal
it('General Parameters > Portal -> Append 4 sub nodes', function() {
element(by.id('a-portalParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(14);
});
it('General Parameters > Portal > URL => Match', function() {
element(by.id('t-portal')).click();
expect(element(by.id('textinput')).getAttribute('value')).toEqual('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
});
it('General Parameters > Portal > Menu => Append 2 sub nodes', function() {
element(by.id('a-portalMenu')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(16);
});
it('General Parameters > Portal > Menu > Module Activation => Append 5 sub nodes', function() {
element(by.id('a-portalModules')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(21);
});
it('General Parameters > Portal > Menu > Cat. and Apps. => Append 11 sub nodes', function() {
element(by.id('a-applicationList')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(32);
});
it('General Parameters > Portal > Customization => Append 8 sub nodes', function() {
element(by.id('a-portalCustomization')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(40);
});
it('General Parameters > Portal > Customization > Buttons => Append 4 sub nodes', function() {
element(by.id('a-portalButtons')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(44);
});
it('General Parameters > Portal > Customization > Password Management => Append 3 sub nodes', function() {
element(by.id('a-passwordManagement')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(47);
});
it('General Parameters > Portal > Customization > Other => Append 6 sub nodes', function() {
element(by.id('a-portalOther')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(53);
});
// Authentication Parameters
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Authn. parameters => Append 4 sub nodes', function() {
element(by.id('a-authParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(14);
});
it('General Parameters > Authn. parameters > Authn. modules => Should have 26 modules availabled with "Demonstration" selected', function() {
element(by.id('t-authentication')).click();
expect(element(by.css('option[selected="selected"]')).getAttribute('Value')).toEqual('Demo');
expect(element.all(by.repeater('item in currentNode.select')).count()).toEqual(26);
});
it('General Parameters > Authn. parameters > Users modules => Should have 7 modules availabled with "Same" selected', function() {
element(by.id('t-userDB')).click();
expect(element(by.css('option[selected="selected"]')).getAttribute('Value')).toEqual('Same');
expect(element.all(by.repeater('item in currentNode.select')).count()).toEqual(7);
});
it('General Parameters > Authn. parameters > Password modules => Should have 8 modules availabled with "Demo" selected', function() {
element(by.id('t-passwordDB')).click();
expect(element(by.css('option[selected="selected"]')).getAttribute('Value')).toEqual('Demo');
expect(element.all(by.repeater('item in currentNode.select')).count()).toEqual(8);
});
it('General Parameters > Authn. parameters > Register modules => Should have 5 modules availabled with "Demo" selected', function() {
element(by.id('t-registerDB')).click();
expect(element(by.css('option[selected="selected"]')).getAttribute('Value')).toEqual('Demo');
expect(element.all(by.repeater('item in currentNode.select')).count()).toEqual(5);
});
it('should have a hash form if a key is clicked', function() {
element(by.id('a-demoParams')).click();
element(by.id('a-demoExportedVars')).click();
element(by.id('t-demoExportedVars/cn')).click();
expect(element.all(by.id('hashkeyinput')).count()).toEqual(1);
});
// Issuer Modules
it('Main => should display 12 main nodes', function() {
browser.get('/');
//var mainNodes = element.all(by.repeater('node in data track by node.id'));
//expect(mainNodes.count()).toEqual(12);
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Issuer modules => Append 5 sub nodes', function() {
element(by.id('a-issuerParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(15);
});
it('General Parameters > Issuer modules > SAML => Append 3 sub nodes', function() {
element(by.id('a-issuerDBSAML')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(18);
});
it('General Parameters > Issuer modules > CAS => Append 3 sub nodes', function() {
element(by.id('a-issuerDBCAS')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(21);
});
it('General Parameters > Issuer modules > OpenID => Append 4 sub nodes', function() {
element(by.id('a-issuerDBOpenID')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(25);
});
it('General Parameters > Issuer modules > OpenIDConnect => Append 3 sub nodes', function() {
element(by.id('a-issuerDBOpenIDConnect')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(28);
});
it('General Parameters > Issuer modules > GET => Append 4 sub nodes', function() {
element(by.id('a-issuerDBGet')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(32);
});
// Logs
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Logs => Append 3 sub nodes', function() {
element(by.id('a-logParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(13);
});
// Cookies
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Cookies => Append 6 sub nodes', function() {
element(by.id('a-cookieParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(16);
});
// Sessions
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Sessions => Append 8 sub nodes', function() {
element(by.id('a-sessionParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(18);
});
it('General Parameters > Sessions > Opening conditions => New grant rule button + 2 rules', function() {
element(by.id('t-grantSessionRules')).click();
element(by.css('[ng-click="menuClick(button)"]')).click();
element(by.css('[ng-click="menuClick(button)"]')).click();
expect(element.all(by.repeater('s in currentNode.nodes')).count()).toEqual(2);
expect(element.all(by.xpath('//tbody/tr')).count()).toEqual(2);
expect(element.all(by.xpath('//tbody/tr/td/input')).count()).toEqual(6);
});
it('General Parameters > Sessions > Session storage => Append 4 sub nodes', function() {
element(by.id('a-sessionStorage')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(24);
});
it('General Parameters > Sessions > Multiple sessions => Append 6 sub nodes', function() {
element(by.id('a-multipleSessions')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(30);
});
it('General Parameters > Sessions > Persistent sessions => Append 2 sub nodes', function() {
element(by.id('a-persistentSessions')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(32);
});
it('General Parameters > Sessions > Persistent storage options => Append 3 sub nodes', function() {
element(by.id('t-persistentStorageOptions')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(35);
expect(element.all(by.xpath('//tbody/tr')).count()).toEqual(3);
expect(element.all(by.xpath('//tbody/tr/td/input')).count()).toEqual(6);
});
// Configuration reload
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('General Parameters should display 10 sub nodes', function() {
element(by.id('a-generalParameters')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(10);
});
it('General Parameters > Configuration reload => Append 2 sub nodes', function() {
element(by.id('a-reloadParams')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(12);
});
it('General Parameters > Configuration relaod > Reload URLs => "New entry" button + 2 new URLS', function() {
element(by.id('t-reloadUrls')).click();
element(by.css('[ng-click="menuClick(button)"]')).click();
element(by.css('[ng-click="menuClick(button)"]')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(14);
expect(element.all(by.xpath('//tbody/tr')).count()).toEqual(2);
expect(element.all(by.xpath('//tbody/tr/td/input')).count()).toEqual(4);
});
});
});
\ No newline at end of file
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('01 Lemonldap::NG Manager', function() {
describe('Tree display -> Variables', function() {
it('Main => should display 12 main nodes', function() {
browser.get('/');
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('Variables should display 3 sub nodes', function() {
element(by.id('a-variables')).click();
expect(element.all(by.repeater('node in node.nodes track by node.id')).count()).toEqual(3);
});
});
});
\ No newline at end of file
......@@ -3,15 +3,11 @@
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('01 Lemonldap::NG Manager', function() {
describe('Tree display', function() {
it('should display 9 main nodes', function() {
it('Main => should display 12 main nodes', function() {
browser.get('/');
var mainNodes = element.all(by.repeater('node in data track by node.id'));
expect(mainNodes.count()).toEqual(12);
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(12);
});
it('should find a rule', function() {
browser.get('/#/confs/1');
var vhs = element(by.id('a-virtualHosts'));
......@@ -23,18 +19,5 @@ describe('01 Lemonldap::NG Manager', function() {
var def = element.all(by.id("t-virtualHosts/manager.example.com/locationRules/1"));
expect(def.count()).toEqual(1);
});
it('should find 19 auth/user modules but only Demo visible', function() {
browser.get('/#/confs/1');
element(by.id('a-generalParameters')).click();
element(by.id('a-authParams')).click();
/* todo */
});
it('should have a hash form if a key is clicked', function() {
element(by.id('a-demoParams')).click();
element(by.id('a-demoExportedVars')).click();
element(by.id('t-demoExportedVars/cn')).click();
var def = element.all(by.id('hashkeyinput'));
expect(def.count()).toEqual(1);
});
});
});
\ No newline at end of file
......@@ -12,7 +12,7 @@ describe('02 Lemonldap::NG Manager', function() {
"fr": "Paramètres généraux"
};
var els = element.all(by.css('[ng-click="getLanguage(lang)"]'));
expect(els.count()).toEqual(8);
expect(els.count()).toEqual(14);
els.each(function(el) {
el.isDisplayed().then(function(isVisible) {
if (isVisible) {
......
......@@ -9,6 +9,7 @@ describe('08 Lemonldap::NG Manager', function() {
it('should be able to add reload urls', function() {
browser.get('/#/confs/latest');
element(by.id('a-generalParameters')).click();
element(by.id('t-reloadParams')).click();
element(by.id('t-reloadUrls')).click();
element(by.css('.glyphicon-plus-sign')).click();
element(by.id('a-reloadUrls')).click();
......
......@@ -5,14 +5,13 @@
describe('35 Lemonldap::NG Manager', function() {
it('should be able to restore an old configuration', function() {
browser.get('/#/confs/1');
browser.get('/#!/confs/1');
element(by.id('save')).click();
element(by.id('longtextinput')).sendKeys('Restore conf 1');
element(by.id('saveok')).click();
browser.sleep(500);
element(by.id('messageok')).click();
browser.sleep(500);
element(by.id('forcesave')).click();
element(by.id('save')).click();
element(by.id('longtextinput')).sendKeys('Force to restore conf 1');
element(by.id('saveok')).click();
element(by.id('messageok')).click();
......
......@@ -7,7 +7,7 @@ describe('36 Lemonldap::NG Manager', function() {
describe('Diff interface', function() {
it('should find key changed', function() {
browser.get('/diff.html#6/7');
browser.get('/diff.html#!/6/7');
element(by.id('t-generalParameters')).click();
element(by.id('t-advancedParams')).click();
element(by.id('t-security')).click();
......
......@@ -5,7 +5,7 @@ describe('40 Lemonldap::NG Manager', function() {
it('should display other modules', function() {
browser.get('/');
var links = element.all(by.repeater('l in links'));
expect(links.count()).toEqual(3);
expect(links.count()).toEqual(4);
element(by.xpath("//a[@href='sessions.html']")).click();
});
......
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('00 Lemonldap::NG', function() {
describe('Auth mechanism', function() {
it('Portal should display 11 lang flags', function() {
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElements(by.className('langicon')).then(function(elems) {
expect(elems.length).toEqual(11);
});
browser.driver.findElement(by.xpath("//img[@title='en']")).click();
expect(browser.driver.findElement(by.css('[trmsg="9"]')).getText()).toEqual('Authentication required');
expect(browser.driver.findElement(by.css('[trspan="createAccount"]')).getText()).toEqual('Create an account');
browser.driver.findElement(by.xpath("//img[@title='it']")).click();
expect(browser.driver.findElement(by.css('[trmsg="9"]')).getText()).toEqual('Autenticazione necessaria');
expect(browser.driver.findElement(by.css('[trspan="createAccount"]')).getText()).toEqual('Crea un account');
browser.driver.findElement(by.xpath("//img[@title='fr']")).click();
expect(browser.driver.findElement(by.css('[trspan="createAccount"]')).getText()).toEqual('Créer un compte');
});
it('should create an account', function() {
browser.driver.findElement(by.css('[trspan="createAccount"]')).click();
expect(browser.driver.findElement(by.css('[trmsg="78"]')).getText()).toEqual('Merci de saisir vos informations');
// A four inputs form + one captcha
browser.driver.findElements(by.className('input-group')).then(function(elems) {
expect(elems.length).toEqual(4);
});
browser.driver.findElements(by.className('img-thumbnail')).then(function(elems) {
expect(elems.length).toEqual(1);
});
});
it('should authenticate with history', function() {
expect(browser.driver.findElement(by.css('[trspan="back2Portal"]')).getText()).toEqual('Retourner au portail');
browser.driver.findElement(by.css('[trspan="back2Portal"]')).click();
// Failed login attempt
browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('ohwd');
browser.driver.findElement(by.xpath("//input[@name='checkLogins']")).click();
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
expect(browser.driver.findElement(by.css('[trmsg="5"]')).getText()).toEqual('Mot de passe ou identifiant incorrect');
browser.driver.findElement(by.css('[trspan="goToPortal"]')).click();
// Login attempt
browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//input[@name='checkLogins']")).click();
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
// Change lang
browser.driver.findElement(by.xpath("//img[@title='de']")).click();
expect(browser.driver.findElement(by.css('[trspan="info"]')).getText()).toEqual("Information");
});
it('should display history', function() {
// Two entries
browser.driver.findElements(by.xpath('//table/tbody/tr')).then(function(elems) {
expect(elems.length).toEqual(2);
});
// Expect history with one login and one failed login
browser.driver.findElements(by.xpath('//form/div/div/h3')).then(function(elems) {
expect(elems.length).toEqual(3);
expect(elems[0].getText()).toEqual('Information');
expect(elems[1].getText()).toEqual('Letzte Anmeldungen');
expect(elems[2].getText()).toEqual('Letzte fehlgeschlagene Anmeldungen');
});
browser.driver.findElements(by.xpath('//table/thead/tr/th')).then(function(elems) {
expect(elems.length).toEqual(5);
expect(elems[0].getText()).toEqual('Datum');
expect(elems[2].getText()).toEqual('Datum');
expect(elems[4].getText()).toEqual('Fehlermeldung');
});
browser.driver.findElements(by.xpath('//table/tbody/tr/td')).then(function(elems) {
expect(elems.length).toEqual(5);
expect(elems[1].getText()).toEqual('127.0.0.1');
expect(elems[3].getText()).toEqual('127.0.0.1');
expect(elems[4].getText()).toEqual('Benutzername oder Passwort nicht korrekt');
});
expect(browser.driver.findElement(by.css('[trspan="PE5"]')).getText()).toEqual('Benutzername oder Passwort nicht korrekt');
expect(browser.driver.findElement(by.id('timer')).getText()).toMatch(/^Du wirst in \d{2} Sekunden umgeleitet$/);
browser.driver.findElement(by.xpath("//button[@type='reset']")).click();
expect(browser.driver.findElement(by.id('timer')).isDisplayed()).toEqual(false);
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
});
});
});
\ No newline at end of file
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('01 Lemonldap::NG', function() {
describe('Portal should display Menu', function() {
it('Should have four buttons', function() {
browser.driver.findElement(by.xpath("//img[@title='fr']")).click();
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
// Change password form
browser.driver.findElements(by.xpath('//li/a/span/img')).then(function(links) {
expect(links.length).toEqual(4);
links[1].click();
browser.sleep(1000);
browser.driver.findElement(by.xpath("//input[@name='oldpassword']")).sendKeys('dwho');
browser.driver.findElement(by.xpath("//input[@name='newpassword']")).sendKeys('newpwd');
browser.driver.findElement(by.xpath("//input[@name='confirmpassword']")).sendKeys('newpwd');
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
expect(browser.driver.findElement(by.css('[trmsg="35"]')).getText()).toEqual('Le mot de passe a été changé');
browser.driver.findElement(by.css('[trspan="goToPortal"]')).click();
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
});
// History page
browser.driver.findElements(by.xpath('//li/a/span/img')).then(function(links) {
expect(links.length).toEqual(4);
links[2].click();
browser.sleep(1000);
// Expect history with one login and one failed login
browser.driver.findElements(by.xpath('//main/div/div/div/div/h4')).then(function(elems) {
expect(elems.length).toEqual(7);
expect(elems[4].getText()).toEqual('Dernières connexions');
expect(elems[5].getText()).toEqual('Dernières connexions refusées');
});
browser.driver.findElements(by.xpath('//table/thead/tr/th')).then(function(elems) {
expect(elems.length).toEqual(5);
expect(elems[0].getText()).toEqual('Date');
expect(elems[1].getText()).toEqual('Adresse IP');
expect(elems[2].getText()).toEqual('Date');
expect(elems[3].getText()).toEqual('Adresse IP');
expect(elems[4].getText()).toEqual("Message d'erreur");
});
browser.driver.findElements(by.xpath('//table/tbody/tr/td')).then(function(elems) {
expect(elems.length).toEqual(5);
expect(elems[1].getText()).toEqual('127.0.0.1');
expect(elems[3].getText()).toEqual('127.0.0.1');
expect(elems[4].getText()).toEqual('Mot de passe ou identifiant incorrect');
});
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
});
// Logout page
browser.driver.findElements(by.xpath('//li/a/span/img')).then(function(links) {
expect(links.length).toEqual(4);
links[3].click();
browser.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="areYouSure"]')).getText()).toEqual('Êtes-vous sûr ?');
expect(browser.driver.findElement(by.css('[trspan="imSure"]')).getText()).toEqual('Je suis sûr');
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
});
// Applications page
browser.driver.findElements(by.xpath('//li/a/span/img')).then(function(links) {
expect(links.length).toEqual(4);
links[0].click();
browser.sleep(1000);
});
browser.driver.findElements(by.xpath('//main/div/div/div/div/h4')).then(function(elems) {
expect(elems.length).toEqual(7);
expect(elems[0].getText()).toEqual('Sample applications');