Skip to content

Commit 03e71ce

Browse files
committed
making draft PR
1 parent e576909 commit 03e71ce

File tree

6 files changed

+46
-19
lines changed

6 files changed

+46
-19
lines changed

UiTests/Common/UiTestHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public static bool StartAndVerifyProcessesAreRunning(List<ProcessStartOptions> p
376376
processes.Add(processDataEntry.ExecutableName, process);
377377

378378
// Gives the current process time to start up before the next process is run
379-
Thread.Sleep(5000);
379+
Thread.Sleep(2000);
380380
}
381381

382382
//Verify that processes are running

UiTests/UiTests/MultiApiTest.cs renamed to UiTests/UiTests/AnyOrgOrPersonalTest.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Linq;
78
using System.Runtime.Versioning;
89
using System.Text;
910
using System.Threading.Tasks;
@@ -14,22 +15,21 @@
1415
using Xunit.Abstractions;
1516
using Process = System.Diagnostics.Process;
1617
using TC = Common.TestConstants;
17-
using TH = Common.UiTestHelpers;
1818

1919
namespace MultipleApiUiTest
2020
{
21-
public class MultiApiTest : IClassFixture<InstallPlaywrightBrowserFixture>
21+
public class AnyOrgOrPersonalTest : IClassFixture<InstallPlaywrightBrowserFixture>
2222
{
2323
private const string SignOutPageUriPath = @"/MicrosoftIdentity/Account/SignedOut";
2424
private const uint ClientPort = 44321;
2525
private const string TraceFileClassName = "OpenIDConnect";
2626
private const uint NumProcessRetries = 3;
27-
private readonly LocatorAssertionsToBeVisibleOptions _assertVisibleOptions = new() { Timeout = 15000 };
28-
private readonly string _sampleAppPath = "3-WebApp-multi-APIs" + Path.DirectorySeparatorChar.ToString();
29-
private readonly string _testAssemblyLocation = typeof(MultiApiTest).Assembly.Location;
27+
private readonly LocatorAssertionsToBeVisibleOptions _assertVisibleOptions = new() { Timeout = 25000 };
28+
private readonly string _sampleAppPath = "1-WebApp-OIDC" + Path.DirectorySeparatorChar + "1-3-AnyOrgOrPersonal" + Path.DirectorySeparatorChar.ToString();
29+
private readonly string _testAssemblyLocation = typeof(AnyOrgOrPersonalTest).Assembly.Location;
3030
private readonly ITestOutputHelper _output;
3131

32-
public MultiApiTest(ITestOutputHelper output)
32+
public AnyOrgOrPersonalTest(ITestOutputHelper output)
3333
{
3434
_output = output;
3535
}
@@ -62,7 +62,7 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
6262
// The delay before starting client prevents transient devbox issue where the client fails to load the first time after rebuilding
6363
var clientProcessOptions = new ProcessStartOptions(_testAssemblyLocation, _sampleAppPath, TC.s_oidcWebAppExe, clientEnvVars);
6464

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

6767
if (!areProcessesRunning)
6868
{
@@ -71,7 +71,7 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
7171
foreach (var process in processes)
7272
{
7373
#pragma warning disable CA1305 // Specify IFormatProvider
74-
runningProcesses.AppendLine($"Is {process.Key} running: {TH.ProcessIsAlive(process.Value)}");
74+
runningProcesses.AppendLine($"Is {process.Key} running: {UiTestHelpers.ProcessIsAlive(process.Value)}");
7575
#pragma warning restore CA1305 // Specify IFormatProvider
7676
}
7777
Assert.Fail(TC.WebAppCrashedString + " " + runningProcesses.ToString());
@@ -82,17 +82,17 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
8282
// Initial sign in
8383
_output.WriteLine("Starting web app sign-in flow.");
8484
string email = labResponse.User.Upn;
85-
await TH.NavigateToWebApp(uriWithPort, page);
86-
await TH.EnterEmailAsync(page, email, _output);
87-
await TH.EnterPasswordAsync(page, labResponse.User.GetOrFetchPassword(), _output);
85+
await UiTestHelpers.NavigateToWebApp(uriWithPort, page);
86+
await UiTestHelpers.EnterEmailAsync(page, email, _output);
87+
await UiTestHelpers.EnterPasswordAsync(page, labResponse.User.GetOrFetchPassword(), _output);
8888
await Assertions.Expect(page.GetByText("Integrating Azure AD V2")).ToBeVisibleAsync(_assertVisibleOptions);
8989
await Assertions.Expect(page.GetByText(email)).ToBeVisibleAsync(_assertVisibleOptions);
9090
_output.WriteLine("Web app sign-in flow successful.");
9191

9292
// Sign out
9393
_output.WriteLine("Starting web app sign-out flow.");
9494
await page.GetByRole(AriaRole.Link, new() { Name = "Sign out" }).ClickAsync();
95-
await TH.PerformSignOut_MicrosoftIdFlow(page, email, TC.LocalhostUrl + ClientPort + SignOutPageUriPath, _output);
95+
await UiTestHelpers.PerformSignOut_MicrosoftIdFlow(page, email, TC.LocalhostUrl + ClientPort + SignOutPageUriPath, _output);
9696
_output.WriteLine("Web app sign out successful.");
9797
}
9898
catch (Exception ex)
@@ -111,16 +111,16 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
111111
_output.WriteLine("No Screenshot.");
112112
}
113113

114-
string runningProcesses = TH.GetRunningProcessAsString(processes);
114+
string runningProcesses = UiTestHelpers.GetRunningProcessAsString(processes);
115115
Assert.Fail($"the UI automation failed: {ex} output: {ex.Message}.\n{runningProcesses}\nTest run: {guid}");
116116
}
117117
finally
118118
{
119119
// Add the following to make sure all processes and their children are stopped.
120-
TH.EndProcesses(processes);
120+
UiTestHelpers.EndProcesses(processes);
121121

122122
// Stop tracing and export it into a zip archive.
123-
string path = TH.GetTracePath(_testAssemblyLocation, TraceFileName);
123+
string path = UiTestHelpers.GetTracePath(_testAssemblyLocation, TraceFileName);
124124
await context.Tracing.StopAsync(new() { Path = path });
125125
_output.WriteLine($"Trace data for {TraceFileName} recorded to {path}.");
126126

UiTests/UiTests/MultipleApiUiTest.csproj renamed to UiTests/UiTests/AnyOrgOrPersonalUiTest.csproj

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

2727
<ItemGroup>
2828
<ProjectReference Include="..\Common\Common.csproj" />
29-
<ProjectReference Include="..\..\3-WebApp-multi-APIs\WebApp-OpenIDConnect-DotNet.csproj" />
29+
<ProjectReference Include="..\..\1-WebApp-OIDC\1-3-AnyOrgOrPersonal\WebApp-OpenIDConnect-DotNet.csproj" />
3030
</ItemGroup>
3131

3232
</Project>

UiTests/UiTests/UiTests.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.11.35303.130
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultipleApiUiTest", "MultipleApiUiTest.csproj", "{2B42751A-8650-4DE4-9B46-B01C21825EB1}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnyOrgOrPersonalUiTest", "AnyOrgOrPersonalUiTest.csproj", "{2B42751A-8650-4DE4-9B46-B01C21825EB1}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\Common\Common.csproj", "{3074B729-52E8-408E-8BBC-815FE9217385}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "..\Common\Common.csproj", "{3074B729-52E8-408E-8BBC-815FE9217385}"
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6A8B8F57-DBC6-43E2-84E7-16D24E54157B}"
1111
ProjectSection(SolutionItems) = preProject
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Debug",
5+
"System": "Information",
6+
"Microsoft": "Information"
7+
}
8+
}
9+
}

UiTests/UiTests/appsettings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"AzureAd": {
3+
"Instance": "https://login.microsoftonline.com/",
4+
"Domain": "msidlab3.onmicrosoft.com",
5+
"TenantId": "8e44f19d-bbab-4a82-b76b-4cd0a6fbc97a",
6+
"ClientId": "d9cde0be-ad97-41e6-855e-2f85136671c1",
7+
"CallbackPath": "/signin-oidc",
8+
"SignedOutCallbackPath": "/signout-callback-oidc"
9+
},
10+
"Logging": {
11+
"LogLevel": {
12+
"Default": "Information",
13+
"Microsoft": "Warning",
14+
"Microsoft.Hosting.Lifetime": "Information"
15+
}
16+
},
17+
"AllowedHosts": "*"
18+
}

0 commit comments

Comments
 (0)