Created
July 22, 2021 12:11
-
-
Save Chandankkrr/80e132d18916da61f0855d2fc3eebc3b to your computer and use it in GitHub Desktop.
Capture page screenshot when expected container is not found during E2E test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var welcomeTextContainer = await page.QuerySelectorAsync($"text=Hello {email}"); | |
if (welcomeTextContainer == null) | |
{ | |
await page.ScreenshotAsync( | |
new PageScreenshotOptions | |
{ | |
Path = "screenshot.png" | |
}); | |
// fail test | |
throw new XunitException("Test failed, unable to find welcome text container"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment