Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ jobs:
- name: Run Integration Tests (UI Edge)
env:
Browser: Edge
DriverPath: C:\\SeleniumWebDrivers\\EdgeDriver\\
DriverExe: msedgedriver.exe
run: |
dotnet test "SecurityService.OpenIdConnect.IntegrationTests\SecurityService.OpenIdConnect.IntegrationTests.csproj" --filter Category=PRTest

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
using OpenQA.Selenium;

namespace SecurityService.IntergrationTests.Common;

public static class BrowserNavigation
{
public static async Task NavigateWithDiagnosticsAsync(
Func<Task> navigate,
Action<string> log = null)
{
try
{
await navigate();
}
catch (WebDriverException exception)
{
log?.Invoke($"Browser navigation failed without retry because the URL may be state-changing: {exception.Message}");
throw;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Threading.Tasks;
using NUnit.Framework;
using OpenQA.Selenium;

namespace SecurityService.IntergrationTests.Common;

[TestFixture]
public class BrowserNavigationTests
{
[Test]
public async Task NavigateWithDiagnosticsAsync_DoesNotRetryAfterNavigationFailure()
{
Int32 attempts = 0;
String logMessage = String.Empty;

Assert.ThrowsAsync<WebDriverException>(async () => await BrowserNavigation.NavigateWithDiagnosticsAsync(
async () =>
{
attempts++;
throw new WebDriverException("navigation failure");
},
message => logMessage = message));

Assert.That(attempts, Is.EqualTo(1));
Assert.That(logMessage, Does.Contain("navigation failure"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ await Retry.For(async () =>
{
EdgeOptions options = new EdgeOptions();
options.AcceptInsecureCertificates = true;
options.PageLoadStrategy = PageLoadStrategy.Eager;
options.AddArguments("--headless=new");
options.AddArguments("--window-size=1280x1024");
options.AddArguments("--no-sandbox");
options.AddArguments("--disable-dev-shm-usage");
options.AddArguments("--disable-gpu");
options.AddArguments("--host-resolver-rules=MAP identity-server 127.0.0.1");
await Retry.For(async () =>
{
this.WebDriver = new EdgeDriver(options);
}, TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(60));
this.WebDriver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(45);
}

this.ObjectContainer.RegisterInstanceAs(this.WebDriver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,15 @@ public async Task ThenIGetAWelcomeEmailWithMyLoginDetails()


[When(@"I navigate to the confirm email address")]
public void WhenINavigateToTheConfirmEmailAddress() {
this.WebDriver.Navigate().GoToUrl(this.TestingContext.ConfirmEmailAddressLink);
public async Task WhenINavigateToTheConfirmEmailAddress()
{
await BrowserNavigation.NavigateWithDiagnosticsAsync(
() =>
{
this.WebDriver.Navigate().GoToUrl(this.TestingContext.ConfirmEmailAddressLink);
return Task.CompletedTask;
},
message => this.TestingContext.DockerHelper.Logger.LogInformation(message));
}

[Then(@"I am presented with the confirm email address successful screen")]
Expand Down
Loading