ConnectionsPagePom.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Microsoft.Playwright;
  2. namespace Tests.E2e.PageObjectModels;
  3. /// <summary>
  4. /// The global /connections page. It mounts PortConnectionModal with
  5. /// TestIdPrefix="connections" — note that is the modal's base directly,
  6. /// without the "-port-group" segment a resource card contributes.
  7. /// </summary>
  8. public class ConnectionsPagePom(IPage page) {
  9. private const string _modalBaseTestId = "connections";
  10. public ConnectionModalPom Modal => new(page, _modalBaseTestId);
  11. public ILocator Root
  12. => page.GetByTestId("connections-page-root");
  13. public ILocator AddButton
  14. => page.GetByTestId("connections-add-button");
  15. // -------------------------------------------------
  16. // High-Level Actions
  17. // -------------------------------------------------
  18. public async Task GotoAsync(string baseUrl) {
  19. await page.GotoAsync($"{baseUrl}/connections");
  20. await AssertLoadedAsync();
  21. }
  22. public async Task AssertLoadedAsync()
  23. => await Assertions.Expect(Root).ToBeVisibleAsync();
  24. public async Task OpenModalAsync() {
  25. await AddButton.ClickAsync();
  26. await Modal.AssertOpenAsync();
  27. }
  28. }