Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d6a444f
Update eslint settings
tnorling Jun 11, 2020
02ea320
Add b2c sample
tnorling Jun 11, 2020
6d0f45c
Add login tests
tnorling Jun 11, 2020
e64aa03
Add acquireToken tests
tnorling Jun 12, 2020
d8a81f0
Merge branch 'dev' into b2c-E2E-Sample
tnorling Jun 12, 2020
7452390
Add E2E for 2.0
tnorling Jun 12, 2020
34c8c89
Merge branch 'b2c-E2E-Sample' of https://github.com/AzureAD/microsoft…
tnorling Jun 12, 2020
d48b188
Remove telemetry config from 2.0 sample
tnorling Jun 12, 2020
7055edb
Verify contents of cache, not quantity
tnorling Jun 12, 2020
eb57298
Verify contents of cache, not quantity
tnorling Jun 13, 2020
453d54f
More accurately confirm successful login before moving on
tnorling Jun 16, 2020
b3a7c3f
Merge branch 'dev' into b2c-E2E-Sample
tnorling Jun 16, 2020
70673b7
Remove telemetry config
tnorling Jun 17, 2020
d412d92
Merge branch 'dev' into b2c-E2E-Sample
tnorling Jun 17, 2020
d26a6e7
Setup tests to allow for easier lab user selection
tnorling Jun 17, 2020
2bd295b
Setup tests to allow for easier lab user selection
tnorling Jun 17, 2020
c05dfd8
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jun 19, 2020
bd13710
Update sample
tnorling Jun 19, 2020
e8348ca
Update account logic
tnorling Jun 19, 2020
d843501
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jul 6, 2020
1f04005
Update browser sample
tnorling Jul 6, 2020
ab946b5
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jul 17, 2020
e7a96fb
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jul 27, 2020
5491e4b
Update E2E tests
tnorling Jul 27, 2020
f30c209
Remove 2.0 sample
tnorling Aug 10, 2020
4f2fdba
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Aug 10, 2020
e0bc92e
Revert changes to 2.0 test utils
tnorling Aug 10, 2020
5385d38
Revert changes to 2.0 test utils
tnorling Aug 10, 2020
9b61568
Merge branch 'dev' into b2c-E2E-Sample
tnorling Aug 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Setup tests to allow for easier lab user selection
  • Loading branch information
tnorling committed Jun 17, 2020
commit 2bd295b3925c0957c9a6ff1508a8f39df87b3287
5 changes: 3 additions & 2 deletions samples/VanillaJSTestApp2.0/app/b2c/test/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Mocha from "mocha";
import puppeteer from "puppeteer";
import { expect } from "chai";
import fs from "fs";
import { LabClient } from "../../../e2eTests/LabClient";
import { LabClient, ILabApiParams } from "../../../e2eTests/LabClient";

const SCREENSHOT_BASE_FOLDER_NAME = `${__dirname}/screenshots`;
let SCREENSHOT_NUM = 0;
Expand All @@ -24,7 +24,8 @@ function setupScreenshotDir() {

async function setupCredentials() {
const testCreds = new LabClient();
const envResponse = await testCreds.getUserVarsByCloudEnvironment("azurecloud");
const userParams: ILabApiParams = {envName: "azurecloud"};
const envResponse = await testCreds.getUserVarsByCloudEnvironment(userParams);
const testEnv = envResponse[0];
if (testEnv.upn) {
username = testEnv.upn;
Expand Down
5 changes: 3 additions & 2 deletions samples/VanillaJSTestApp2.0/app/default/test/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "mocha";
import puppeteer from "puppeteer";
import { expect } from "chai";
import fs from "fs";
import { LabClient } from "../../../e2eTests/LabClient";
import { LabClient, ILabApiParams } from "../../../e2eTests/LabClient";

const SCREENSHOT_BASE_FOLDER_NAME = `${__dirname}/screenshots`;
let SCREENSHOT_NUM = 0;
Expand All @@ -17,7 +17,8 @@ function setupScreenshotDir() {

async function setupCredentials() {
const testCreds = new LabClient();
const envResponse = await testCreds.getUserVarsByCloudEnvironment("azureppe");
const userParams: ILabApiParams = {envName: "azurecloud"};
const envResponse = await testCreds.getUserVarsByCloudEnvironment(userParams);
const testEnv = envResponse[0];
if (testEnv.upn) {
username = testEnv.upn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "mocha";
import puppeteer from "puppeteer";
import { expect } from "chai";
import fs from "fs";
import { LabClient } from "../../../e2eTests/LabClient";
import { LabClient, ILabApiParams } from "../../../e2eTests/LabClient";

const SCREENSHOT_BASE_FOLDER_NAME = `${__dirname}/screenshots`;
let SCREENSHOT_NUM = 0;
Expand All @@ -17,7 +17,8 @@ function setupScreenshotDir() {

async function setupCredentials() {
const testCreds = new LabClient();
const envResponse = await testCreds.getUserVarsByCloudEnvironment("azureppe");
const userParams: ILabApiParams = {envName: "azurecloud"};
const envResponse = await testCreds.getUserVarsByCloudEnvironment(userParams);
const testEnv = envResponse[0];
if (testEnv.upn) {
username = testEnv.upn;
Expand Down
26 changes: 24 additions & 2 deletions samples/VanillaJSTestApp2.0/e2eTests/LabClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { ClientSecretCredential, AccessToken } from "@azure/identity";
import axios from "axios";
const labApiUri = "https://msidlab.com/api"

export interface ILabApiParams {
envName?: string,
userType?: string,
b2cProvider?: string
};

export class LabClient {

private credentials: ClientSecretCredential;
Expand Down Expand Up @@ -35,10 +41,26 @@ export class LabClient {
return null;
}

async getUserVarsByCloudEnvironment(envName: string): Promise<any> {
async getUserVarsByCloudEnvironment(apiParams: ILabApiParams): Promise<any> {
const accessToken = await this.getCurrentToken();
let queryParams: Array<string> = [];

if (apiParams.envName) {
queryParams.push(`envname=${apiParams.envName}`);
}
if (apiParams.userType) {
queryParams.push(`usertype=${apiParams.userType}`);
}
if (apiParams.b2cProvider) {
queryParams.push(`b2cprovider=${apiParams.b2cProvider}`);
}

if (queryParams.length <= 0) {
throw "Must provide at least one param to getUserVarsByCloudEnvironment";
}
const apiUrl = '/user?' + queryParams.join("&");

return await this.requestLabApi(`/user?azureenvironment=${envName}`, accessToken);
return await this.requestLabApi(apiUrl, accessToken);
}

async getSecret(secretName: string): Promise<any> {
Expand Down