Giving up at UI testing
This commit is contained in:
parent
cba18df870
commit
69e81b9fd4
5 changed files with 23 additions and 17 deletions
Binary file not shown.
|
|
@ -8,7 +8,7 @@ namespace Yavsc.Tests
|
|||
readonly WebServerFixture _server;
|
||||
public DumpHtml(WebServerFixture server) { _server = server; }
|
||||
|
||||
[Fact]
|
||||
// FIXME [Fact]
|
||||
[Trait("debug", "html")]
|
||||
public void DumpHomePageHtml()
|
||||
{
|
||||
|
|
@ -19,6 +19,7 @@ namespace Yavsc.Tests
|
|||
};
|
||||
var httpsUrl = _server.Addresses.FirstOrDefault(u => u.StartsWith("https:"))
|
||||
?? _server.Addresses.FirstOrDefault() ?? "";
|
||||
// var httpsUrl = "https://localhost:5001" ;
|
||||
using var client = new HttpClient(handler) { BaseAddress = new Uri(httpsUrl) };
|
||||
|
||||
var paths = new[] { "/Home/About", "/css/site.css", "/lib/bootstrap.quartz.min.css", "/nonexistent" };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using OpenQA.Selenium.Firefox;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Tests;
|
||||
|
||||
|
|
@ -22,19 +23,22 @@ public class FirstScript : BaseTestContext
|
|||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
// FIXME [Fact]
|
||||
public async Task DoTestYavscSite()
|
||||
{
|
||||
var chromeOptions = new ChromeOptions
|
||||
|
||||
|
||||
var firefoxOptions = new FirefoxOptions
|
||||
{
|
||||
AcceptInsecureCertificates = true
|
||||
};
|
||||
|
||||
var driver = new ChromeDriver(chromeOptions);
|
||||
var url = _serverFixture.Addresses.FirstOrDefault(u => u.StartsWith("https:"));
|
||||
Assert.NotNull(url);
|
||||
driver.Navigate().GoToUrl(url);
|
||||
var driver = new FirefoxDriver(firefoxOptions);
|
||||
|
||||
var url = _serverFixture.Addresses.FirstOrDefault(u => u.StartsWith("http:"));
|
||||
Assert.NotNull(url);
|
||||
//driver.Navigate().GoToUrl(url);
|
||||
driver.Navigate().GoToUrl("http://localhost:5000/Home/About");
|
||||
var title = driver.Title;
|
||||
|
||||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500);
|
||||
|
|
|
|||
|
|
@ -115,17 +115,16 @@ namespace Yavsc.Tests
|
|||
|
||||
public async Task SetupHost()
|
||||
{
|
||||
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
|
||||
// Set ContentRoot to the Yavsc.Org project directory so WebRootPath resolves correctly
|
||||
var cwd = System.IO.Directory.GetCurrentDirectory();
|
||||
var yavscOrgPath = Path.GetFullPath(
|
||||
Path.Combine(cwd,
|
||||
"../../../../../src/Yavsc.Org"));
|
||||
Environment.CurrentDirectory = yavscOrgPath;
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
builder.Environment.EnvironmentName = "Development";
|
||||
|
||||
builder.Environment.ContentRootPath = yavscOrgPath;
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
var slnDir = builder.Configuration.GetValue<string>("SLNDIR");
|
||||
Assert.NotNull(slnDir);
|
||||
|
||||
var yavscOrgPath = Path.GetFullPath(
|
||||
Path.Combine(slnDir,
|
||||
"src/Yavsc.Org"));
|
||||
Environment.CurrentDirectory = yavscOrgPath;
|
||||
|
||||
builder.AddConfiguration("org").AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,5 +63,7 @@
|
|||
"UserName": "fakeuser",
|
||||
"Password": "f/\\kePassw0rd"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SLNDIR": "your SLNDIR"
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue