VisualisePom.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Microsoft.Playwright;
  2. namespace Tests.E2e.PageObjectModels;
  3. public class VisualisePom(IPage page) {
  4. // -------------------------------------------------
  5. // Root
  6. // -------------------------------------------------
  7. public ILocator Root
  8. => page.GetByTestId("visualise-page-root");
  9. // -------------------------------------------------
  10. // Tabs
  11. // -------------------------------------------------
  12. public ILocator TopologyTab
  13. => page.GetByTestId("visualise-tab-topology");
  14. public ILocator LogicalTab
  15. => page.GetByTestId("visualise-tab-logical");
  16. // -------------------------------------------------
  17. // Exports
  18. // -------------------------------------------------
  19. public ILocator ExportPngButton
  20. => page.GetByTestId("visualise-export-png");
  21. public ILocator ExportSourceButton
  22. => page.GetByTestId("visualise-export-source");
  23. // -------------------------------------------------
  24. // High-Level Actions
  25. // -------------------------------------------------
  26. public async Task AssertLoadedAsync()
  27. => await Assertions.Expect(Root).ToBeVisibleAsync();
  28. public async Task SelectTopologyAsync() {
  29. await TopologyTab.ClickAsync();
  30. await page.WaitForURLAsync("**/visualise/topology");
  31. }
  32. public async Task SelectLogicalAsync() {
  33. await LogicalTab.ClickAsync();
  34. await page.WaitForURLAsync("**/visualise/logical");
  35. }
  36. public async Task AssertExportsEnabledAsync() {
  37. await Assertions.Expect(ExportPngButton).ToBeEnabledAsync();
  38. await Assertions.Expect(ExportSourceButton).ToBeEnabledAsync();
  39. }
  40. }