[TearDown]
public async Task AttachFailureScreenshotToAllureAsync()
{
var failed = TestContext.CurrentContext.Result.Outcome.Status == NUnit.Framework.Interfaces.TestStatus.Failed;
if (failed)
{
var screenshotAsync = await Page.ScreenshotAsync(new PageScreenshotOptions
{
Path = $"artifacts/{TestContext.CurrentContext.Test.Name}.png",
FullPage = true
});
AllureApi.AddAttachment(
"FailureScreenshot",
"image/png",
screenshotAsync.ToArray()
);
}
}
[TearDown]
public async Task AttachFailureScreenshotToAllureAsync()
{
var failed = TestContext.CurrentContext.Result.Outcome.Status == NUnit.Framework.Interfaces.TestStatus.Failed;
if (failed)
{
var screenshotAsync = await Page.ScreenshotAsync(new PageScreenshotOptions
{
Path = $"artifacts/{TestContext.CurrentContext.Test.Name}.png",
FullPage = true
});
AllureApi.AddAttachment(
"FailureScreenshot",
"image/png",
screenshotAsync.ToArray()
);
}
}