Commit 204fd9df authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Improve e2e tests (#1600)

parent 6b262e8d
......@@ -10,6 +10,7 @@ describe('10 Lemonldap::NG', function() {
// browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('dwho');
// browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
// Toggle Menu bar
// Need to be clicked twice ???
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
......@@ -25,12 +26,34 @@ describe('10 Lemonldap::NG', function() {
links[0].click();
browser.sleep(1000);
});
});
it('Should submit TOTP form', function() {
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');
expect(browser.driver.findElement(by.css('[trspan="yourNewTotpKey"]')).getText()).toEqual('Votre nouvelle clef TOTP. Testez-la et entrez le code');
// Submit an empty form
browser.driver.findElement(by.id('verify')).click();
expect(browser.driver.findElement(by.css('[trspan="yourNewTotpKey"]')).getText()).toEqual('Remplissez le formulaire');
browser.sleep(500);
// Submit a bad TOTP code
browser.driver.findElement(by.xpath("//input[@name='TOTPName']")).sendKeys('_TEST_');
browser.driver.findElement(by.xpath("//input[@name='code']")).sendKeys('1234567');
browser.driver.findElement(by.id('verify')).click();
expect(browser.driver.findElement(by.css('[trspan="yourNewTotpKey"]')).getText()).toEqual('Mauvais code');
browser.sleep(500);
// Generate a new TOTP code
browser.driver.findElement(by.id('changekey')).click();
expect(browser.driver.findElement(by.css('[trspan="yourNewTotpKey"]')).getText()).toEqual('Votre nouvelle clef TOTP. Testez-la et entrez le code');
browser.sleep(500);
// Back to Portal
links[3].click();
browser.driver.findElement(by.xpath("//button[@type='button']")).click();
browser.sleep(1000);
......
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