-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7792d14
commit 1266de1
Showing
11 changed files
with
134 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/web/Jordnaer.E2E.Tests/AuthenticatedTests/AuthenticatedTopBarTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Text.RegularExpressions; | ||
using Jordnaer.E2E.Tests.Infrastructure; | ||
using Microsoft.Playwright; | ||
using Microsoft.Playwright.NUnit; | ||
using NUnit.Framework; | ||
|
||
namespace Jordnaer.E2E.Tests.AuthenticatedTests; | ||
|
||
[Parallelizable(ParallelScope.All)] | ||
[TestFixture] | ||
[Category(nameof(TestCategory.UI))] | ||
[Category(nameof(TestCategory.Authenticated))] | ||
public class TopBarTests : BrowserTest | ||
{ | ||
[Test] | ||
[TestCase("Chat", ".*/chat")] | ||
[TestCase("Redigér Profil", ".*/profile")] | ||
[TestCase("Log ud", ".*")] | ||
public async Task Links_Should_Be_Visible_In_The_Topbar_And_Redirect_Correctly(string linkName, string redirectUrlRegex) | ||
{ | ||
var page = await SetUpFixture.Context.NewPageAsync(); | ||
await page.GotoAsync(TestConfiguration.Values.BaseUrl); | ||
|
||
var link = page.GetByRole(AriaRole.Link, | ||
new PageGetByRoleOptions | ||
{ | ||
Name = linkName | ||
}); | ||
|
||
await Expect(link).ToBeVisibleAsync(); | ||
|
||
await link.ClickAsync(); | ||
|
||
await Expect(page).ToHaveURLAsync(new Regex(redirectUrlRegex)); | ||
|
||
await page.CloseAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
tests/web/Jordnaer.E2E.Tests/AuthenticatedTests/SidebarTests.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
tests/web/Jordnaer.E2E.Tests/Infrastructure/ConfigurationValues.cs
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
tests/web/Jordnaer.E2E.Tests/Infrastructure/TestConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,56 @@ | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Jordnaer.E2E.Tests.Infrastructure; | ||
|
||
public static class TestConfiguration | ||
{ | ||
// ReSharper disable once InconsistentNaming | ||
private static readonly Lazy<ConfigurationValues> _configuration = new(() => new ConfigurationValues()); | ||
public static readonly ConfigurationValues Values = _configuration.Value; | ||
} | ||
|
||
public class ConfigurationValues | ||
{ | ||
public ConfigurationValues() | ||
{ | ||
var configurationBuilder = new ConfigurationBuilder() | ||
.AddJsonFile("appsettings.json", optional: true) | ||
.AddUserSecrets<ConfigurationValues>() | ||
.AddEnvironmentVariables(); | ||
|
||
IConfiguration configuration = configurationBuilder.Build(); | ||
|
||
BaseUrl = (configuration["Playwright_BaseUrl"] ?? "https://localhost:7116").TrimEnd('/'); | ||
_username = configuration["Playwright_Username"]; | ||
_password = configuration["Playwright_Password"]; | ||
Device = configuration["Playwright_Device"]; | ||
Browser = configuration["Playwright_Browser"] ?? "Chromium"; | ||
Headless = configuration["Playwright_Headless"]? | ||
.Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase) | ||
?? true; | ||
|
||
if (!float.TryParse(configuration["Playwright_SlowMo"], out var slowMo)) | ||
{ | ||
slowMo = 0; | ||
} | ||
|
||
SlowMo = slowMo; | ||
} | ||
|
||
public string Browser { get; } | ||
public string BaseUrl { get; } | ||
public string? Device { get; } | ||
public bool Headless { get; } | ||
public float? SlowMo { get; } | ||
|
||
private readonly string? _username; | ||
public string TestUserName => string.IsNullOrEmpty(_username) | ||
? throw new InvalidOperationException("Test user name is not set") | ||
: _username; | ||
|
||
private readonly string? _password; | ||
|
||
public string TestUserPassword => string.IsNullOrEmpty(_password) | ||
? throw new InvalidOperationException("Test user password is not set") | ||
: _password; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.