yavsc/src/Yavsc.Org.Tests/FirstUIStript.cs
Paul Schneider 22b397ce7e Relocate test project: test/yavscTests -> src/Yavsc.Org.Tests
Move the integration test project from the top-level test/ directory into
src/ alongside the projects it tests. Rename the project (and folder) to
Yavsc.Org.Tests to match .NET conventions and reflect that it tests the
Org runtime primarily.

Path changes:
- test/yavscTests/yavscTests.csproj -> src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj
- All .cs / .json / .resx files moved to their new location
- PostItViewModelTests moved out to the dedicated src/PostIt.Tests project
  (it was unrelated to Org testing)

Build adjustments:
- <ProjectReference> paths shortened (..\..\src\X -> ..\X)
- PostIt project reference removed (covered by its own test project)
- <OutputType>exe added (required by xunit.v3)
- xunit.v3.common and xunit.v3.extensibility.core added to package versions

Solution + sln:
- yavsc.sln Project Name updated to 'Yavsc.Org.Tests' and path updated
- GUID preserved so existing build configs stay valid

Static web assets:
- The CopyStaticWebAssetsManifest target was hard-coding the destination
  filename to 'testhost.staticwebassets.endpoints.json', which worked
  when the assembly was named 'yavscTests'. Now that the assembly name
  is 'Yavsc.Org.Tests', ASP.NET Core's MapStaticAssets() looks for
  'Yavsc.Org.Tests.staticwebassets.endpoints.json' (entry-assembly-based
  resolution). Use $(MSBuildProjectName) so the copy target stays
  correct under any future rename.
2026-06-19 17:52:54 +01:00

76 lines
1.9 KiB
C#

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
namespace yavscTests.ServerFixtures;
[Collection("Yavsc Server")]
public class FirstScript : BaseTestContext
{
public readonly WebServerFixture _serverFixture;
readonly ITestOutputHelper _output;
IWebDriver driver = new ChromeDriver();
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("http:")));
driver.Quit();
}
// FIXME [Fact]
public async Task DoTestYavscSite()
{
var firefoxOptions = new FirefoxOptions
{
AcceptInsecureCertificates = true
};
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);
var navbar = driver.FindElement(By.Id("navbar"));
Assert.NotNull(navbar);
/*
var textBox = driver.FindElement(By.Name("my-text"));
var submitButton = driver.FindElement(By.TagName("button"));
textBox.SendKeys("Selenium");
submitButton.Click();
var message = driver.FindElement(By.Id("message"));
var value = message.Text;
*/
driver.Quit();
}
}