-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from aquality-automation/Feature/update-target…
…-framework Update target framework to .NET Core 3.1 (tests) [+semver: minor]
- Loading branch information
Showing
9 changed files
with
82 additions
and
31 deletions.
There are no files selected for viewing
6 changes: 2 additions & 4 deletions
6
Aquality.WinAppDriver/src/Aquality.WinAppDriver/Actions/ActionKey.cs
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
3 changes: 2 additions & 1 deletion
3
Aquality.WinAppDriver/src/Aquality.WinAppDriver/Aquality.WinAppDriver.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
Aquality.WinAppDriver/tests/Aquality.WinAppDriver.Tests/ScreenshotProvider.cs
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,45 @@ | ||
using Aquality.WinAppDriver.Applications; | ||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
using System.IO; | ||
|
||
namespace Aquality.WinAppDriver.Tests | ||
{ | ||
internal class ScreenshotProvider | ||
{ | ||
private readonly IWindowsApplication application; | ||
|
||
internal ScreenshotProvider(IWindowsApplication application) | ||
{ | ||
this.application = application; | ||
} | ||
|
||
internal string TakeScreenshot() | ||
{ | ||
var image = GetImage(); | ||
var directory = Path.Combine(Environment.CurrentDirectory, "screenshots"); | ||
EnsureDirectoryExists(directory); | ||
var screenshotName = $"{GetType().Name}_{DateTime.Now:yyyyMMdd_HHmmss}_{Guid.NewGuid().ToString("n").Substring(0, 5)}.png"; | ||
var path = Path.Combine(directory, screenshotName); | ||
image.Save(path, ImageFormat.Png); | ||
return path; | ||
} | ||
|
||
private Image GetImage() | ||
{ | ||
using (var stream = new MemoryStream(application.RootSession.GetScreenshot().AsByteArray)) | ||
{ | ||
return Image.FromStream(stream); | ||
} | ||
} | ||
|
||
private static void EnsureDirectoryExists(string directory) | ||
{ | ||
if (!Directory.Exists(directory)) | ||
{ | ||
Directory.CreateDirectory(directory); | ||
} | ||
} | ||
} | ||
} |
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