diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..33b43cf283 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,122 @@ +# Ginger Automation AI Coding Agent Guide + +## Project Overview +Ginger is a comprehensive automation IDE supporting multiple platforms (Web, Mobile, APIs, Java, Windows, PowerBuilder, Linux/Unix, Mainframe). It uses a drag-and-drop approach enabling users with or without coding skills to create automation flows. + +## Core Architecture Concepts + +### 1. Execution Hierarchy +The fundamental execution structure follows this hierarchy: +``` +Solution → RunSet → Runner → BusinessFlow → Activity → Action (Act) +``` + +- **BusinessFlow**: Top-level test scenario container (`GingerCoreCommon/Repository/BusinessFlowLib/BusinessFlow.cs`) +- **Activity**: Group of related actions within a BusinessFlow (`GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs`) +- **Act/Action**: Individual executable step (`GingerCoreCommon/Actions/Act.cs`) +- **Agent**: Driver wrapper that connects to target applications (`GingerCoreCommon/RunLib/Agent.cs`) + +### 2. Key Project Structure +- **Ginger/**: Main WPF application (UI) +- **GingerCoreCommon/**: Shared models and base classes +- **GingerCoreNET/**: .NET execution engine and CLI components +- **GingerRuntime/**: Console application entry point +- **GingerCore/**: Legacy core components (being migrated to GingerCoreNET) + +### 3. Driver Architecture +Each platform has dedicated drivers under `GingerCore/Drivers/`: +- `SeleniumDriver` for web automation +- `JavaDriver` for Java applications +- `ConsoleDriverLib` for command-line interfaces +- `WindowsAutomation` for Windows applications +- Agents (`Agent.cs`) act as wrappers providing unified interface + +## Development Workflows + +### Building & Testing +```powershell +# Main build (Windows) +dotnet build Ginger/Ginger.sln + +# Run tests +./TestDotNetFramework.ps1 # Framework tests +./CLITests.ps1 # CLI functionality tests + +# Console execution +cd Ginger/GingerRuntime/bin/Release/net8.0/publish/ +dotnet GingerConsole.dll run -s "path/to/solution" -e "Environment" -r "RunSet" +``` + +### CLI Commands +**Windows:** +- `ginger.exe help` or `dotnet ginger.dll help` - Show CLI help +- `ginger.exe run -s -e -r ` - Execute automation +- `ginger.exe analyze -s ` - Analyze solution +- `ginger.exe grid --port ` - Start grid mode + +**Linux:** +- `dotnet gingerruntime.dll help` - Show CLI help +- `dotnet gingerruntime.dll run -s -e -r ` - Execute automation +- `dotnet gingerruntime.dll analyze -s ` - Analyze solution +- `dotnet gingerruntime.dll grid --port ` - Start grid mode + +## Project Conventions + +### 1. File Organization +- Actions inherit from `Act` class and implement platform-specific logic +- Repository objects use `[IsSerializedForLocalRepository]` attribute for persistence +- Test files end with `Test.cs` and use MSTest framework with `[TestClass]` and `[TestMethod]` + +### 2. Naming Patterns +- Actions: `Act{PlatformType}{ActionType}` (e.g., `ActBrowserElement`, `ActConsoleCommand`) +- Drivers: `{Platform}Driver` (e.g., `SeleniumDriver`, `JavaDriver`) +- Pages/Windows: `{Feature}Page` or `{Feature}Window` + +### 3. Error Handling +- Use `Reporter.ToLog(eLogLevel.ERROR, message)` for logging +- Actions set `act.Error` and `act.Status = eRunStatus.Failed` on failure +- Execution continues based on `Activity.ActionRunOption` setting + +## Integration Points + +### 1. Solution Structure +Solutions are XML-based with this folder structure: +``` +Solution/ +├── BusinessFlows/ # Test scenarios +├── Activities/ # Reusable activity groups +├── Actions/ # Shared actions +├── Agents/ # Driver configurations +├── Environments/ # Environment settings +├── DataSources/ # Test data +└── Applications/ # Target application definitions +``` + +### 2. Execution Engine +- `RunsetExecutor` orchestrates execution (`GingerCoreNET/Run/RunsetExecutor.cs`) +- `GingerExecutionEngine` handles individual runner execution +- Execution logging via `ExecutionLogger` implementations +- Supports parallel execution across multiple agents + +### 3. Plugin Architecture +- Legacy drivers implement `DriverBase` +- New plugins use `Agent.eAgentType.Service` with `PluginId`/`ServiceId` +- External integrations via `ALM` (Application Lifecycle Management) connectors +- Plugin packages defined by `Ginger.PluginPackage.json` manifest +- Managed through `PluginsManager` (`GingerCoreNET/PlugInsLib/PluginsManager.cs`) + +## Critical Development Notes + +- **Target Framework**: .NET 8.0 with Windows 10.0.17763.0 compatibility +- **WPF Dependencies**: Main UI uses WPF; console components are cross-platform +- **XML Serialization**: Repository objects serialize to XML using custom attributes +- **Multi-Threading**: Execution engine supports parallel runners; use thread-safe patterns +- **Memory Management**: Dispose drivers properly; avoid memory leaks in long-running executions + +## Testing Strategy +- Unit tests in `*Test.cs` files use dependency injection patterns +- Integration tests use `TestResources/Solutions/` for test data +- CLI tests verify command-line interface functionality +- Use `mConsoleMessages` pattern for testing CLI output capture + +When working with this codebase, focus on the execution hierarchy and understand how Actions flow through Activities within BusinessFlows, executed by Agents that wrap platform-specific drivers. \ No newline at end of file diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index fabad6ebd7..6863b19c8f 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -67,8 +67,6 @@ jobs: echo $save > .\Ginger\GingerCoreCommon/GingerCoreCommon.csproj $save=(Get-Content .\Ginger\GingerInstallerScript.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"' echo $save > .\Ginger\GingerInstallerScript.iss - $save=(Get-Content .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java) -replace 'public static final String GINGER_JAVA_AGENT_VERSION="*.*.*.*";','public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";' - echo $save > .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java $save=(Get-Content .\Ginger\GingerInstallerScriptGithub.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"' echo $save > .\Ginger\GingerInstallerScriptGithub.iss @@ -77,8 +75,7 @@ jobs: run: | sed -i 's/.*<\/AssemblyVersion>/${{ env.gingernumber}}<\/AssemblyVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj sed -i 's/.*<\/FileVersion>/${{ env.gingernumber}}<\/FileVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj - sed -i 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss - sed -i 's/public static final String GINGER_JAVA_AGENT_VERSION=".*";/public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";/' ./Ginger/GingerCore/Drivers/JavaDriverLib/GingerJavaAgent/agent/com/amdocs/ginger/GingerAgent.java + sed -i 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss sed -i 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScriptGithub.iss - name: 'Update Assembly - macOS' @@ -86,8 +83,7 @@ jobs: run: | sed -i '' 's/.*<\/AssemblyVersion>/${{ env.gingernumber}}<\/AssemblyVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj sed -i '' 's/.*<\/FileVersion>/${{ env.gingernumber}}<\/FileVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj - sed -i '' 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss - sed -i '' 's/public static final String GINGER_JAVA_AGENT_VERSION=".*";/public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";/' ./Ginger/GingerCore/Drivers/JavaDriverLib/GingerJavaAgent/agent/com/amdocs/ginger/GingerAgent.java + sed -i '' 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss sed -i '' 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScriptGithub.iss - name: 'Print OS type' diff --git a/.github/workflows/Old/codeql-analysis.yml b/.github/workflows/Old/codeql-analysis.yml deleted file mode 100644 index a1ed5a8907..0000000000 --- a/.github/workflows/Old/codeql-analysis.yml +++ /dev/null @@ -1,70 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master, Features/Linux-Migration, Releases/*, Releases/*/* ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '18 16 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'csharp', 'java', 'javascript', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..2f19062a4a --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,112 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Security Scan" + + +on: + push: + branches: [ master, Features/Linux-Migration, Releases/*, Releases/*/*] + pull_request: + branches: [ master ] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: CodeQL - ${{ matrix.language }} - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'csharp', 'javascript' ] + os: [windows-latest] + +# ------------------------------------------------------------------------------------------------------ +# Checkout Ginger Repository +# ------------------------------------------------------------------------------------------------------ + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + +# ------------------------------------------------------------------------------------------------------ +# Initialize CodeQL +# ------------------------------------------------------------------------------------------------------ + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + config-file: ./.github/workflows/codeql-config.yml + +# ------------------------------------------------------------------------------------------------------ +# Install .Net core SDK 8.0.100 +# ------------------------------------------------------------------------------------------------------ + + - name: Install .NET 8 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.100' + +# ------------------------------------------------------------------------------------------------------ +# Install Mono - for Ubuntu & macOS as pre-requisite for building Ginger +# ------------------------------------------------------------------------------------------------------ + + - name: Install Mono - Linux + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y mono-complete + + - name: 'Install Mono - macOS' + if: runner.os == 'macOS' + run: brew install mono + +# ------------------------------------------------------------------------------------------------------ +# Build && Publish Ginger Solution +# ------------------------------------------------------------------------------------------------------ + + - name: Setup Nuget + uses: Nuget/setup-nuget@v1.0.5 + + - name: Restore Nuget Packages + run: nuget restore ./Ginger/Ginger.sln + + - name: Add msbuild to PATH + if: runner.os == 'windows' + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Build Windows Ginger Solution + if: runner.os == 'windows' + run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=Release + + - name: Publish GingerRuntime - Linux + if: runner.os == 'Linux' + run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime linux-x64 --self-contained true -c Release + + - name: Publish GingerRuntime - macOS + if: runner.os == 'macOS' + run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime osx-x64 --self-contained true -c Release + +# ------------------------------------------------------------------------------------------------------ +# Security Scan with CodeQL +# ------------------------------------------------------------------------------------------------------ + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/codeql-config.yml b/.github/workflows/codeql-config.yml new file mode 100644 index 0000000000..d14259082c --- /dev/null +++ b/.github/workflows/codeql-config.yml @@ -0,0 +1,33 @@ +name: "CodeQL Config" + +paths: + - 'Ginger' # Only scan the Ginger directory for CodeQL + +paths-ignore: + + # ignore build outputs + - '**/bin/**' + - '**/obj/**' + - '**/Release/**' + - '**/Debug/**' + + # ignore test projects + - 'Ginger/GingerAutoPilotTest/**' + - 'Ginger/GingerConsoleTest/**' + - 'Ginger/GingerCoreCommonTest/**' + - 'Ginger/GingerCoreNETUnitTest/**' + - 'Ginger/GingerCoreTest/**' + - 'Ginger/GingerPluginCoreTest/**' + - 'Ginger/GingerTest/**' + - 'Ginger/GingerUtilsTest/**' + - 'Ginger/GingerWPFDriverWindowTest/**' + + # more optional files to ignore +# - '**/*.Designer.cs' # Auto-generated designer files +# - '**/*.g.cs' # Auto-generated files +# - '**/*.g.i.cs' # Auto-generated intermediate files +# - '**/AssemblyInfo.cs' # Assembly info files +# - '**/packages/**' # NuGet packages +# - '**/node_modules' # JavaScript dependencies +# - '**/*.min.js' # Minified JavaScript +# - '**/*.min.css' # Minified CSS diff --git a/Extensions/DotnetDependencies/aspnetcore-runtime-8.0.0-win-x64.exe b/Extensions/DotnetDependencies/aspnetcore-runtime-8.0.22-win-x64.exe similarity index 56% rename from Extensions/DotnetDependencies/aspnetcore-runtime-8.0.0-win-x64.exe rename to Extensions/DotnetDependencies/aspnetcore-runtime-8.0.22-win-x64.exe index 6fea7ea066..42f1fca711 100644 Binary files a/Extensions/DotnetDependencies/aspnetcore-runtime-8.0.0-win-x64.exe and b/Extensions/DotnetDependencies/aspnetcore-runtime-8.0.22-win-x64.exe differ diff --git a/Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.0-win-x64.exe b/Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.22-win-x64.exe similarity index 80% rename from Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.0-win-x64.exe rename to Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.22-win-x64.exe index 19e4c0a89b..b267bd8b2e 100644 Binary files a/Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.0-win-x64.exe and b/Extensions/DotnetDependencies/windowsdesktop-runtime-8.0.22-win-x64.exe differ diff --git a/Ginger/Ginger.sln b/Ginger/Ginger.sln index 0a083df49a..0ba9413e27 100644 --- a/Ginger/Ginger.sln +++ b/Ginger/Ginger.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32319.34 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.11205.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GingerCoreCommon", "GingerCoreCommon\GingerCoreCommon.csproj", "{9D569B65-EC6C-4677-A59B-CF12C24B5EB0}" EndProject diff --git a/Ginger/Ginger/Actions/ActionEditPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPage.xaml.cs index cbc3f24449..7ddf2f7ac3 100644 --- a/Ginger/Ginger/Actions/ActionEditPage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPage.xaml.cs @@ -23,6 +23,7 @@ limitations under the License. using Amdocs.Ginger.Common.Expressions; using Amdocs.Ginger.Common.GeneralLib; using Amdocs.Ginger.Common.UIElement; +using Amdocs.Ginger.CoreNET.ActionsLib; using Amdocs.Ginger.CoreNET.Execution; using Amdocs.Ginger.Repository; using Ginger.Actions.UserControls; diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml b/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml index e0788f79bc..ed154c284c 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml +++ b/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml @@ -1,4 +1,4 @@ - - + @@ -24,18 +24,18 @@ - + - + - + - + diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml.cs index b65f00fe02..e5ce872af0 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActConsoleCommandEditPage.xaml.cs @@ -18,15 +18,14 @@ limitations under the License. using amdocs.ginger.GingerCoreNET; using Amdocs.Ginger.Common; -using GingerCore.Actions; -using GingerCore.GeneralLib; +using Amdocs.Ginger.CoreNET.ActionsLib; using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Windows; using System.Windows.Controls; -using static GingerCore.Actions.ActConsoleCommand; namespace Ginger.Actions { @@ -41,20 +40,22 @@ public partial class ActConsoleCommandEditPage : Page string SHFilesPath = System.IO.Path.Combine(WorkSpace.Instance.Solution.Folder, @"Documents\sh\"); + public ActConsoleCommandEditPage(ActConsoleCommand actConsoleCommand) { InitializeComponent(); this.mActConsoleCommand = actConsoleCommand; + if (mActConsoleCommand.Context != null) { mContext = Context.GetAsContext(mActConsoleCommand.Context); } List list = GetActionListPlatform(); - + GingerCore.General.FillComboFromEnumObj(ConsoleActionComboBox, actConsoleCommand.ConsoleCommand, list); - GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ConsoleActionComboBox, ComboBox.TextProperty, actConsoleCommand, ActConsoleCommand.Fields.ConsoleCommand); + GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ConsoleActionComboBox, ComboBox.SelectedValueProperty, actConsoleCommand, ActConsoleCommand.Fields.ConsoleCommand); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(CommandTextBox, TextBox.TextProperty, actConsoleCommand, ActConsoleCommand.Fields.Command); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ScriptNameComboBox, ComboBox.TextProperty, actConsoleCommand, ActConsoleCommand.Fields.ScriptName); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(txtWait, TextBox.TextProperty, actConsoleCommand, ActConsoleCommand.Fields.WaitTime); @@ -62,10 +63,16 @@ public ActConsoleCommandEditPage(ActConsoleCommand actConsoleCommand) txtExpected.Init(Context.GetAsContext(mActConsoleCommand.Context), mActConsoleCommand, ActConsoleCommand.Fields.ExpString); GingerCore.General.FillComboFromEnumObj(CommandTerminatorComboBox, actConsoleCommand.CommandEndKey); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(CommandTerminatorComboBox, ComboBox.SelectedValueProperty, actConsoleCommand, nameof(ActConsoleCommand.CommandEndKey)); + + // Apply initial visibility according to current selected command + if (ConsoleActionComboBox.SelectedItem != null) + { + UpdateVisibilityForCommand((ActConsoleCommand.eConsoleCommand)Enum.Parse(typeof(ActConsoleCommand.eConsoleCommand), ConsoleActionComboBox.SelectedValue?.ToString())); + } } - + private List GetActionListPlatform() { if (mActConsoleCommand.Platform == ePlatformType.NA) @@ -87,44 +94,89 @@ private List GetActionListPlatform() { actionList.Add(ActConsoleCommand.eConsoleCommand.ParametrizedCommand); actionList.Add(ActConsoleCommand.eConsoleCommand.Script); + actionList.Add(ActConsoleCommand.eConsoleCommand.StartRecordingConsoleLogs); + actionList.Add(ActConsoleCommand.eConsoleCommand.StopRecordingConsoleLogs); + actionList.Add(ActConsoleCommand.eConsoleCommand.GetRecordedConsoleLogs); } else if (mActConsoleCommand.Platform == ePlatformType.DOS) { actionList.Add(ActConsoleCommand.eConsoleCommand.CopyFile); actionList.Add(ActConsoleCommand.eConsoleCommand.IsFileExist); + actionList.Add(ActConsoleCommand.eConsoleCommand.StartRecordingConsoleLogs); + actionList.Add(ActConsoleCommand.eConsoleCommand.StopRecordingConsoleLogs); + actionList.Add(ActConsoleCommand.eConsoleCommand.GetRecordedConsoleLogs); } return actionList; } private void ConsoleActionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { - ScriptStackPanel.Visibility = System.Windows.Visibility.Collapsed; - CommandPanel.Visibility = System.Windows.Visibility.Collapsed; - //Ugly code but working, find way to make it simple use the enum val from combo - ActConsoleCommand.eConsoleCommand comm = (ActConsoleCommand.eConsoleCommand)Enum.Parse(typeof(ActConsoleCommand.eConsoleCommand), ConsoleActionComboBox.SelectedItem.ToString()); + if (ConsoleActionComboBox.SelectedItem == null) + { + return; + } + + ScriptStackPanel.Visibility = Visibility.Collapsed; + CommandPanel.Visibility = Visibility.Collapsed; + + ActConsoleCommand.eConsoleCommand comm = (ActConsoleCommand.eConsoleCommand)ConsoleActionComboBox.SelectedValue; switch (comm) { case ActConsoleCommand.eConsoleCommand.FreeCommand: mActConsoleCommand.RemoveAllButOneInputParam("Free Command"); mActConsoleCommand.AddInputValueParam("Free Command"); - mActConsoleCommand.ScriptName = ""; + mActConsoleCommand.ScriptName = string.Empty; + break; + case ActConsoleCommand.eConsoleCommand.StartRecordingConsoleLogs: + case ActConsoleCommand.eConsoleCommand.StopRecordingConsoleLogs: + // No params required for recording buffer start/stop + mActConsoleCommand.InputValues.Clear(); + mActConsoleCommand.ScriptName = string.Empty; break; case ActConsoleCommand.eConsoleCommand.Script: - ScriptStackPanel.Visibility = System.Windows.Visibility.Visible; + ScriptStackPanel.Visibility = Visibility.Visible; FillScriptNameCombo(); break; case ActConsoleCommand.eConsoleCommand.ParametrizedCommand: - CommandPanel.Visibility = System.Windows.Visibility.Visible; - mActConsoleCommand.RemoveAllButOneInputParam("Value"); - mActConsoleCommand.AddInputValueParam("Value"); - mActConsoleCommand.ScriptName = ""; + CommandPanel.Visibility = Visibility.Visible; + SetupValueInputParam(); + mActConsoleCommand.ScriptName = string.Empty; break; default: - mActConsoleCommand.RemoveAllButOneInputParam("Value"); - mActConsoleCommand.AddInputValueParam("Value"); - mActConsoleCommand.ScriptName = ""; + SetupValueInputParam(); + mActConsoleCommand.ScriptName = string.Empty; break; } + + if (ConsoleActionComboBox.SelectedItem != null) + { + UpdateVisibilityForCommand(comm); + } + } + + private void SetupValueInputParam() + { + mActConsoleCommand.RemoveAllButOneInputParam("Value"); + mActConsoleCommand.AddInputValueParam("Value"); + } + + + private void UpdateVisibilityForCommand(ActConsoleCommand.eConsoleCommand command) + { + // Hide all optional controls when StartRecordingBuffer or StopRecordingBuffer selected + bool showCommonControls = command != ActConsoleCommand.eConsoleCommand.StartRecordingConsoleLogs && command != ActConsoleCommand.eConsoleCommand.StopRecordingConsoleLogs; + + if (ExpectedStringLabel != null) { ExpectedStringLabel.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + if (txtExpected != null) { txtExpected.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + if (DelimiterLabel != null) { DelimiterLabel.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + if (xDelimiterVE != null) { xDelimiterVE.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + if (WaitTimeStackPanel != null) { WaitTimeStackPanel.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + if (CommandTerminatorStackPanel != null) { CommandTerminatorStackPanel.Visibility = showCommonControls ? Visibility.Visible : Visibility.Collapsed; } + + if (!showCommonControls) + { + mActConsoleCommand.ScriptName = string.Empty; + } } private void CommandTerminatorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActDataSourcePage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActDataSourcePage.xaml.cs index 5b40b0deca..f2a62a1f6c 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActDataSourcePage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActDataSourcePage.xaml.cs @@ -103,6 +103,7 @@ public ActDataSourcePage(ActDSTableElement Act = null) { SetDataSourceVEParams(VEOrg); } + grdCondition.DataSourceList = mActDSTblElem.WhereConditions; WeakEventManager.AddHandler(source: ValueUC.ValueTextBox, eventName: nameof(TextBoxBase.TextChanged), handler: ValueChanged); } diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActLaunchJavaWSApplicationEditPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActLaunchJavaWSApplicationEditPage.xaml.cs index fceb164121..1093f4ca66 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActLaunchJavaWSApplicationEditPage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActLaunchJavaWSApplicationEditPage.xaml.cs @@ -76,7 +76,7 @@ private void DoBinding() rbGroupPortConfig.Init(typeof(ActLaunchJavaWSApplication.ePortConfigType), RadioButtonPanel, mAct.GetOrCreateInputParam(ActLaunchJavaWSApplication.Fields.PortConfigParam, ActLaunchJavaWSApplication.ePortConfigType.Manual.ToString()), new RoutedEventHandler(PortConfigRB_Click)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ApplicationProcessNameChkBox, CheckBox.IsCheckedProperty, mAct, ActLaunchJavaWSApplication.Fields.IsCustomApplicationProcessName); - ApplicationProcessNameTextBox.Init(Context.GetAsContext(mAct.Context), mAct, ActLaunchJavaWSApplication.Fields.ApplicationProcessName); + ApplicationProcessNameTextBox.Init(Context.GetAsContext(mAct.Context), mAct, ActLaunchJavaWSApplication.Fields.ApplicationProcessName); UpdateAgentPortTextBoxEnabledStatus(); } diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActSecurityTestingEditPage.xaml b/Ginger/Ginger/Actions/ActionEditPages/ActSecurityTestingEditPage.xaml index ca0572710a..43c64375ba 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActSecurityTestingEditPage.xaml +++ b/Ginger/Ginger/Actions/ActionEditPages/ActSecurityTestingEditPage.xaml @@ -11,17 +11,17 @@ - - + + - + diff --git a/Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/LearnWizard/POMLearnConfigWizardPage.xaml b/Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/LearnWizard/POMLearnConfigWizardPage.xaml index 01cec19e2f..18ce6656f0 100644 --- a/Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/LearnWizard/POMLearnConfigWizardPage.xaml +++ b/Ginger/Ginger/ApplicationModelsLib/POMModels/POMWizardLib/LearnWizard/POMLearnConfigWizardPage.xaml @@ -71,7 +71,12 @@ - + + - - @@ -94,7 +93,7 @@ x:Name="xLearnPOMByAI" AutomationProperties.AutomationId="xLearnPOMByAICheckBox AID" Content="Activate Smart Fine-Tuning Elements" - Margin="7,10,0,10" + Margin="0,10,0,10" IsChecked="False" IsEnabled="False" Visibility="Visible" diff --git a/Ginger/Ginger/DLLs/Open3270.dll b/Ginger/Ginger/DLLs/Open3270.dll index 7e1a0e2f18..41662f73c7 100644 Binary files a/Ginger/Ginger/DLLs/Open3270.dll and b/Ginger/Ginger/DLLs/Open3270.dll differ diff --git a/Ginger/Ginger/DataSource/ImportExcelWizardLib/ImportDataSourceFromExcelWizard.cs b/Ginger/Ginger/DataSource/ImportExcelWizardLib/ImportDataSourceFromExcelWizard.cs index 261109726c..2ffd9b8510 100644 --- a/Ginger/Ginger/DataSource/ImportExcelWizardLib/ImportDataSourceFromExcelWizard.cs +++ b/Ginger/Ginger/DataSource/ImportExcelWizardLib/ImportDataSourceFromExcelWizard.cs @@ -96,6 +96,12 @@ public override void Finish() } foreach (DataTable dt in ExcelImportData.Tables) { + if (!IsImportEmptyColumns) + { + // Removing empty rows + RemoveEmptyRows(dt); + } + string cols = GetColumnNameListForTableCreation(dt); AddDefaultColumn(dt); CreateTable(dt.TableName, cols); @@ -108,6 +114,31 @@ public override void Finish() } } + private void RemoveEmptyRows(DataTable dt) + { + var rowsToRemove = new List(); + foreach (DataRow row in dt.Rows) + { + bool isEmpty = true; + foreach (var item in row.ItemArray) + { + if (item != null && !string.IsNullOrWhiteSpace(item.ToString())) + { + isEmpty = false; + break; + } + } + if (isEmpty) + { + rowsToRemove.Add(row); + } + } + foreach (var row in rowsToRemove) + { + dt.Rows.Remove(row); + } + } + /// /// This method is used to get the columnList for exporting the parameters to datasource /// diff --git a/Ginger/Ginger/DotNetFrameworkHelper.cs b/Ginger/Ginger/DotNetFrameworkHelper.cs index 82d9fd2468..0017e22107 100644 --- a/Ginger/Ginger/DotNetFrameworkHelper.cs +++ b/Ginger/Ginger/DotNetFrameworkHelper.cs @@ -21,6 +21,7 @@ limitations under the License. using Amdocs.Ginger.Common.InterfacesLib; using Amdocs.Ginger.Common.UIElement; using Amdocs.Ginger.CoreNET; +using Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Console; using Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Web.Playwright; using Amdocs.Ginger.Repository; using Ginger.ALM; diff --git a/Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml b/Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml new file mode 100644 index 0000000000..ba5303f97d --- /dev/null +++ b/Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + +