diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/LdapMappingCrudTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/LdapMappingCrudTests.cs index 09c18bb4..71bc017f 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/LdapMappingCrudTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/LdapMappingCrudTests.cs @@ -1,4 +1,5 @@ using Microsoft.Playwright; +using System.Text.Json; using ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster; namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Admin; @@ -22,65 +23,104 @@ public class LdapMappingCrudTests { Skip.IfNot(await ClusterAvailability.IsAvailableAsync(), ClusterAvailability.SkipReason); - // Keep the group name short and unique to avoid collisions with other test runs. + // Truncated to 18 chars to stay within the form field's maximum input length + // while still being unique (the zztest-grp- prefix + 7 hex chars from the GUID). var group = $"zztest-grp-{Guid.NewGuid():N}"[..18]; var page = await _fixture.NewAuthenticatedPageAsync(); - // ── CREATE ──────────────────────────────────────────────────────────────── - await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/admin/ldap-mappings/create"); - await page.WaitForLoadStateAsync(LoadState.NetworkIdle); + try + { + // ── CREATE ──────────────────────────────────────────────────────────────── + await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/admin/ldap-mappings/create"); + await page.WaitForLoadStateAsync(LoadState.NetworkIdle); - // The LDAP Group Name label has no `for=` attribute so GetByLabel does not - // work. Locate the input that immediately follows the label text instead. - await page.Locator("label:has-text('LDAP Group Name') + input.form-control.form-control-sm").FillAsync(group); - await page.SelectOptionAsync(".form-select.form-select-sm", "Designer"); - await page.ClickAsync("button.btn.btn-success.btn-sm:has-text('Save')"); + // The LDAP Group Name label has no `for=` attribute so GetByLabel does not + // work. Locate the input that immediately follows the label text instead. + await page.Locator("label:has-text('LDAP Group Name') + input.form-control.form-control-sm").FillAsync(group); + // Scope the role select to the div.mb-2 that owns the "Role" label so a + // second select (Site Scope) on the edit page cannot cause a strict-mode + // violation. The LdapMappingForm.razor uses Blazor @bind, not