Skip to content

Commit

Permalink
Merge branch 'Releases/Beta' into Feature/Playwright_UIElementActionE…
Browse files Browse the repository at this point in the history
…nahacement
  • Loading branch information
Maheshkale447 authored Aug 31, 2024
2 parents 8f8cc5b + ef25e16 commit dc43193
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 76 deletions.
15 changes: 10 additions & 5 deletions Ginger/Ginger/Actions/ActionsListViewPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private void SetListView()
mActionsListHelper.ActionListItemEvent += MActionListItemInfo_ActionListItemEvent;

mActionsListView.SetDefaultListDataTemplate(mActionsListHelper);

mActionsListView.ListSelectionMode = SelectionMode.Extended;

mActionsListView.PreviewDragItem += listActions_PreviewDragItem;
Expand All @@ -204,10 +204,6 @@ private void SetListView()
// Enable Virtualization for Actions ListView to improve the loading time/performance
mActionsListView.List.SetValue(ScrollViewer.CanContentScrollProperty, true);

if (mPageViewMode == Ginger.General.eRIPageViewMode.View || mPageViewMode == Ginger.General.eRIPageViewMode.ViewAndExecute)
{
mActionsListView.IsDragDropCompatible = false;
}
}
else
{
Expand All @@ -219,6 +215,15 @@ private void SetListView()
}
}

if (mPageViewMode == Ginger.General.eRIPageViewMode.View || mPageViewMode == Ginger.General.eRIPageViewMode.ViewAndExecute)
{
mActionsListView.IsDragDropCompatible = false;
}
else
{
mActionsListView.IsDragDropCompatible = true;
}

if (mActivity != null)
{
//update actions platform
Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/Ginger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
<PackageReference Include="Ginger.AccountReport.Contracts" Version="2024.4.1" />
<PackageReference Include="Ginger.ExecuterService.Contracts" Version="24.3.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.58" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="LiveCharts.Wpf.NetCore3" Version="0.9.7" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.5.0" />
Expand Down
25 changes: 15 additions & 10 deletions Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,30 @@ private void CheckBox_Click(object sender, RoutedEventArgs e)
// Do something with data, for example:
data.Active = checkBox.IsChecked ?? false;
mAccessibilityConfiguration.StartDirtyTracking();
if (!data.Active)
if (!mAccessibilityConfiguration.ExcludedRules.Any())
{
if(!mAccessibilityConfiguration.ExcludedRules.Any())
{
GingerCoreNET.GeneralLib.General.CreateDefaultAccessiblityconfiguration();
mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem<AccessibilityConfiguration>();
mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new();
}
GingerCoreNET.GeneralLib.General.CreateDefaultAccessiblityconfiguration();
mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem<AccessibilityConfiguration>();
mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new();
}

if (!mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID)))
if (!data.Active)
{
if (!mAccessibilityConfiguration.ExcludedRules.Any(x => x.RuleID.Equals(data.RuleID,StringComparison.CurrentCultureIgnoreCase)))
{
mAccessibilityConfiguration.ExcludedRules.Add(data);
}
}
else
{
if (mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID)))
if (mAccessibilityConfiguration.ExcludedRules.Any(x => x.RuleID.Equals(data.RuleID,StringComparison.CurrentCultureIgnoreCase)))
{
mAccessibilityConfiguration.ExcludedRules.Remove(data);
AccessibilityRuleData itemToRemove = mAccessibilityConfiguration.ExcludedRules.FirstOrDefault(x => x.RuleID.Equals(data.RuleID, StringComparison.CurrentCultureIgnoreCase));
if (itemToRemove != null)
{
mAccessibilityConfiguration.ExcludedRules.Remove(itemToRemove);
}

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreCommon/GingerCoreCommon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<ItemGroup>
<PackageReference Include="Ginger.External" Version="1.0.0" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.7.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
using GingerCore.Actions.VisualTesting;
using GingerCore.Drivers;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Drawing;
Expand Down Expand Up @@ -395,7 +396,12 @@ public bool CheckSetAppWindowSize()
break;
case eChangeAppWindowSize.Custom:
mDriver.ChangeAppWindowSize(Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowWidth))), Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowHeight))));
Size size = mDriver.GetWebDriver().Manage().Window.Size;
IWebDriver webDriver = mDriver.GetWebDriver();
if (webDriver == null)
{
return true;
}
Size size = webDriver.Manage().Window.Size;
if (Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowWidth))) + 5 < size.Width)//+5 added to check with actual viewport/size of the browser which can be different by 2 0r 3 points
{
this.Error = string.Format("Unable to set custom width of web page to {0}, min supported width is {1}.", GetInputParamCalculatedValue(nameof(SetAppWindowWidth)), size.Width.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ private AxeRunOptions CreateAxeRunOptions()
List<string> sevritylist = _act.SeverityList.Select(x => x.Value.ToLower()).ToList();
string[] SeverityExcludeRules = RuleData.Where(x => !ExcludeRules.Contains(x.RuleID) && sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray();
ExcludeRules = ExcludeRules.Concat(SeverityExcludeRules).ToArray();
if (ExcludeRules != null && ExcludeRules.Any())
}
if (ExcludeRules != null && ExcludeRules.Any())
{
var rulesMap = new Dictionary<string, RuleOptions>();
foreach (var rule in ExcludeRules)
{
var rulesMap = new Dictionary<string, RuleOptions>();
foreach (var rule in ExcludeRules)
rulesMap[rule] = new RuleOptions
{
rulesMap[rule] = new RuleOptions
{
Enabled = false
};
}
axeRunOptions.Rules = rulesMap;
Enabled = false
};
}
axeRunOptions.Rules = rulesMap;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ public override void RunAction(Act act)
}
break;
case ActAccessibilityTesting actAccessibilityTesting:
if (!BrowserPrivateMode)
{
act.Error = $"Playwright Driver must be in Private mode for using Accessibility actions";
break;
}
ActAccessibilityTestingHandler actAccessibilityTestingHandler;
if (actAccessibilityTesting.GetAccessibilityTarget() == ActAccessibilityTesting.eTarget.Element)
{
Expand Down Expand Up @@ -257,7 +262,7 @@ public bool IsActionSupported(Act act, out string message)
{
message = string.Empty;

if (act is ActWithoutDriver or ActScreenShot)
if (act is ActWithoutDriver or ActScreenShot or ActGotoURL or ActAccessibilityTesting)
{
return true;
}
Expand Down Expand Up @@ -306,8 +311,12 @@ public bool IsActionSupported(Act act, out string message)
}
else if (act is ActVisualTesting actVisualTesting)
{
message = $"{actVisualTesting.VisualTestingAnalyzer} is not supported by Playwright driver, use Selenium driver instead.";
return actVisualTesting.VisualTestingAnalyzer != ActVisualTesting.eVisualTestingAnalyzer.Applitools;
if (actVisualTesting.VisualTestingAnalyzer == ActVisualTesting.eVisualTestingAnalyzer.Applitools)
{
message = $"{actVisualTesting.VisualTestingAnalyzer} is not supported by Playwright driver, use Selenium driver instead.";
return false;
}
return true;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreNET/GingerCoreNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
<PackageReference Include="InputSimulatorStandard" Version="1.0.0" />

<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.278" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="LiteDB" Version="5.0.21" />

<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.1" />

Expand Down
56 changes: 34 additions & 22 deletions Ginger/GingerCoreNET/LiteDBFolder/LiteDbConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,41 @@ public ILiteCollection<T> GetCollection<T>(string collectionName)
collection = db.GetCollection<T>(collectionName);
}
}
catch(UnauthorizedAccessException ex)
{
Reporter.ToLog(eLogLevel.ERROR, $"Access denied while trying to get collection: {collectionName}", ex);
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, $"Failed to Get Collection: {collectionName}", ex);
throw;
}
return collection;
}

