Skip to content

Commit

Permalink
Merge branch 'master' into BugFix/40328_Timeout_DefaultValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Maheshkale447 authored Jun 24, 2024
2 parents 20f1a95 + d6f21bc commit 21b5dda
Show file tree
Hide file tree
Showing 116 changed files with 5,293 additions and 1,217 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ on:
description: Release
type: number
required: true
default: '2'
default: '3'
build:
description: Beta
type: number
required: true
default: '0'
default: '1'
revision:
description: Alpha
type: number
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/GingerTests-2.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: Ginger-Tests

on:
workflow_call


jobs:
windows:
uses: ./.github/workflows/WindowsTest-2.yml
secrets: inherit

Linux:
uses: ./.github/workflows/LinuxTest-2.yml

say-hello:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello, world!"
#jobs:
#example_job:
# runs-on: ubuntu-latest
# steps:
# windows:
# uses: ./.github/workflows/WindowsTest-2.yml
# secrets: inherit

#Linux:
# uses: ./.github/workflows/LinuxTest-2.yml

# MacOS:
# uses: ./.github/workflows/MacOSTest-2.yml
188 changes: 121 additions & 67 deletions Ginger/Ginger/ALM/Repository/JIRA_Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
using AlmDataContractsStd.Enums;
using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.CoreNET.ALMLib.DataContract;
using Amdocs.Ginger.Repository;
using Ginger.ALM.JIRA;
using Ginger.ALM.JIRA.TreeViewItems;
Expand Down Expand Up @@ -130,76 +131,120 @@ public override void ExportBfActivitiesGroupsToALM(BusinessFlow businessFlow, Ob

public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null)
{
bool result = false;
string responseStr = string.Empty;
if (businessFlow == null)
{
return false;
}

if (businessFlow != null)
if (businessFlow.ActivitiesGroups.Count == 0 && almConectStyle != eALMConnectType.Silence)
{
if (businessFlow.ActivitiesGroups.Count == 0)
{
Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export.");
return false;
}
else
Reporter.ToUser(eUserMsgKey.StaticInfoMessage, $"The {GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)} do not include {GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups)} which supposed to be mapped to ALM Test Cases, please add at least one {GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)} before doing export.");
Reporter.ToLog(eLogLevel.ERROR, $"The {GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)} do not include {GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups)} which supposed to be mapped to ALM Test Cases, please add at least one {GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)} before doing export.");
return false;
}

JiraTestSet matchingTS = null;

string responseStr = string.Empty;
eUserMsgSelection userSelec;
if (!String.IsNullOrEmpty(businessFlow.ExternalID))
{
matchingTS = ((JiraCore)ALMIntegration.Instance.AlmCore).GetJiraTestSetData(new JiraTestSet { Key = businessFlow.ExternalID });
if (matchingTS != null && almConectStyle != eALMConnectType.Silence)
{
ObservableList<ExternalItemFieldBase> allFields = new ObservableList<ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields);
ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null);
var testCaseFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_CASE.ToString()) && (a.ToUpdate || a.Mandatory));
var testSetFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_SET.ToString()) && (a.ToUpdate || a.Mandatory));
var testExecutionFields = allFields.Where(a => a.ItemType == "TEST_EXECUTION" && (a.ToUpdate || a.Mandatory));
Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
bool exportRes = false;
switch (ALMCore.DefaultAlmConfig.JiraTestingALM)
//ask user if want to continute
userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name);
if (userSelec == eUserMsgSelection.Cancel)
{
case eTestingALMType.Xray:
exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
break;
case eTestingALMType.Zephyr:
JiraZephyrTreeItem zephyrExportPath = SelectZephyrExportPath();
if (zephyrExportPath == null)
{
return true;
}
if (zephyrExportPath is JiraZephyrVersionTreeItem)
{
exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
testExecutionFields, ref responseStr,
((JiraZephyrVersionTreeItem)zephyrExportPath).VersionId.ToString(), string.Empty);
}
else if (zephyrExportPath is JiraZephyrCycleTreeItem)
{
exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
testExecutionFields, ref responseStr,
((JiraZephyrCycleTreeItem)zephyrExportPath).VersionId.ToString(),
((JiraZephyrCycleTreeItem)zephyrExportPath).Id.ToString());
}
break;
default:
exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
break;
return false;
}

if (exportRes)
else if (userSelec == eUserMsgSelection.No)
{
if (performSaveAfterExport)
businessFlow.ExternalID = null;
foreach (var item in businessFlow.ActivitiesGroups)
{
Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));
WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow);
Reporter.HideStatusMessage();
}
if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
{
Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
item.ExternalID = null;
}
return ExportBFToALMXtended(businessFlow,performSaveAfterExport,almConectStyle);
}
else
{
return ExportBFToALMXtended(businessFlow, performSaveAfterExport, almConectStyle);
}
}
else
{
return false;
}
}
else
{
return ExportBFToALMXtended(businessFlow, performSaveAfterExport, almConectStyle);
}
}

public bool ExportBFToALMXtended(BusinessFlow businessFlow, bool performSaveAfterExport, eALMConnectType almConectStyle = eALMConnectType.Manual)
{
bool result = false;
string responseStr = string.Empty;
ObservableList<ExternalItemFieldBase> allFields = new ObservableList<ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields);
ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null);
var testCaseFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_CASE.ToString()) && (a.ToUpdate || a.Mandatory));
var testSetFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_SET.ToString()) && (a.ToUpdate || a.Mandatory));
var testExecutionFields = allFields.Where(a => a.ItemType == "TEST_EXECUTION" && (a.ToUpdate || a.Mandatory));
Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
bool exportRes = false;
switch (ALMCore.DefaultAlmConfig.JiraTestingALM)
{
case eTestingALMType.Xray:
exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
break;
case eTestingALMType.Zephyr:
JiraZephyrTreeItem zephyrExportPath = SelectZephyrExportPath();
if (zephyrExportPath == null)
{
return true;
}
else if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
if (zephyrExportPath is JiraZephyrVersionTreeItem)
{
exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
testExecutionFields, ref responseStr,
((JiraZephyrVersionTreeItem)zephyrExportPath).VersionId.ToString(), string.Empty);
}
else if (zephyrExportPath is JiraZephyrCycleTreeItem)
{
Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr);
exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
testExecutionFields, ref responseStr,
((JiraZephyrCycleTreeItem)zephyrExportPath).VersionId.ToString(),
((JiraZephyrCycleTreeItem)zephyrExportPath).Id.ToString());
}
break;
default:
exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
break;
}

if (exportRes)
{
if (performSaveAfterExport)
{
Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));
WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow);
Reporter.HideStatusMessage();
}
Reporter.HideStatusMessage();
if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
{
Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
}
return true;
}
else if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
{
Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr);
}

Reporter.HideStatusMessage();

return result;
}

Expand Down Expand Up @@ -498,21 +543,30 @@ private void SetBFPropertiesAfterImport(BusinessFlow tsBusFlow)

public override bool LoadALMConfigurations()
{
if (General.SetupBrowseFile(new System.Windows.Forms.OpenFileDialog()
{
DefaultExt = "*.zip",
Filter = "zip Files (*.zip)|*.zip",
Title = "Select Jira Configuration Zip File"
}, false) is string fileName)
try
{
if (!GingerCore.General.LoadALMSettings(fileName, eALMType.Jira))
if (General.SetupBrowseFile(new System.Windows.Forms.OpenFileDialog()
{
return false;
}
DefaultExt = "*.zip",
Filter = "zip Files (*.zip)|*.zip",
Title = "Select Jira Configuration Zip File"
}, false) is string fileName)
{
if (!GingerCore.General.LoadALMSettings(fileName, eALMType.Jira))
{
return false;
}
((JiraCore)ALMIntegration.Instance.AlmCore).CreateJiraRepository();
ALMIntegration.Instance.SetALMCoreConfigurations(eALMType.Jira);
ALMIntegration.Instance.SetALMCoreConfigurations(eALMType.Jira);
}
return true; //Browse Dialog Canceled
}
catch(Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR,"Error in loading ALM configurations",ex.InnerException);
return false;
}
return true; //Browse Dialog Canceled

}

public override string SelectALMTestLabPath()
Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/Actions/ActionEditPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<DockPanel x:Name="xOperationSettingsPnl" Margin="5">
<Grid x:Name="xActionLocatorPnl" DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="109" />
<ColumnDefinition Width="330" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
Expand Down
21 changes: 2 additions & 19 deletions Ginger/Ginger/Actions/ActionEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,14 +1116,7 @@ private void LoadOperationSettingsEditPage(Act a)
if (a.ActionEditPage != null)
{
Page actEditPage = ActionsFactory.GetActionEditPage(a, mContext);
if (actEditPage is IActEditPage)
{
xActionLocatorPnl.Visibility = ((IActEditPage)actEditPage).LocatorVisibility;

string allProperties = string.Empty;
PropertyChangedEventManager.RemoveHandler(source: (IActEditPage)actEditPage, ActionEditPage_PropertyChanged, propertyName: allProperties);
PropertyChangedEventManager.AddHandler(source: (IActEditPage)actEditPage, ActionEditPage_PropertyChanged, propertyName: allProperties);
}

if (actEditPage != null)
{
// Load the page
Expand All @@ -1137,17 +1130,7 @@ private void LoadOperationSettingsEditPage(Act a)
}
}

private void ActionEditPage_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (string.Equals(e.PropertyName, nameof(IActEditPage.LocatorVisibility)) && sender != null)
{
Visibility locatorVisibility = ((IActEditPage)sender).LocatorVisibility;
if (xActionLocatorPnl.Visibility != locatorVisibility)
{
xActionLocatorPnl.Visibility = locatorVisibility;
}
}
}


//private void NextActionButton_Click(object sender, RoutedEventArgs e)
//{
Expand Down
Loading

0 comments on commit 21b5dda

Please sign in to comment.