Files
Christoph Schwörer f045b99a25 Codebasis als Dateien ins Arbeitsrepo statt als Gitlink
QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142)
getrackt, ohne .gitmodules und ohne erreichbares Remote. Der
Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar
gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege
der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen.

Umstellung:
- Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert
  (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6)
- Gitlink aus dem Index entfernt
- Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB

Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte
bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
2026-08-26 07:43:51 +02:00

48 lines
2.8 KiB
C#

using Microsoft.Playwright;
namespace PlaywrightTests.Utilities;
public static class Auth
{
private static LocatorAssertionsToContainTextOptions TenSTextTimeout => new() { Timeout = 10_000 };
private static LocatorAssertionsToBeVisibleOptions TenSLocatorAssertTimeout => new() { Timeout = 10_000 };
public static async Task Login(IPage page, AvailableEmployeeForTests user = AvailableEmployeeForTests.Admin)
{
await page.GotoAsync("http://localhost:8050/auth");
var (username, password) = GetCredentials(user);
await page.GetByPlaceholder("Benutzername").ClickAsync();
await page.GetByPlaceholder("Benutzername").FillAsync(username);
await page.GetByPlaceholder("Passwort").ClickAsync();
await page.GetByPlaceholder("Passwort").FillAsync(password);
await page.GetByRole(AriaRole.Button, new() { Name = "Anmelden" }).ClickAsync();
await Assertions.Expect(page.GetByRole(AriaRole.Heading)).ToContainTextAsync("Hallo, c-entron Administrator!", TenSTextTimeout);
}
public static async Task LoginWebAccount(IPage page, AvailableWebAccountForTests user = AvailableWebAccountForTests.Playwright)
{
await page.GotoAsync("http://localhost:8050/auth");
var (username, password) = GetCredentials(user);
await page.GetByPlaceholder("Benutzername").ClickAsync();
await page.GetByPlaceholder("Benutzername").FillAsync(username);
await page.GetByPlaceholder("Passwort").ClickAsync();
await page.GetByPlaceholder("Passwort").FillAsync(password);
await page.GetByRole(AriaRole.Button, new() { Name = "Anmelden" }).ClickAsync();
await Assertions.Expect(page.Locator("a").Filter(new() { HasText = "Receipts" })).ToBeVisibleAsync(TenSLocatorAssertTimeout);
await Assertions.Expect(page.Locator("a").Filter(new() { HasText = "Tickets" })).ToBeVisibleAsync(TenSLocatorAssertTimeout);
}
public static ValueTuple<string, string> GetCredentials(AvailableEmployeeForTests employee) => employee switch
{
AvailableEmployeeForTests.Admin => new ValueTuple<string, string>("admin", "1"),
_ => throw new ArgumentOutOfRangeException(nameof(employee), employee, null)
};
private static ValueTuple<string, string> GetCredentials(AvailableWebAccountForTests webAccount) => webAccount switch
{
AvailableWebAccountForTests.Playwright => new ValueTuple<string, string>("Playwright", "playwright"),
AvailableWebAccountForTests.Alpha => new ValueTuple<string, string>("alphauser", "alphapassword"),
AvailableWebAccountForTests.Beta => new ValueTuple<string, string>("betauser", "betapassword"),
AvailableWebAccountForTests.Gamma => new ValueTuple<string, string>("gammauser", "gammapassword"),
_ => throw new ArgumentOutOfRangeException(nameof(webAccount), webAccount, null)
};
}