Last active
July 30, 2019 09:43
-
-
Save ashtewari/9feb920312b1681aff1e9f878c67b3ad to your computer and use it in GitHub Desktop.
Protractor script for Azure AD Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage : | |
Execute protractor on command line | |
================================== | |
protractor e2e.conf.js --params.url= https://ABCD.azurewebsites.net/ [email protected] --params.pwd=PASSWORD | |
Sample spec file | |
================================== | |
var AzureAdLogin = require('./azure-ad-login'); | |
describe('Test Suite', function () { | |
beforeAll(function () { | |
browser.manage().timeouts().pageLoadTimeout(40000); | |
browser.manage().timeouts().implicitlyWait(50000); | |
browser.ignoreSynchronization = true; | |
new AzureAdLogin().login(); | |
}); | |
beforeEach(function () { | |
}); | |
it('should do something good', function () { | |
}); | |
}); | |
*/ | |
(function () { | |
var AzureAdLogin = function () { | |
var app = this; | |
app.login = function() { | |
browser.get(browser.params.url); | |
var signInLink = element(by.css('#org a')); | |
expect(signInLink.isDisplayed()).toBe(true); | |
signInLink.click(); | |
var uid = element(by.css('#cred_userid_inputtext')); | |
var pwd = element(by.css('#cred_password_inputtext')); | |
var ok = element(by.css('#cred_sign_in_button')); | |
uid.sendKeys(browser.params.uid); | |
pwd.sendKeys(browser.params.pwd); | |
browser.driver.sleep(2000); | |
ok.click(); | |
browser.driver.sleep(2000); | |
} | |
}; | |
module.exports = function () { | |
return new AzureAdLogin(); | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment