diff --git a/PlaywrightDemos/PlayDemo.csproj b/PlaywrightDemos/PlayDemo.csproj index ef5628c..9a0c9dd 100644 --- a/PlaywrightDemos/PlayDemo.csproj +++ b/PlaywrightDemos/PlayDemo.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -10,11 +10,14 @@ - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/PlaywrightDemos/PlaywrightE2ETests_Basta2024.cs b/PlaywrightDemos/PlaywrightE2ETests_Basta2024.cs new file mode 100644 index 0000000..6c1a713 --- /dev/null +++ b/PlaywrightDemos/PlaywrightE2ETests_Basta2024.cs @@ -0,0 +1,367 @@ +using System.Diagnostics.CodeAnalysis; +using Microsoft.Playwright; + +namespace demo123; + +[TestClass] +public class Basta2024_Demos +{ + #region Globals + static bool _isHeadless = false; + static bool _isEnabledTracing = true; + #endregion + + //playwright.Selectors.SetTestIdAttribute("id"); + + //var tag2Label = page.GetByTestId("tag-2-label"); + //await tag2Label.ClickAsync(); + + #region SimpleSmokeTest + [TestMethod] + public async Task Basta2024_SimpleSmokeTest() + { + var playwright = await Playwright.CreateAsync(); + + var launchOptions = new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }; + + var browser = await playwright.Chromium.LaunchAsync(launchOptions); + var context = await browser.NewContextAsync(); + StartTrace(context); + + var page = await context.NewPageAsync(); + await page.GotoAsync("https://basta.net/mainz/"); + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2024_1.png" }); + if (await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).IsVisibleAsync()) + { + await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).ClickAsync(); + } + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2024_2.png" }); + await page.GetByRole(AriaRole.Link, new() { Name = "Programm" }).First.ClickAsync(); + await page.Locator("body").PressAsync("Escape"); + + await page.Locator("[href*=Day2]").First.ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=Day2]").First.HighlightAsync(); + await page.Locator("[href*=Day2]").First.ClickAsync(); + + await page.Locator("[href*=playwright]").ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=playwright]").HighlightAsync(); + await page.Locator("[href*=playwright]").ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2024_3.png" }); + + Assert.IsTrue(page.TitleAsync().Result.Contains("Playwright")); + //await context.CloseAsync(); + //await browser.CloseAsync(); + Basta2024_Demos.StopTrace(context, "Basta2024_SimpleSmokeTest"); + } + #endregion + + #region Video + [TestMethod] + public async Task Basta2024_Video_SimpleSmokeTest() + { + var playwright = await Playwright.CreateAsync(); + + var launchOptions = new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }; + + var browserContextOptions = new BrowserNewContextOptions + { + RecordVideoDir = "videos/", + RecordVideoSize = new RecordVideoSize() { Width = 1024, Height = 768 } + }; + + var browser = await playwright.Chromium.LaunchAsync(launchOptions); + var context = await browser.NewContextAsync(browserContextOptions); + + var page = await context.NewPageAsync(); + await page.GotoAsync("https://basta.net/mainz/"); + if (await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).IsVisibleAsync()) + { + await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).ClickAsync(); + } + await page.GetByRole(AriaRole.Link, new() { Name = "Programm" }).First.ClickAsync(); + await page.Locator("body").PressAsync("Escape"); + + await page.Locator("[href*=Day2]").First.ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=Day2]").First.HighlightAsync(); + await page.Locator("[href*=Day2]").First.ClickAsync(); + + await page.Locator("[href*=playwright]").ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=playwright]").HighlightAsync(); + await page.Locator("[href*=playwright]").ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2024.png" }); + + Assert.IsTrue(page.TitleAsync().Result.Contains("Playwright")); + await context.CloseAsync(); + await browser.CloseAsync(); + } + #endregion + + #region DownloadTest + [TestMethod] + public async Task SevenZip_PlaywrightDownloadTest_() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + + await page.GotoAsync("https://www.7-zip.org/"); + + await page.ScreenshotAsync( + new PageScreenshotOptions + { + Path = "SevenZipPage.png", + }); + + var task = page.RunAndWaitForDownloadAsync(async () => + { + await page.Locator("[href*=x64]") + .And(page.GetByRole(AriaRole.Link)) + .ClickAsync(); + }); + + await task.Result.SaveAsAsync("7zip-x64.exe"); + Assert.IsTrue(File.Exists("7zip-x64.exe")); + await browser.CloseAsync(); + } + + [TestMethod] + public async Task HeiseMediadaten_PlaywrightDownloadTest_() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://mediadaten.heise.de/en/home/rate-cards/"); + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "heise_ratecards.png" }); + + var task = page.RunAndWaitForDownloadAsync(async () => + { + await page.Locator("text=ct_2024").ClickAsync(); + }); + + await task.Result.SaveAsAsync("mediadaten_ct_2024.pdf"); + + Assert.IsTrue(File.Exists("mediadaten_ct_2024.pdf")); + + await browser.CloseAsync(); + + } + #endregion + + #region DataDriven + [TestMethod] + [DataTestMethod] + [DataRow("Chromium")] + [DataRow("Firefox")] + [DataRow("Webkit")] + public async Task DataDriven_Basta2023_SimpleSmokeTest(string BrowserName) + { + var playwright = await Playwright.CreateAsync(); + + var browser = await GetBrowserAsync(playwright, BrowserName); + var context = await browser.NewContextAsync(); + + var page = await context.NewPageAsync(); + await page.GotoAsync("https://basta.net/mainz/"); + if (await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).IsVisibleAsync()) + { + await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).ClickAsync(); + } + await page.GetByRole(AriaRole.Link, new() { Name = "Programm" }).First.ClickAsync(); + await page.Locator("body").PressAsync("Escape"); + + await page.Locator("[href*=Day2]").First.ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=Day2]").First.HighlightAsync(); + await page.Locator("[href*=Day2]").First.ClickAsync(); + + await page.Locator("[href*=playwright]").ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=playwright]").HighlightAsync(); + await page.Locator("[href*=playwright]").ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2024.png" }); + + Assert.IsTrue(page.TitleAsync().Result.Contains("Playwright")); + await context.CloseAsync(); + await browser.CloseAsync(); + } + + private static async Task GetBrowserAsync(IPlaywright playwright, string BrowserName) + { + var browserOptions = new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }; + + switch (BrowserName) + { + case "Chromium": + return await playwright.Chromium.LaunchAsync(browserOptions); + case "Firefox": + return await playwright.Firefox.LaunchAsync(browserOptions); + case "Webkit": + return await playwright.Webkit.LaunchAsync(browserOptions); + default: + throw new ArgumentException("Browser not supported"); + } + } + #endregion + + #region DeviceTest + [TestMethod] + public async Task Basta2023_DeviceTest_SmokeTest() + { + var playwright = await Playwright.CreateAsync(); + + var launchOptions = new BrowserTypeLaunchOptions + { + Headless = _isHeadless + //,SlowMo = 2000 + }; + + // execute test on iPhone 13 landscape + var device = playwright.Devices["iPhone 13 landscape"]; + device.RecordVideoDir = "videos-iPhone/"; + device.RecordVideoSize = new RecordVideoSize() { Width = 1024, Height = 768 }; + + var browser = await playwright.Chromium.LaunchAsync(launchOptions); + var context = await browser.NewContextAsync(device); + + var page = await context.NewPageAsync(); + await page.GotoAsync("https://basta.net/mainz/"); + if (await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).IsVisibleAsync()) + { + await page.GetByRole(AriaRole.Button, new() { Name = "Alle akzeptieren" }).ClickAsync(); + } + await page.GetByRole(AriaRole.Link, new() { Name = "Programm" }).First.ClickAsync(); + await page.Locator("body").PressAsync("Escape"); + + await page.Locator("[href*=Day2]").First.ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=Day2]").First.HighlightAsync(); + await page.Locator("[href*=Day2]").First.ClickAsync(); + + await page.Locator("[href*=playwright]").ScrollIntoViewIfNeededAsync(); + await page.Locator("[href*=playwright]").HighlightAsync(); + await page.Locator("[href*=playwright]").ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot_basta2023.png" }); + + Assert.IsTrue(page.TitleAsync().Result.Contains("Playwright")); + await context.CloseAsync(); + await browser.CloseAsync(); + } + #endregion + + #region Route Demo + [TestMethod] + public async Task Basta2023_Playwright_RouteBlockTest() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 5000 + }); + + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + + await page.RouteAsync("**/*.{png,jpg,jpeg,svg}", route => route.FulfillAsync(new() + { + Status = 404, + ContentType = "text/plain", + Body = "Not Found!" + })); + + await page.GotoAsync("https://www.basta.net/mainz/"); + + await page.ScreenshotAsync( + new PageScreenshotOptions + { + Path = "BastaPage.png", + }); + + await browser.CloseAsync(); + } + #endregion + +#region Route Advanced +//await page.RouteAsync("**/*.png", route => route.FulfillAsync(new () +/*{ + Status = 404, + ContentType = "text/plain", + Body = "Not Found!" +}));*/ + +/*await page.RouteAsync("https://ebnerjobs.de/mediadaten/developer-media-jobs", async route => +{ + var response = await route.FetchAsync(); + await route.FulfillAsync(new RouteFulfillOptions + { + Response = response, + Headers = new Dictionary(response.Headers) + { + ["Content-Disposition"] = "attachment" + ,//["Content-Type"] = "application/binary" + } + }); +});*/ +#endregion + +#region Helper + +public async void StartTrace(IBrowserContext context) +{ + if (!_isEnabledTracing) + { + return; + } + + await context.Tracing.StartAsync(new TracingStartOptions + { + Screenshots = true, + Snapshots = true, + Sources = true + }); +} + + public static void StopTrace(IBrowserContext context, string testName) + { + if (!_isEnabledTracing) + { + return; + } + + var traceOptions = new TracingStopOptions + { + Path = testName + "_trace.zip" + //Path = "trace.zip" + }; + context.Tracing.StopAsync(traceOptions).Wait(); + } + #endregion + +} \ No newline at end of file diff --git a/PlaywrightDemos/PlaywrightE2ETests_DDC2023.cs b/PlaywrightDemos/PlaywrightE2ETests_DDC2023.cs index 2f6ae34..b072529 100644 --- a/PlaywrightDemos/PlaywrightE2ETests_DDC2023.cs +++ b/PlaywrightDemos/PlaywrightE2ETests_DDC2023.cs @@ -1,9 +1,8 @@ -using System.Diagnostics.CodeAnalysis; using Microsoft.Playwright; namespace demo123; -[TestClass] +//[TestClass] - Disabled for now public class DDC2023_Demos { //playwright.Selectors.SetTestIdAttribute("id"); @@ -19,7 +18,7 @@ public async Task DDC2023_SimpleSmokeTest() var launchOptions = new BrowserTypeLaunchOptions { - Headless = true + Headless = false ,SlowMo = 2000 }; @@ -53,7 +52,7 @@ public async Task DDC2023_Video_SimpleSmokeTest() var launchOptions = new BrowserTypeLaunchOptions { - Headless = true, + Headless = false, SlowMo = 2000 }; @@ -75,6 +74,9 @@ public async Task DDC2023_Video_SimpleSmokeTest() await page.Locator("[href*=playwright]").HighlightAsync(); await page.Locator("[href*=playwright]").ClickAsync(); + + + Assert.IsTrue( page.GetByRole( AriaRole.Heading, @@ -93,7 +95,7 @@ public async Task SevenZip_PlaywrightDownloadTest_() await using var browser = await playwright.Chromium.LaunchAsync( new BrowserTypeLaunchOptions { - Headless = true, + Headless = false, SlowMo = 2000 }); var browserContext = await browser.NewContextAsync(); @@ -126,7 +128,7 @@ public async Task HeiseMediadaten_PlaywrightDownloadTest_() await using var browser = await playwright.Chromium.LaunchAsync( new BrowserTypeLaunchOptions { - Headless = true, + Headless = false, SlowMo = 2000 }); var browserContext = await browser.NewContextAsync(); @@ -182,7 +184,7 @@ private static async Task GetBrowserAsync(IPlaywright playwright, stri { var browserOptions = new BrowserTypeLaunchOptions { - Headless = true, + Headless = false, SlowMo = 2000 }; @@ -214,7 +216,7 @@ public async Task DDC2023_DeviceTest_SmokeTest() var launchOptions = new BrowserTypeLaunchOptions { - Headless = true + Headless = false //,SlowMo = 2000 }; @@ -251,7 +253,7 @@ public async Task DDC_Playwright_RouteBlockTest() await using var browser = await playwright.Chromium.LaunchAsync( new BrowserTypeLaunchOptions { - Headless = true, + Headless = false, SlowMo = 2000 }); @@ -300,4 +302,5 @@ await route.FulfillAsync(new RouteFulfillOptions }); });*/ #endregion + } diff --git a/PlaywrightDemos/PlaywrightE2ETests_MDD2024.cs b/PlaywrightDemos/PlaywrightE2ETests_MDD2024.cs new file mode 100644 index 0000000..23288a5 --- /dev/null +++ b/PlaywrightDemos/PlaywrightE2ETests_MDD2024.cs @@ -0,0 +1,265 @@ +using Microsoft.Playwright; + +namespace PlayDemo; + +//[TestClass] - Tests disabled +public class PlaywrightE2ETests_MDD2024 +{ + #region Globals + static bool _isHeadless = true; + #endregion + + #region SimpleSmokeTest + [TestMethod] + public async Task MDD_SimpleSmokeTest() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000, + }); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://md-devdays.de/home"); + await page.Locator("text=Speichern").First.ClickAsync(); + await page.Locator("text=Session-Übersicht").First.ClickAsync(); + //await page.GetByRole(AriaRole.Tab, new() { Name = "14.05." }).ClickAsync(); + await page.Locator("id=mat-tab-label-0-1").ClickAsync(); + await page.Locator("text=Playwright").HighlightAsync(); + await page.Locator("text=Playwright").ScrollIntoViewIfNeededAsync(); + var sessionLink = page.Locator(".act-card-content-container"). + Filter(new() { HasText = "Testautomatisierung für WebApps mit Playwright" }). + GetByText("Mehr Infos"); + await sessionLink.ScrollIntoViewIfNeededAsync(); + await sessionLink.HighlightAsync(); + await sessionLink.ClickAsync(); + + //await page.PauseAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "session.png" }); + + Assert.IsTrue( + await page.Locator("text=Magdeburg").IsVisibleAsync()); + + //await page.PauseAsync(); + await browser.CloseAsync(); + } + #endregion + + #region DataDrivenSmokeTest + [DataTestMethod] + [TestMethod] + [DataRow("Chromium")] + [DataRow("Firefox")] + [DataRow("Webkit")] + [DataRow("Edge")] + [DataRow("Chrome")] + public async Task MDD_DataDrivenSmokeTest(string BrowserName) + { + var playwright = await Playwright.CreateAsync(); + var browser = await GetBrowserAsync(playwright, BrowserName); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://md-devdays.de/home"); + await page.Locator("text=Speichern").First.ClickAsync(); + await page.Locator("text=Session-Übersicht").First.ClickAsync(); + //await page.GetByRole(AriaRole.Tab, new() { Name = "14.05." }).ClickAsync(); + await page.Locator("id=mat-tab-label-0-1").ClickAsync(); + await page.Locator("text=Playwright").HighlightAsync(); + await page.Locator("text=Playwright").ScrollIntoViewIfNeededAsync(); + var sessionLink = page.Locator(".act-card-content-container"). + Filter(new() { HasText = "Testautomatisierung für WebApps mit Playwright" }). + GetByText("Mehr Infos"); + await sessionLink.ScrollIntoViewIfNeededAsync(); + await sessionLink.HighlightAsync(); + await sessionLink.ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "session.png" }); + + Assert.IsTrue( + await page.Locator("text=Magdeburg").IsVisibleAsync()); + + //await page.PauseAsync(); + await browser.CloseAsync(); + } + + private static async Task GetBrowserAsync(IPlaywright playwright, string BrowserName) + { + var browserOptions = new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }; + + switch (BrowserName) + { + case "Chromium": + return await playwright.Chromium.LaunchAsync(browserOptions); + case "Firefox": + return await playwright.Firefox.LaunchAsync(browserOptions); + case "Webkit": + return await playwright.Webkit.LaunchAsync(browserOptions); + case "Edge": + browserOptions.Channel = "msedge"; + return await playwright.Webkit.LaunchAsync(browserOptions); + case "Chrome": + browserOptions.Channel = "chrome"; + return await playwright.Webkit.LaunchAsync(browserOptions); + default: + throw new ArgumentException("Browser not supported"); + } + } + #endregion + + #region DowmloadTest + [TestMethod] + public async Task HeiseMediadaten_PlaywrightDownloadTest_() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://mediadaten.heise.de/en/home/rate-cards/"); + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "heise_ratecards.png" }); + + var task = page.RunAndWaitForDownloadAsync(async () => + { + await page.Locator("text=ct_2024").ClickAsync(); + }); + + await task.Result.SaveAsAsync("mediadaten_ct_2024.pdf"); + + Assert.IsTrue(File.Exists("mediadaten_ct_2024.pdf")); + + await browser.CloseAsync(); + + } + + [TestMethod] + public async Task SevenZip_PlaywrightDownloadTest_() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + var browserContext = await browser.NewContextAsync(); + var page = await browserContext.NewPageAsync(); + + await page.GotoAsync("https://www.7-zip.org/"); + + await page.ScreenshotAsync( + new PageScreenshotOptions + { + Path = "SevenZipPage.png", + }); + + var task = page.RunAndWaitForDownloadAsync(async () => + { + await page.Locator("[href*=x64]") + .And(page.GetByRole(AriaRole.Link)) + .ClickAsync(); + }); + + await task.Result.SaveAsAsync("7zip-x64.exe"); + Assert.IsTrue(File.Exists("7zip-x64.exe")); + await browser.CloseAsync(); + } + #endregion + + #region DeviceTest + [TestMethod] + public async Task MDD_DeviceTest() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + + // execute test on iPhone 13 landscape + var device = playwright.Devices["iPhone 13 landscape"]; + var browserContext = await browser.NewContextAsync(device); + + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://md-devdays.de/home"); + await page.Locator("text=Speichern").First.ClickAsync(); + await page.Locator("text=Session-Übersicht").First.ClickAsync(); + //await page.GetByRole(AriaRole.Tab, new() { Name = "14.05." }).ClickAsync(); + await page.Locator("id=mat-tab-label-0-1").ClickAsync(); + await page.Locator("text=Playwright").HighlightAsync(); + await page.Locator("text=Playwright").ScrollIntoViewIfNeededAsync(); + var sessionLink = page.Locator(".act-card-content-container"). + Filter(new() { HasText = "Testautomatisierung für WebApps mit Playwright" }). + GetByText("Mehr Infos"); + await sessionLink.ScrollIntoViewIfNeededAsync(); + await sessionLink.HighlightAsync(); + await sessionLink.ClickAsync(); + + //await page.PauseAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "session.png" }); + + Assert.IsTrue( + await page.Locator("text=Magdeburg").IsVisibleAsync()); + + //await page.PauseAsync(); + await browser.CloseAsync(); + } + #endregion + + #region VideoTest + [TestMethod] + public async Task MDD_VideoSimpleTest() + { + var playwright = await Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync( + new BrowserTypeLaunchOptions + { + Headless = _isHeadless, + SlowMo = 2000 + }); + + var browserContextOptions = new BrowserNewContextOptions + { + RecordVideoDir = "videos/", + RecordVideoSize = new RecordVideoSize() { Width = 1024, Height = 768 } + }; + var browserContext = await browser.NewContextAsync(browserContextOptions); + + var page = await browserContext.NewPageAsync(); + await page.GotoAsync("https://md-devdays.de/home"); + await page.Locator("text=Speichern").First.ClickAsync(); + await page.Locator("text=Session-Übersicht").First.ClickAsync(); + //await page.GetByRole(AriaRole.Tab, new() { Name = "14.05." }).ClickAsync(); + await page.Locator("id=mat-tab-label-0-1").ClickAsync(); + await page.Locator("text=Playwright").HighlightAsync(); + await page.Locator("text=Playwright").ScrollIntoViewIfNeededAsync(); + var sessionLink = page.Locator(".act-card-content-container"). + Filter(new() { HasText = "Testautomatisierung für WebApps mit Playwright" }). + GetByText("Mehr Infos"); + await sessionLink.ScrollIntoViewIfNeededAsync(); + await sessionLink.HighlightAsync(); + await sessionLink.ClickAsync(); + + await page.ScreenshotAsync(new PageScreenshotOptions { Path = "session.png" }); + + Assert.IsTrue( + await page.Locator("text=Magdeburg").IsVisibleAsync()); + + //await page.PauseAsync(); + await browser.CloseAsync(); + } + #endregion +} \ No newline at end of file