public static void SelectOptionInContextMenu(Window window, Point point, string option)
 {
     LoggerUtil.Info($"Selecting option {option} in context menu");
     Mouse.Instance.Location = point;
     RightClickWithDelay();
     window.Popup.Item(option).Click();
 }
Example #2
0
 public static void CloseAllProcessesByName(string processName)
 {
     Process[] processes = Process.GetProcessesByName(processName);
     foreach (Process p in processes)
     {
         LoggerUtil.Info($"Killing all processes with name: {processName}");
         p.Kill();
     }
 }
Example #3
0
 public static void AssertTrue(bool condition, string message)
 {
     try
     {
         Assert.True(condition, message);
         LoggerUtil.Info("Condition is true");
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected 'true', found {condition}" + ex);
         Assert.Fail();
     }
 }
Example #4
0
 public static void AssertNotNull(object targetObject, string message)
 {
     try
     {
         Assert.NotNull(targetObject, message);
         LoggerUtil.Info("Object is not null");
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected object is not null, but found: {ex}");
         Assert.Fail();
     }
 }
Example #5
0
        public static bool ImageCompareString(Bitmap firstImage, Bitmap secondImage)
        {
            MemoryStream ms = new MemoryStream();

            firstImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            String firstBitmap = Convert.ToBase64String(ms.ToArray());

            ms.Position = 0;

            secondImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            String secondBitmap = Convert.ToBase64String(ms.ToArray());

            if (firstBitmap.Equals(secondBitmap))
            {
                LoggerUtil.Info("Images are equal");
                return(true);
            }
            LoggerUtil.Error("Images are not equal");
            return(false);
        }