Commit 5a41a92d authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Improve e2e tests (#1600)

parent 5dfb50ce
......@@ -18,7 +18,7 @@ describe('00 Lemonldap::NG', function() {
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 want to crete an account', function() {
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');
......@@ -30,7 +30,7 @@ describe('00 Lemonldap::NG', function() {
expect(elems.length).toEqual(1);
});
});
it('should want to authenticate with history', function() {
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();
......@@ -47,14 +47,16 @@ describe('00 Lemonldap::NG', function() {
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);
......
'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.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);
});
});
});
});
exports.config = {
allScriptsTimeout: 11000,
// Specific test
specs: process.env.E2E_TESTS,
// All tests
//specs: ['handler/*.js', 'portal/*.js', 'manager/*.js' ],
capabilities: {
......
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