Commit 6cb03669 authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Improve e2e tests (#1600)

parent 7bc54a0a
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('02 Lemonldap::NG Manager', function() {
describe('translation', function() {
it('should translate in english and french', function() {
var tests = {
"en": "General Parameters",
"fr": "Paramètres généraux"
};
var els = element.all(by.css('[ng-click="getLanguage(lang)"]'));
expect(els.count()).toEqual(14);
els.each(function(el) {
el.isDisplayed().then(function(isVisible) {
if (isVisible) {
el.getAttribute('src').then(function(lang) {
lang = lang.replace(/^.*\/(\w+)\.png$/, '$1');
el.click();
var gp = element(by.id('t-generalParameters'));
expect(gp.getText()).toEqual(tests[lang]);
});
}
});
});
});
});
});
'use strict'; 'use strict';
describe('50 Lemonldap::NG Manager', function() { describe('50 Lemonldap::NG Manager', function() {
it('should display 2FA Sessions explorer', function() {
it('should display other modules', function() { //// Login attempt
// Login attempt // browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); // browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
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='password']")).sendKeys('dwho'); // browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
browser.get('/'); browser.get('/');
var links = element.all(by.repeater('l in links')); var links = element.all(by.repeater('l in links'));
expect(links.count()).toEqual(4); expect(links.count()).toEqual(4);
element(by.xpath("//a[@href='2ndfa.html']")).getCssValue("color").toEqual("rgba(11, 51, 60, 1)"); expect(element.all(by.xpath("//a[@href='2ndfa.html']")).first().getCssValue("color")).toEqual('rgba(157, 157, 157, 1)');
element(by.xpath("//a[@href='2ndfa.html']")).click(); element.all(by.xpath("//a[@href='2ndfa.html']")).first().click();
}); });
}); });
describe('50 Lemonldap::NG 2FA Sessions explorer', function() { describe('50 Lemonldap::NG 2FA Sessions explorer', function() {
...@@ -67,8 +65,4 @@ describe('50 Lemonldap::NG 2FA Sessions explorer', function() { ...@@ -67,8 +65,4 @@ describe('50 Lemonldap::NG 2FA Sessions explorer', function() {
expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(1); expect(element.all(by.repeater('node in data track by node.id')).count()).toEqual(1);
browser.sleep(500); browser.sleep(500);
}); });
}); });
...@@ -99,21 +99,25 @@ describe('0 Lemonldap::NG', function() { ...@@ -99,21 +99,25 @@ describe('0 Lemonldap::NG', function() {
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="WebSSO Manager"]')).click(); browser.driver.findElement(by.css('[alt="WebSSO Manager"]')).click();
expect(element.all(by.xpath("//a[@href='manager.html']")).first().getCssValue("color")).toEqual('rgba(157, 157, 157, 1)');
browser.sleep(1000); browser.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="currentConfiguration"]')).getText()).toEqual('Configuration actuelle'); expect(browser.driver.findElement(by.css('[trspan="currentConfiguration"]')).getText()).toEqual('Configuration actuelle');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="Sessions explorer"]')).click(); browser.driver.findElement(by.css('[alt="Sessions explorer"]')).click();
expect(element.all(by.xpath("//a[@href='sessions.html']")).first().getCssValue("color")).toEqual('rgba(157, 157, 157, 1)');
browser.sleep(1000); browser.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="session_s"]')).getText()).toEqual('session(s)'); expect(browser.driver.findElement(by.css('[trspan="session_s"]')).getText()).toEqual('session(s)');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="Notifications explorer"]')).click(); browser.driver.findElement(by.css('[alt="Notifications explorer"]')).click();
expect(element(by.xpath("//a[@href='notifications.html']")).getCssValue("color")).toEqual('rgba(157, 157, 157, 1)');
browser.sleep(1000); browser.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="noDatas"]')).getText()).toEqual('Aucune donnée à afficher'); expect(browser.driver.findElement(by.css('[trspan="noDatas"]')).getText()).toEqual('Aucune donnée à afficher');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="2FA Sessions explorer"]')).click(); browser.driver.findElement(by.css('[alt="2FA Sessions explorer"]')).click();
expect(element.all(by.xpath("//a[@href='2ndfa.html']")).first().getCssValue("color")).toEqual('rgba(157, 157, 157, 1)');
browser.sleep(1000); browser.sleep(1000);
expect(browser.driver.findElement(by.id('a-persistent')).getText()).toEqual('Explorateur sessions 2ndFA '); expect(browser.driver.findElement(by.id('a-persistent')).getText()).toEqual('Explorateur sessions 2ndFA ');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/'); browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment