test(e2e): unify toast assertion + extract shared PlaywrightDbConnection (review cleanups)
This commit is contained in:
+4
-16
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.SiteCalls;
|
||||
|
||||
@@ -25,24 +26,11 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.SiteCalls;
|
||||
/// </summary>
|
||||
internal static class SiteCallDataSeeder
|
||||
{
|
||||
private const string DefaultConnectionString =
|
||||
"Server=localhost,1433;Database=ScadaBridgeConfig;User Id=scadabridge_app;Password=ScadaBridge_Dev1#;TrustServerCertificate=true;Encrypt=false;Connect Timeout=5";
|
||||
|
||||
private const string EnvVar = "SCADABRIDGE_PLAYWRIGHT_DB";
|
||||
|
||||
/// <summary>
|
||||
/// Connection string for the running cluster's configuration DB. Resolved
|
||||
/// from <c>SCADABRIDGE_PLAYWRIGHT_DB</c> when set, otherwise the local docker
|
||||
/// dev defaults.
|
||||
/// Connection string for the running cluster's configuration DB.
|
||||
/// Delegates to <see cref="PlaywrightDbConnection.ConnectionString"/>.
|
||||
/// </summary>
|
||||
public static string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
var fromEnv = Environment.GetEnvironmentVariable(EnvVar);
|
||||
return string.IsNullOrWhiteSpace(fromEnv) ? DefaultConnectionString : fromEnv;
|
||||
}
|
||||
}
|
||||
public static string ConnectionString => PlaywrightDbConnection.ConnectionString;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a single row into the central <c>SiteCalls</c> table. Optional
|
||||
|
||||
+2
-4
@@ -320,10 +320,8 @@ public class SiteCallsPageTests
|
||||
// path can sit on the 10s inner relay timeout before the response —
|
||||
// and the toast itself auto-dismisses 5s after it appears, so the
|
||||
// assertion must catch it inside that window.
|
||||
var toast = page.Locator(".toast");
|
||||
await Assertions.Expect(toast).ToBeVisibleAsync(
|
||||
new() { Timeout = 15_000 });
|
||||
Assert.Equal(1, await toast.CountAsync());
|
||||
await Assertions.Expect(page.Locator(".toast")).ToHaveCountAsync(
|
||||
1, new() { Timeout = 15_000 });
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user