Skip to content

Commit 5ab933a

Browse files
authored
fixed race condition between signin button click and navigation in B2C e2e test (#8098)
1 parent 1e6420e commit 5ab933a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

samples/msal-node-samples/b2c-user-flows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ An exception is the client secret, which must be stored in an `.env` file instea
4242
**.env file**
4343

4444
```
45-
CLIENT_SECRET=<your client secret here>
45+
AZURE_CLIENT_SECRET=<your client secret here>
4646
```
4747

4848
In `index.js`, we setup the configuration object expected by MSAL Node `confidentialClientApplication` class constructor:

samples/msal-node-samples/b2c-user-flows/test/user-flows-local.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ describe("B2C User Flow Tests", () => {
4848

4949
let clientSecret: { secret: string; value: string };
5050

51-
const screenshotFolder = path.join(__dirname, "screenshots/b2c-user-flows/local");
51+
const screenshotFolder = path.join(
52+
__dirname,
53+
"screenshots/b2c-user-flows/local"
54+
);
5255

5356
beforeAll(async () => {
5457
createFolder(screenshotFolder);
@@ -131,7 +134,11 @@ describe("B2C User Flow Tests", () => {
131134
);
132135
let displayName = (Math.random() + 1).toString(36).substring(7); // generate a random string
133136
await page.goto(homeRoute);
134-
await page.click("#signIn");
137+
await screenshot.takeScreenshot(page, "homePage");
138+
const [response] = await Promise.all([
139+
page.waitForNavigation(),
140+
page.click("#signIn"),
141+
]);
135142
await b2cLocalAccountEnterCredentials(
136143
page,
137144
screenshot,

0 commit comments

Comments
 (0)