/*
* This function is not used anywhere
* public bool DeleteCollectionItems<T>(LiteCollection<T> baseColl, Query query)

//This function is not used anywhere
//public bool DeleteCollectionItems<T>(LiteCollection<T> baseColl, Query query)
//{
// bool result = false;
// try
// {
// using (var db = new LiteDatabase(this.ConnectionString))
// {
// result = baseColl.Delete(query) > 0;
// }
// }
// catch (Exception ex)
// {
// Console.WriteLine("DeleteCollectionItems Error - " + ex.Message);
// }
// return result;
//}

public bool DeleteDocumentByLiteDbRunSet(LiteDbRunSet liteDbRunSet, eExecutedFrom executedFrom = eExecutedFrom.Run)
{
bool result = false;
bool result = true;
try
{
using (var db = new LiteDatabase(this.ConnectionString))
{
result = baseColl.Delete(query) > 0;
}
}
catch (Exception ex)
{
Console.WriteLine("DeleteCollectionItems Error - " + ex.Message);
}
return result;
}
*/ public bool DeleteDocumentByLiteDbRunSet(LiteDbRunSet liteDbRunSet, eExecutedFrom executedFrom = eExecutedFrom.Run)
{
bool result = true;
var runSetLiteColl = GetCollection<LiteDbRunSet>(NameInDb<LiteDbRunSet>());
var runnerssLiteColl = GetCollection<LiteDbRunner>(NameInDb<LiteDbRunner>());
foreach (LiteDbRunner ldbRunner in liteDbRunSet.RunnersColl)
Expand Down Expand Up @@ -133,6 +139,12 @@ public ILiteCollection<T> GetCollection<T>(string collectionName)
{
runSetLiteColl.Delete(liteDbRunSet._id);
}
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, $"Failed to delete document for RunSet: {liteDbRunSet._id}", ex);
result = false;
}
return result;
}
public string NameInDb<T>()
Expand All @@ -158,7 +170,7 @@ public void SetCollection<T>(ILiteCollection<T> baseColl, List<T> updateData)
}
catch (Exception ex)
{
Console.WriteLine("SetCollection Error - " + ex.Message);
Reporter.ToLog(eLogLevel.ERROR, "An error occurred while attempting to insert data into LiteDB.", ex);
}
}

