using Microsoft.Playwright; using Microsoft.Playwright.NUnit; using PlaywrightTests.Utilities; namespace PlaywrightTests; [Parallelizable(ParallelScope.Self)] [TestFixture] [Category("version2")] public class EmailTests : PageTest { [SetUp] public async Task Setup() { await Context.Tracing.StartAsync(new() { Title = $"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}", Screenshots = true, Snapshots = true, Sources = true }); } [TearDown] public async Task TearDown() { await Context.Tracing.StopAsync(new() { Path = Path.Combine( TestContext.CurrentContext.WorkDirectory, "playwright-traces", $"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}.zip" ) }); } [Test] public async Task CheckEmails() { await Auth.Login(Page); await Page.GetByRole(AriaRole.Link, new() { Name = " Tickets" }).ClickAsync(); await Page.GetByRole(AriaRole.Gridcell, new() { Name = "New Task", Exact = true }).First.ClickAsync(); await Page.GetByRole(AriaRole.Button, new() { Name = "E-Mail", Exact = true }).ClickAsync(); var fileChooser = await Page.RunAndWaitForFileChooserAsync(async () => { await Page.GetByRole(AriaRole.Button, new() { Name = "Datei hinzufügen" }).ClickAsync(); }); await fileChooser.SetFilesAsync("../../../../../global.json"); await Expect(Page.Locator("#email-content")).ToContainTextAsync("global.json"); await Page.Locator("//div[@id='email-content']/div[2]").ClickAsync(); await Page.Locator("//div[@id='email-content']/div[2]//input").FillAsync("test@c-entron.de"); await Page.Locator("//div[@id='email-content']/div[2]//input").PressAsync("Enter"); await Page.GetByRole(AriaRole.Button, new() { Name = " Senden" }).ClickAsync(); await Expect(Page.GetByText("E-Mail schreiben")).ToBeHiddenAsync(); await Page.GotoAsync("http://localhost:1080/"); await Expect(Page.Locator("tbody")).ToContainTextAsync("Informationen zu Ihrem Ticket, Nummer: 12002"); await Page.GetByRole(AriaRole.Cell, new() { Name = "Informationen zu Ihrem Ticket" }).ClickAsync(); await Expect(Page.Locator("dl")).ToContainTextAsync("global.json"); } }