Skip to content

Commit

Permalink
Merge pull request #517 from AzureAD/prkanher/devBuildFix
Browse files Browse the repository at this point in the history
Prkanher/dev build fix
  • Loading branch information
Prithvi Kanherkar authored Dec 26, 2018
2 parents f339ab2 + 355fd32 commit c8bbc65
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 59 deletions.
4 changes: 4 additions & 0 deletions lib/msal-core/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
### New Features
* Unified Cache - This is to support migration from ADAL.js to MSAL.js. If your app is currently using ADAL.js and if user already has an existing session there, when your app migrates to MSAL.js,
MSAL.js will do a Silent login.
* Removal of prompt-select account - Removes prompt parameter from interactive login and acquireToken requests. acquireTokenSilent will continue to pass prompt=none.
* End-to-end testing for msal-core
* Support for redirect URI as a function
* Introduced editor.config for IDE plugins

# 0.2.3
### New Features
Expand Down
8 changes: 4 additions & 4 deletions lib/msal-core/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
var webpackConfig = require('./webpack.config');
const path = require('path');

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine-ajax', 'jasmine'],
files: [
'node_modules/babel-polyfill/dist/polyfill.js',
'tests/**/*.ts',
],
exclude: [
'tests/*.ts',
],
preprocessors: {
'tests/**/*.ts': ['webpack', 'sourcemap'],
'src/**/ *.ts': ['coverage']
},
webpack: {
mode: webpackConfig.mode,
module: webpackConfig.module,
resolve: webpackConfig.resolve
},
Expand All @@ -31,5 +31,5 @@ module.exports = function (config) {
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true
},
})
});
}
5 changes: 2 additions & 3 deletions lib/msal-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"jasmine": "^2.8.0",
"jasmine-ajax": "^3.3.1",
"jasmine-core": "^2.5.2",
"jasmine-node": "^2.0.1",
"jasmine-node": "^1.16.2",
"jshint": "^2.9.7",
"karma": "^2.0.4",
"karma-chrome-launcher": "^2.0.0",
Expand Down Expand Up @@ -86,7 +86,6 @@
"doc": "typedoc --out ./docs ./src/**/* --gitRevision dev",
"build:modules": "tsc && tsc -m es6 --outDir lib-es6",
"build": "npm run clean && npm run doc && npm run build:modules && webpack && grunt && npm test",
"test": "typings install && karma start && jasmine-node tests/MSALSpec.js",
"endToEnd": "cd tests/endToEndTests && npm install && npm run endToEnd"
"test": "typings install && karma start && jasmine-node --nohelpers tests/MSALSpec.js"
}
}
8 changes: 6 additions & 2 deletions lib/msal-core/tests/MSAL.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ describe('Msal', function (): any {
};

msal.loginRedirect(null, Constants.prompt_none);
console.log(msal.getUser());
});

