Commit 824817f7 authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Improve e2e tests (#1600)

parent 69e518b9
Pipeline #3891 passed with stages
in 9 minutes and 39 seconds
......@@ -24,8 +24,8 @@ staticPrefix = /static
languages = fr, en, vi, it, ar, de, zh, nl, es, pt, ro
templateDir = __pwd__/lemonldap-ng-portal/site/templates
portalStatus = 1
;totp2fActivation = 1
;totp2fSelfRegistration = 1
totp2fActivation = 1
totp2fSelfRegistration = 1
[handler]
......
......@@ -165,7 +165,7 @@
"_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : $_auth eq 'OpenIDConnect' ? \"$_user\\@$_oidcConnectedRP\" : \"$_user\""
},
"mailUrl": "http://auth.example.com:__port__/resetpwd",
"notification": 0,
"notification": 1,
"notificationStorage": "File",
"notificationStorageOptions": {
"dirName": "__pwd__/e2e-tests/conf"
......
......@@ -68,6 +68,8 @@ describe('01 Lemonldap::NG', function() {
links[0].click();
browser.sleep(1000);
});
});
it('Should have seven links', function() {
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');
......@@ -85,6 +87,42 @@ describe('01 Lemonldap::NG', function() {
expect(elems[6].getText()).toEqual('Local documentation');
expect(elems[7].getText()).toEqual('Official Website');
});
browser.driver.findElement(by.css('[alt="Application Test 1"]')).click();
browser.sleep(1000);
expect(browser.driver.findElement(by.id('v-Host')).getText()).toEqual('test1.example.com:' + process.env.TESTWEBSERVERPORT );
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="Application Test 2"]')).click();
browser.sleep(1000);
expect(browser.driver.findElement(by.id('v-Host')).getText()).toEqual('test2.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.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="currentConfiguration"]')).getText()).toEqual('Configuration actuelle');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
browser.driver.findElement(by.css('[alt="Sessions explorer"]')).click();
browser.sleep(1000);
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.findElement(by.css('[alt="Notifications explorer"]')).click();
browser.sleep(1000);
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.findElement(by.css('[alt="2FA Sessions explorer"]')).click();
browser.sleep(1000);
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.findElement(by.css('[alt="Local documentation"]')).click();
browser.sleep(1000);
expect(browser.driver.findElement(by.xpath("//body/div/h1")).getText()).toEqual('LemonLDAP::NG offline documentation');
browser.driver.findElement(by.tagName('a')).click();
expect(browser.driver.findElement(by.tagName('h1')).getText()).toEqual('Documentation for LemonLDAP::NG 2.0');
browser.driver.get('http://auth.example.com:' + process.env.TESTWEBSERVERPORT + '/');
});
});
});
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('10 Lemonldap::NG', function() {
describe('Second Factor Manager', function() {
it('Should have two links in dropDown menu', function() {
// // Login attempt
// 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='password']")).sendKeys('dwho');
// browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
// Need to be clicked twice ???
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
browser.driver.findElement(by.css('[data-toggle="dropdown"]')).click();
browser.sleep(1000);
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
browser.driver.findElement(by.css('[data-toggle="dropdown"]')).click();
//
browser.driver.findElements(by.className('dropdown-item')).then(function(links) {
expect(links.length).toEqual(2);
links[0].click();
browser.sleep(1000);
});
browser.driver.findElements(by.css('[role="button"]')).then(function(links) {
expect(links.length).toEqual(4);
expect(links[0].getText()).toEqual('Générer une nouvelle clef');
expect(links[1].getText()).toEqual('Enregistrer');
expect(links[2].getText()).toEqual('Gestionnaire 2ndFA');
expect(links[3].getText()).toEqual('Aller au portail');
links[3].click();
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
expect(browser.driver.findElement(by.css('[trspan="yourApps"]')).getText()).toEqual('Vos applications');
});
});
});
});
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