-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for automatically taking screenshots at the end of each UI te…
…st (passed or failed). (#130) Implemented ability to automatically take screenshots for UI tests, locally and when using GitHub Actions. A screenshot is taken at the end of every UI test (all tests inherited from `PlaywrightTestsBase` class). Currently `VsTestSettings(TakeScreenshotOnFailure = true)` attribute doesn't work for async tests (`Task async` or `void async`), which is way the custom solution was implemented. - Updated Cake Build and Nightly Build to include support for taking screenshots via GitHub Actions. - Additional logging for Solution_Name_Is_Added_To_Chat_Input(), which very rarely fails. - Additional logging for PlaywrightTestsBase.GetChatContextTags() - Fixed logging for TestBase.OpenSolution()
- Loading branch information
1 parent
ccf3c5f
commit ed19db1
Showing
11 changed files
with
141 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
|
||
namespace Cody.VisualStudio.Tests | ||
{ | ||
public class ScreenshotUtil | ||
{ | ||
public static void CaptureWindow(IntPtr hwnd, string path) | ||
{ | ||
var rect = default(RECT); | ||
GetWindowRect(hwnd, ref rect); | ||
CaptureScreenArea( | ||
path, | ||
left: rect.Left, | ||
top: rect.Top, | ||
width: rect.Right - rect.Left, | ||
height: rect.Bottom - rect.Top); | ||
} | ||
|
||
public static void CaptureScreenArea(string path, int left, int top, int width, int height) | ||
{ | ||
using (var bitmap = new Bitmap(width, height)) | ||
using (var image = Graphics.FromImage(bitmap)) | ||
{ | ||
image.CopyFromScreen( | ||
sourceX: left, | ||
sourceY: top, | ||
blockRegionSize: new Size(width, height), | ||
copyPixelOperation: CopyPixelOperation.SourceCopy, | ||
destinationX: 0, | ||
destinationY: 0); | ||
|
||
bitmap.Save(path, ImageFormat.Png); | ||
} | ||
} | ||
|
||
[DllImport("user32.dll")] | ||
private static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect); | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
private struct RECT | ||
{ | ||
public int Left; | ||
public int Top; | ||
public int Right; | ||
public int Bottom; | ||
} | ||
} | ||
|
||
} |
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
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