Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Protractor script for Azure AD Login
/*
Usage :
Execute protractor on command line
==================================
protractor e2e.conf.js --params.url= https://ABCD.azurewebsites.net/ --params.uid=user@ORGANIZATION.onmicrosoft.com --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