forked from Silverfish/proton-bridge
test(BRIDGE-232): Add Home Menu Bridge UI e2e automation tests
This commit is contained in:
@ -5,6 +5,7 @@ using FlaUI.Core;
|
||||
using FlaUI.UIA3;
|
||||
using ProtonMailBridge.UI.Tests.TestsHelper;
|
||||
using FlaUI.Core.Input;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ProtonMailBridge.UI.Tests
|
||||
{
|
||||
@ -14,15 +15,58 @@ namespace ProtonMailBridge.UI.Tests
|
||||
public static Application App;
|
||||
protected static Application Service;
|
||||
protected static Window Window;
|
||||
protected static Window ChromeWindow;
|
||||
protected static Window FileExplorerWindow;
|
||||
|
||||
protected static void ClientCleanup()
|
||||
{
|
||||
App.Kill();
|
||||
App.Dispose();
|
||||
// Give some time to properly exit the app
|
||||
Thread.Sleep(5000);
|
||||
Thread.Sleep(10000);
|
||||
}
|
||||
|
||||
public static void switchToFileExplorerWindow()
|
||||
{
|
||||
var _automation = new UIA3Automation();
|
||||
var desktop = _automation.GetDesktop();
|
||||
|
||||
var _explorerWindow = desktop.FindFirstDescendant(cf => cf.ByClassName("CabinetWClass"));
|
||||
|
||||
// If the File Explorer window is not found, fail the test
|
||||
if (_explorerWindow == null)
|
||||
{
|
||||
throw new Exception("File Explorer window not found.");
|
||||
}
|
||||
|
||||
// Cast the found element to a Window object
|
||||
FileExplorerWindow = _explorerWindow.AsWindow();
|
||||
|
||||
// Focus on the File Explorer window
|
||||
FileExplorerWindow.Focus();
|
||||
}
|
||||
|
||||
public static void switchToChromeWindow()
|
||||
{
|
||||
var _automation = new UIA3Automation();
|
||||
var desktop = _automation.GetDesktop();
|
||||
|
||||
var _chromeWindow = desktop.FindFirstDescendant(cf => cf.ByClassName("Chrome_WidgetWin_1"));
|
||||
|
||||
// If the Chrome window is not found, fail the test
|
||||
if (_chromeWindow == null)
|
||||
{
|
||||
throw new Exception("Google Chrome window not found.");
|
||||
}
|
||||
|
||||
// Cast the found element to a Window object
|
||||
ChromeWindow = _chromeWindow.AsWindow();
|
||||
|
||||
// Focus on the Chrome window
|
||||
ChromeWindow.Focus();
|
||||
}
|
||||
|
||||
|
||||
public static void LaunchApp()
|
||||
{
|
||||
string appExecutable = TestData.AppExecutable;
|
||||
|
||||
Reference in New Issue
Block a user