Skip to content

Commit e576909

Browse files
committed
updating for help with debugging
1 parent 04f5a6a commit e576909

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

3-WebApp-multi-APIs/appsettings.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{
22
"AzureAd": {
33
"Instance": "https://login.microsoftonline.com/",
4-
"Domain": "[Enter the domain of your tenant, e.g. contoso.onmicrosoft.com]",
5-
"TenantId": "[Enter 'common', or 'organizations' or the Tenant Id (Obtained from the Azure portal. Select 'Endpoints' from the 'App registrations' blade and use the GUID in any of the URLs), e.g. da41245a5-11b3-996c-00a8-4d99re19f292]",
6-
"ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]",
4+
"Domain": "msidlab3.onmicrosoft.com",
5+
"TenantId": "8e44f19d-bbab-4a82-b76b-4cd0a6fbc97a",
6+
"ClientId": "d9cde0be-ad97-41e6-855e-2f85136671c1",
77
"CallbackPath": "/signin-oidc",
8-
"SignedOutCallbackPath": "/signout-callback-oidc",
9-
10-
// To call an API
11-
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]"
12-
8+
"SignedOutCallbackPath": "/signout-callback-oidc"
139
},
1410
"Logging": {
1511
"LogLevel": {
16-
"Default": "Information",
17-
"Microsoft": "Warning",
18-
"Microsoft.Hosting.Lifetime": "Information"
12+
"Default": "Information",
13+
"Microsoft": "Warning",
14+
"Microsoft.Hosting.Lifetime": "Information"
1915
}
2016
},
21-
"AllowedHosts": "*",
22-
"GraphApiUrl": "https://graph.microsoft.com"
17+
"AllowedHosts": "*"
2318
}

UiTests/Common/UiTestHelpers.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using System;
5-
using System.Collections.Generic;
4+
using Azure.Core;
5+
using Azure.Security.KeyVault.Secrets;
6+
using Microsoft.Playwright;
67
using System.Diagnostics;
7-
using System.IO;
8-
using System.Linq;
98
using System.Management;
109
using System.Runtime.Versioning;
1110
using System.Text;
12-
using System.Threading;
13-
using System.Threading.Tasks;
14-
using Azure.Core;
15-
using Azure.Security.KeyVault.Secrets;
16-
using Microsoft.Playwright;
1711
using Xunit.Abstractions;
1812

1913
namespace Common
@@ -41,7 +35,7 @@ public static async Task NavigateToWebApp(string uri, IPage page)
4135
await Task.Delay(1000);
4236
InitialConnectionRetryCount--;
4337
if (InitialConnectionRetryCount == 0)
44-
{ throw; }
38+
{ throw; }
4539
}
4640
}
4741
}
@@ -366,7 +360,7 @@ internal static async Task<string> GetValueFromKeyvaultWitDefaultCreds(Uri keyva
366360
return (await client.GetSecretAsync(keyvaultSecretName)).Value.Value;
367361
}
368362

369-
public static bool StartAndVerifyProcessesAreRunning(List<ProcessStartOptions> processDataEntries, out Dictionary<string, Process> processes)
363+
public static bool StartAndVerifyProcessesAreRunning(List<ProcessStartOptions> processDataEntries, out Dictionary<string, Process> processes, uint numRetries)
370364
{
371365
processes = new Dictionary<string, Process>();
372366

@@ -380,16 +374,16 @@ public static bool StartAndVerifyProcessesAreRunning(List<ProcessStartOptions> p
380374
processDataEntry.EnvironmentVariables);
381375

382376
processes.Add(processDataEntry.ExecutableName, process);
377+
378+
// Gives the current process time to start up before the next process is run
383379
Thread.Sleep(5000);
384380
}
385381

386382
//Verify that processes are running
387-
for (int i = 0; i < 2; i++)
383+
for (int i = 0; i < numRetries; i++)
388384
{
389-
if (!UiTestHelpers.ProcessesAreAlive(processes.Values.ToList()))
390-
{
391-
RestartProcesses(processes, processDataEntries);
392-
}
385+
if (!UiTestHelpers.ProcessesAreAlive(processes.Values.ToList())) { RestartProcesses(processes, processDataEntries); }
386+
else { break; }
393387
}
394388

395389
if (!UiTestHelpers.ProcessesAreAlive(processes.Values.ToList()))
@@ -473,3 +467,4 @@ public ProcessStartOptions(
473467
}
474468
}
475469
}
470+

UiTests/UiTests/MultiApiTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public class MultiApiTest : IClassFixture<InstallPlaywrightBrowserFixture>
2323
private const string SignOutPageUriPath = @"/MicrosoftIdentity/Account/SignedOut";
2424
private const uint ClientPort = 44321;
2525
private const string TraceFileClassName = "OpenIDConnect";
26-
private readonly LocatorAssertionsToBeVisibleOptions _assertVisibleOptions = new() { Timeout = 5000 };
26+
private const uint NumProcessRetries = 3;
27+
private readonly LocatorAssertionsToBeVisibleOptions _assertVisibleOptions = new() { Timeout = 15000 };
2728
private readonly string _sampleAppPath = "3-WebApp-multi-APIs" + Path.DirectorySeparatorChar.ToString();
2829
private readonly string _testAssemblyLocation = typeof(MultiApiTest).Assembly.Location;
2930
private readonly ITestOutputHelper _output;
@@ -61,11 +62,11 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
6162
// The delay before starting client prevents transient devbox issue where the client fails to load the first time after rebuilding
6263
var clientProcessOptions = new ProcessStartOptions(_testAssemblyLocation, _sampleAppPath, TC.s_oidcWebAppExe, clientEnvVars);
6364

64-
bool areProcessesRunning = TH.StartAndVerifyProcessesAreRunning([clientProcessOptions], out processes);
65+
bool areProcessesRunning = TH.StartAndVerifyProcessesAreRunning([clientProcessOptions], out processes, NumProcessRetries);
6566

6667
if (!areProcessesRunning)
6768
{
68-
_output.WriteLine("Process not started after 3 attempts.");
69+
_output.WriteLine($"Process not started after {NumProcessRetries} attempts.");
6970
StringBuilder runningProcesses = new StringBuilder();
7071
foreach (var process in processes)
7172
{

UiTests/UiTests/MultipleApiUiTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
<ItemGroup>
2828
<ProjectReference Include="..\Common\Common.csproj" />
29+
<ProjectReference Include="..\..\3-WebApp-multi-APIs\WebApp-OpenIDConnect-DotNet.csproj" />
2930
</ItemGroup>
3031

3132
</Project>

0 commit comments

Comments
 (0)