it('navigates user to redirectURI passed as extraQueryParameter', (done) => {
Expand Down Expand Up @@ -728,7 +727,6 @@ describe('Msal', function (): any {
msal = new UserAgentApplication("0813e1d1-ad72-46a9-8665-399bba48c201", null, function (errorDesc, token, error, tokenType) {
expect(document.cookie).toBe('');
expect(errorDesc).toBe("Cache Location is not valid.");
console.log(error);
expect(token).toBe(mockIdToken);
expect(tokenType).toBe(Constants.idToken);
}, { cacheLocation: 'lclStrge' });
Expand Down Expand Up @@ -760,6 +758,9 @@ describe('acquireTokenPopup functionality', function () {
});
spyOn(msal, 'acquireTokenPopup').and.callThrough();
acquireTokenPopupPromise = msal.acquireTokenPopup([msal.clientId]);
acquireTokenPopupPromise.then(function(accessToken) {
}, function(error) {
});
});

it('returns a promise', function () {
Expand All @@ -777,6 +778,9 @@ describe('acquireTokenSilent functionality', function () {
spyOn(msal, 'acquireTokenSilent').and.callThrough();
spyOn(msal, 'loadIframeTimeout').and.callThrough();
acquireTokenSilentPromise = msal.acquireTokenSilent([msal.clientId]);
acquireTokenSilentPromise.then(function(accessToken) {
}, function(error) {
});
});


Expand Down
2 changes: 2 additions & 0 deletions lib/msal-core/tests/endToEndTests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module.exports = {
login: async function(driver, userName, password) {
module.exports.validateParams(driver);

await driver.wait(until.elementLocated(webdriver.By.id('idSIButton9')), 5000);
await driver.wait(until.elementLocated(webdriver.By.id('i0116')), 5000);
var nextBtn = await driver.findElement(webdriver.By.id('idSIButton9'));
var usernameInput = await driver.findElement(webdriver.By.id('i0116'));

Expand Down
17 changes: 6 additions & 11 deletions lib/msal-core/tests/endToEndTests/keyvault.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,16 @@ var getSecret = function (secretName) {

module.exports = {
getAllSecrets: function (secretIds) {
var secrets = {};
var deferred = Q.defer();

getSecret(secretIds.msaljs_browserstack_user).then(function (result) {
secretIds.msaljs_browserstack_user = result.value;
return getSecret(secretIds.msaljs_browserstack_key)
}).then(function (result) {
secretIds.msaljs_browserstack_key = result.value;
return getSecret(secretIds.MSA_MSIDLAB4_Password);
}).then(function (result) {
secretIds.MSA_MSIDLAB4_Password = result.value;
getSecret(secretIds.MSA_MSIDLAB4_Password).then(function (result) {
secrets.MSA_MSIDLAB4_Password = result.value;
return getSecret(secretIds.msidlab4);
}).then(function (result) {
secretIds.loginPassword = result.value;
deferred.resolve(secretIds);
})
secrets.loginPassword = result.value;
deferred.resolve(secrets);
});
return deferred.promise;
}
};
6 changes: 3 additions & 3 deletions lib/msal-core/tests/endToEndTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"chai": "^4.2.0",
"mocha": "^5.2.0",
"mock-local-storage": "^1.0.5",
"promise": "^8.0.1"
"promise": "^8.0.1",
"selenium-webdriver": "^4.0.0-alpha.1"
},
"dependencies": {
"jasmine": "^3.3.0",
"jasmine-node": "^1.16.2",
"q": "^1.5.1",
"selenium-webdriver": "^4.0.0-alpha.1"
"q": "^1.5.1"
}
}
35 changes: 15 additions & 20 deletions lib/msal-core/tests/endToEndTests/seTestRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,29 @@ var configurationFiles = [
var i = 0;

var secretIds = {
msaljs_browserstack_user: 'msaljs-browserstack-user',
msaljs_browserstack_key: 'msaljs-browserstack-key',
msidlab4: 'msidlab4',
MSA_MSIDLAB4_Password: 'MSA-MSIDLAB4-Password'
}

var runSeleniumConfig = function () {
var configFile = configurationFiles[i];
console.log("Running " + configFile);
var config = require('./' + configFile);
var testCommand = 'mocha spec/e2eCoreTestsSpec.js ' + configFile;
// keyVault.getAllSecrets(secretIds).then(function (result) {
// process.env.browserstackKey = result.msaljs_browserstack_key;
// process.env.browserstackUser = result.msaljs_browserstack_user;
// process.env.loginPassword = result.loginPassword;
// process.env.MSA_MSIDLAB4_Password = result.MSA_MSIDLAB4_Password;
// });
exec(testCommand, function(error, stdout, stderr) {
console.log("Completed " + configFile);
console.log(stdout);
if(error) {
console.log(error);
console.log(stderr);
}
i++;
if(i < configurationFiles.length) {
runSeleniumConfig();
}
keyVault.getAllSecrets(secretIds).then(function (result) {
process.env.loginPassword = result.loginPassword;
process.env.MSA_MSIDLAB4_Password = result.MSA_MSIDLAB4_Password;
exec(testCommand, function(error, stdout, stderr) {
console.log("Completed " + configFile);
console.log(stdout);
if(error) {
console.log(error);
console.log(stderr);
}
i++;
if(i < configurationFiles.length) {
runSeleniumConfig();
}
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion lib/msal-core/tests/endToEndTests/spec/e2eCoreTestsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe('E2E Tests MSAL Core', function() {
expect(accessTokenKey).to.exist;

await driver.findElement(callExtApiBtn).click(); // Call Graph

await driver.wait(webdriver.until.elementLocated(webdriver.By.id('json')), 5000);
var body = await driver.findElement(webdriver.By.id("json"));
count = 0;
var bodyText = "";
Expand Down
3 changes: 0 additions & 3 deletions lib/msal-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
],
"typeRoots": [
"../node_modules/@types"
],
"exclude": [
"node_modules"
]

}
18 changes: 6 additions & 12 deletions lib/msal-core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,36 @@ var PATHS = {
var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = {

mode: "production",
entry: {
'msal': [PATHS.entryPoint],
'msal.min': [PATHS.entryPoint]
},

mode: 'production',

output: {
path: PATHS.bundles,
filename: '[name].js',
libraryTarget: 'umd',
library: 'Msal',
umdNamedDefine: true
},

resolve: {
extensions: ['.ts', '.tsx', '.js']
},

devtool: 'source-map',
devtool: 'inline-source-map',
plugins: [
new ForkTsCheckerWebpackPlugin()
],
module: {

rules: [{
test: /\.(ts|tsx)?$/,
test: /\.(ts|tsx|js)?$/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
}
},
exclude: /(node_modules)/
}]
}

}]
}
}
}

0 comments on commit c8bbc65

Please sign in to comment.