Expand All @@ -173,7 +185,7 @@ public void SaveImage(string imagePath, string imageName)
}
catch (Exception ex)
{
Console.WriteLine("SaveImage - " + ex.Message);
Reporter.ToLog(eLogLevel.ERROR, "An error occurred while attempting to save image.", ex);
}
}

Expand All @@ -191,7 +203,7 @@ public void GetImage(string imagePath)
}
catch (Exception ex)
{
Console.WriteLine("GetImage - " + ex.Message);
Reporter.ToLog(eLogLevel.ERROR, "An error occurred while attempting to get image.", ex);
}
}
}
Expand Down
53 changes: 30 additions & 23 deletions Ginger/GingerCoreNET/Run/RunListenerLib/LiteDBRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,35 +401,42 @@ private void SetBfobjects(Context context, eExecutedFrom executedFrom)

public override void SetReportRunner(GingerExecutionEngine gingerRunner, GingerReport gingerReport, ParentGingerData gingerData, Context mContext, string filename, int runnerCount)
{
base.SetReportRunner(gingerRunner, gingerReport, gingerData, mContext, filename, runnerCount);
LiteDbRunner runner = new LiteDbRunner();
runner.AllBusinessFlowsColl.AddRange(liteDbBFList);
if (lastRunnertStatus == eRunStatus.Stopped && gingerRunner.RunsetStatus != eRunStatus.Stopped && runner.BusinessFlowsColl.Count > gingerRunner.BusinessFlows.Count)
try
{
runner.AllBusinessFlowsColl.RemoveRange(0, gingerRunner.BusinessFlows.Count);
}
base.SetReportRunner(gingerRunner, gingerReport, gingerData, mContext, filename, runnerCount);
LiteDbRunner runner = new LiteDbRunner();
runner.AllBusinessFlowsColl.AddRange(liteDbBFList);
if (lastRunnertStatus == eRunStatus.Stopped && gingerRunner.RunsetStatus != eRunStatus.Stopped && runner.BusinessFlowsColl.Count > gingerRunner.BusinessFlows.Count)
{
runner.AllBusinessFlowsColl.RemoveRange(0, gingerRunner.BusinessFlows.Count);
}

SetRunnerChildCounts(runner, gingerRunner.BusinessFlows);
SetRunnerChildCounts(runner, gingerRunner.BusinessFlows);

runner.SetReportData(gingerReport);
SaveObjToReporsitory(runner, liteDbManager.NameInDb<LiteDbRunner>());
if (ExecutionLoggerManager.RunSetReport == null)
{
ExecutionLoggerManager.RunSetReport = new RunSetReport();
ExecutionLoggerManager.RunSetReport.GUID = Guid.NewGuid().ToString();
}
if (lastRunnertStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped)
{
var runnerItem = ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Find(x => x.Name == runner.Name);
ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Remove(runnerItem);
runner.SetReportData(gingerReport);
SaveObjToReporsitory(runner, liteDbManager.NameInDb<LiteDbRunner>());
if (ExecutionLoggerManager.RunSetReport == null)
{
ExecutionLoggerManager.RunSetReport = new RunSetReport();
ExecutionLoggerManager.RunSetReport.GUID = Guid.NewGuid().ToString();
}
if (lastRunnertStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped)
{
var runnerItem = ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Find(x => x.Name == runner.Name);
ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Remove(runnerItem);
}
if (runner.RunStatus != eRunStatus.Stopped.ToString())
{
liteDbBFList.Clear();
}
ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Add(runner);
lastRunnertStatus = gingerRunner.RunsetStatus;
ClearSeq();
}
if (runner.RunStatus != eRunStatus.Stopped.ToString())
catch (Exception ex)
{
liteDbBFList.Clear();
Reporter.ToLog(eLogLevel.ERROR, "An error occurred while attempting to set Report runner.", ex);
}
ExecutionLoggerManager.RunSetReport.liteDbRunnerList.Add(runner);
lastRunnertStatus = gingerRunner.RunsetStatus;
ClearSeq();
}
private void SetRunnerChildCounts(LiteDbRunner runner, ObservableList<BusinessFlow> businessFlows)
{
Expand Down

0 comments on commit dc43193

Please sign in to comment.