Fixes the UI testing wwwroot
This commit is contained in:
parent
e83ef7730b
commit
e137c3e2ff
10 changed files with 35 additions and 14 deletions
|
|
@ -14,7 +14,6 @@ using IdentityModel;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Yavsc;
|
|
||||||
using Yavsc.Interface;
|
using Yavsc.Interface;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ JwtSecurityTokenHandler.DefaultMapInboundClaims = true;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.AddConfiguration("web");
|
builder.AddConfiguration("web");
|
||||||
|
|
||||||
var authSection = builder.Configuration.GetSection("Authentication");
|
var authSection = builder.Configuration.GetSection("Authentication");
|
||||||
|
|
||||||
var issuer = authSection.GetValue<String>("Issuer");
|
var issuer = authSection.GetValue<String>("Issuer");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Yavsc.Abstract\Yavsc.Abstract.csproj" />
|
<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="IdentityModel.AspNetCore" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,35 @@
|
||||||
using System;
|
using System;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
|
using OpenQA.Selenium.Firefox;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
using yavscTests;
|
||||||
|
using yavscTests.ServerFixtures;
|
||||||
|
|
||||||
namespace SeleniumDocs.GettingStarted;
|
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;
|
var title = driver.Title;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using Yavsc.Models;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Yavsc.Server.Models.IT.SourceCode;
|
using Yavsc.Server.Models.IT.SourceCode;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using isnd.tests;
|
using yavscTests.ServerFixtures;
|
||||||
using Yavsc.Server.Models.IT;
|
using Yavsc.Server.Models.IT;
|
||||||
|
|
||||||
namespace yavscTests
|
namespace yavscTests
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using isnd.tests;
|
using yavscTests.ServerFixtures;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using IdentityModel.Client;
|
using IdentityModel.Client;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using isnd.tests;
|
using yavscTests.ServerFixtures;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace yavscTests.Mandatory;
|
namespace yavscTests.Mandatory;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using isnd.tests;
|
using yavscTests.ServerFixtures;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace yavscTests.Mandatory
|
namespace yavscTests.Mandatory
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using isnd.tests;
|
using yavscTests.ServerFixtures;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ using Yavsc.Extensions;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Client = IdentityServer8.EntityFramework.Entities.Client;
|
using Client = IdentityServer8.EntityFramework.Entities.Client;
|
||||||
|
|
||||||
namespace isnd.tests
|
namespace yavscTests.ServerFixtures
|
||||||
{
|
{
|
||||||
|
|
||||||
[CollectionDefinition("Web server collection")]
|
[CollectionDefinition("Web server collection")]
|
||||||
|
|
@ -120,8 +120,10 @@ namespace isnd.tests
|
||||||
var builder = WebApplication.CreateBuilder();
|
var builder = WebApplication.CreateBuilder();
|
||||||
builder.Environment.EnvironmentName = "Development";
|
builder.Environment.EnvironmentName = "Development";
|
||||||
// Set ContentRoot to the Yavsc.Org project directory so WebRootPath resolves correctly
|
// Set ContentRoot to the Yavsc.Org project directory so WebRootPath resolves correctly
|
||||||
var testAssemblyLocation = AppDomain.CurrentDomain.BaseDirectory;
|
var cwd = System.IO.Directory.GetCurrentDirectory();
|
||||||
var yavscOrgPath = Path.GetFullPath(Path.Combine(testAssemblyLocation, "../../src/Yavsc.Org"));
|
var yavscOrgPath = Path.GetFullPath(
|
||||||
|
Path.Combine(cwd,
|
||||||
|
"../../../../../src/Yavsc.Org"));
|
||||||
builder.Environment.ContentRootPath = yavscOrgPath;
|
builder.Environment.ContentRootPath = yavscOrgPath;
|
||||||
|
|
||||||
builder.Configuration
|
builder.Configuration
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue