Fixes the UI testing wwwroot

This commit is contained in:
Paul Schneider 2026-06-14 20:05:01 +01:00
commit e137c3e2ff
10 changed files with 35 additions and 14 deletions

View file

@ -14,7 +14,6 @@ using IdentityModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc;
using Yavsc.Interface;
using Yavsc.Models;
using Yavsc.Services;

View file

@ -18,6 +18,7 @@ JwtSecurityTokenHandler.DefaultMapInboundClaims = true;
var builder = WebApplication.CreateBuilder(args);
builder.AddConfiguration("web");
var authSection = builder.Configuration.GetSection("Authentication");
var issuer = authSection.GetValue<String>("Issuer");

View file

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yavsc.Abstract\Yavsc.Abstract.csproj" />
<ProjectReference Include="..\Yavsc.Abstract\Yavsc.Server.csproj" />
<ProjectReference Include="..\Yavsc.Server\Yavsc.Server.csproj" />
<PackageReference Include="IdentityModel.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
</ItemGroup>

View file

@ -1,16 +1,35 @@
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using Xunit.Abstractions;
using yavscTests;
using yavscTests.ServerFixtures;
namespace SeleniumDocs.GettingStarted;
public static class FirstScript
{
public static void DoTestSeleniumWebSite()
{
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/web-form.html");
[Collection("Yavsc Server")]
public class FirstScript : BaseTestContext
{
public readonly WebServerFixture _serverFixture;
readonly ITestOutputHelper _output;
public FirstScript(ITestOutputHelper output, WebServerFixture fixture) : base(output, fixture)
{
_serverFixture = fixture;
this._output = output;
}
[Fact]
public void DoTestSeleniumWebSite()
{
var firefoxOptions = new FirefoxOptions();
firefoxOptions.AcceptInsecureCertificates = true;
var driver = new FirefoxDriver(firefoxOptions);
driver.Navigate().GoToUrl(_serverFixture.Addresses.FirstOrDefault(u => u.StartsWith("https:")));
var title = driver.Title;

View file

@ -4,7 +4,7 @@ using Yavsc.Models;
using Xunit.Abstractions;
using Yavsc.Server.Models.IT.SourceCode;
using Microsoft.EntityFrameworkCore;
using isnd.tests;
using yavscTests.ServerFixtures;
using Yavsc.Server.Models.IT;
namespace yavscTests

View file

@ -1,6 +1,6 @@
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using isnd.tests;
using yavscTests.ServerFixtures;
using Xunit.Abstractions;
using IdentityModel.Client;

View file

@ -1,4 +1,4 @@
using isnd.tests;
using yavscTests.ServerFixtures;
using Xunit.Abstractions;
namespace yavscTests.Mandatory;

View file

@ -1,4 +1,4 @@
using isnd.tests;
using yavscTests.ServerFixtures;
using Xunit.Abstractions;
namespace yavscTests.Mandatory

View file

@ -1,4 +1,4 @@
using isnd.tests;
using yavscTests.ServerFixtures;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Xunit.Abstractions;

View file

@ -20,7 +20,7 @@ using Yavsc.Extensions;
using Yavsc.Models;
using Client = IdentityServer8.EntityFramework.Entities.Client;
namespace isnd.tests
namespace yavscTests.ServerFixtures
{
[CollectionDefinition("Web server collection")]
@ -120,8 +120,10 @@ namespace isnd.tests
var builder = WebApplication.CreateBuilder();
builder.Environment.EnvironmentName = "Development";
// Set ContentRoot to the Yavsc.Org project directory so WebRootPath resolves correctly
var testAssemblyLocation = AppDomain.CurrentDomain.BaseDirectory;
var yavscOrgPath = Path.GetFullPath(Path.Combine(testAssemblyLocation, "../../src/Yavsc.Org"));
var cwd = System.IO.Directory.GetCurrentDirectory();
var yavscOrgPath = Path.GetFullPath(
Path.Combine(cwd,
"../../../../../src/Yavsc.Org"));
builder.Environment.ContentRootPath = yavscOrgPath;
builder.Configuration