diff --git a/Appium Wizard/AppiumServerSetup.cs b/Appium Wizard/AppiumServerSetup.cs index f537ee2..7595408 100644 --- a/Appium Wizard/AppiumServerSetup.cs +++ b/Appium Wizard/AppiumServerSetup.cs @@ -60,6 +60,14 @@ public void StartAppiumServer(int appiumPort, int serverNumber, string command = { command = command + " --port " + appiumPort; } + var pluginList = Common.GetListOfInstalledPlugins(); + if (pluginList.TryGetValue("inspector", out string value) && !value.Equals("NotInstalled")) + { + if (!command.Contains("--use-plugins=inspector")) + { + command = command + " --use-plugins=inspector"; + } + } appiumLogLevel = Database.QueryDataFromlogLevelTable()["Server" + serverNumber]; if (!command.Contains(" --log ")) { @@ -186,7 +194,7 @@ public void AppiumServer_OutputDataReceived(object sender, DataReceivedEventArgs data = Regex.Replace(data, @"\(1\)", ""); if (portServerNumberAndFilePath.ContainsKey(serverNumber)) { - if (data.Contains("No plugins have been installed.") || data.Contains("No plugins activated.")) + if (data.Contains("No plugins have been installed.") || data.Contains("No plugins activated.") || (data.Contains("[Appium]") && data.Contains("(ACTIVE)"))) { serverStarted = true; InitializeLogWriter(serverNumber, portServerNumberAndFilePath[serverNumber].Item2); diff --git a/Appium Wizard/ExcludeInInstaller/Installer Script.iss b/Appium Wizard/ExcludeInInstaller/Installer Script.iss index 8279212..60f6630 100644 --- a/Appium Wizard/ExcludeInInstaller/Installer Script.iss +++ b/Appium Wizard/ExcludeInInstaller/Installer Script.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Appium Wizard" -#define MyAppVersion "9.0.0" +#define MyAppVersion "9.1.0" #define MyAppPublisher "Meganathan C" #define MyAppExeName "Appium Wizard.exe" @@ -51,6 +51,7 @@ Filename: {app}\Resources\Server\Backup\7za.exe; Parameters: "x ""{app}\Resource Filename: "{cmd}"; Parameters: "/C set ""PATH=%PATH%;{app}\Resources\Server"" && cd {app}\Resources\Server && npm list -g appium || npm install -g appium"; Flags: runhidden runascurrentuser; StatusMsg: "Installing appium server... This may take sometime, Please wait..." Filename: "{cmd}"; Parameters: "/C set ""PATH=%PATH%;{app}\Resources\Server"" && appium driver install xcuitest"; Flags: runhidden runascurrentuser; StatusMsg: "Installing XCUITest driver... This may take sometime, Please wait..." Filename: "{cmd}"; Parameters: "/C set ""PATH=%PATH%;{app}\Resources\Server"" && appium driver install uiautomator2"; Flags: runhidden runascurrentuser; StatusMsg: "Installing UIAutomator2 driver... This may take sometime, Please wait..." +Filename: "{cmd}"; Parameters: "/C set ""PATH=%PATH%;{app}\Resources\Server"" && appium plugin install inspector"; Flags: runhidden runascurrentuser; StatusMsg: "Installing Appium Inspector Plugin... This may take sometime, Please wait..." Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [Code] diff --git a/Appium Wizard/LoadingScreen.cs b/Appium Wizard/LoadingScreen.cs index 6da6488..1eb1eee 100644 --- a/Appium Wizard/LoadingScreen.cs +++ b/Appium Wizard/LoadingScreen.cs @@ -9,6 +9,8 @@ public partial class LoadingScreen : Form public static int appiumPort = 4723; public static bool isServerStarted; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + public static bool isInspectorPluginInstalled; + public LoadingScreen() { MainScreen mainForm = new MainScreen(); @@ -135,7 +137,12 @@ await Task.Run(() => UpdateStepLabel("Starting Appium Server..."); Database.UpdateDataIntoFirstTimeRunTable("No"); await ExecuteBackgroundMethod(); - UpdateStepLabel("Loading Modules..."); + UpdateStepLabel("Loading Modules..."); + var pluginList = Common.GetListOfInstalledPlugins(); + if (pluginList.TryGetValue("inspector", out string value) && !value.Equals("NotInstalled")) + { + isInspectorPluginInstalled = true; + } Common.DeleteLogFiles(); MainScreen mainForm = new MainScreen(); UpdateStepLabel("Initializing User Interface..."); diff --git a/Appium Wizard/MainScreen.cs b/Appium Wizard/MainScreen.cs index 6e5abef..81b2fa6 100644 --- a/Appium Wizard/MainScreen.cs +++ b/Appium Wizard/MainScreen.cs @@ -43,6 +43,7 @@ public partial class MainScreen : Form private Timer resizeDebounceTimer; private bool isCleanupComplete = false; private bool isClosingInProgress = false; + public static bool isInspectorPluginInstalled; public MainScreen() { @@ -70,6 +71,7 @@ public MainScreen() releaseInfo = Common.GetLatestReleaseInfo(); } InitializeWebViews(); + isInspectorPluginInstalled = LoadingScreen.isInspectorPluginInstalled; } string defaultText = "Appium Server Not Running. Go to Server->Config to start the server..."; private async void InitializeWebViews() @@ -1346,12 +1348,105 @@ private void inspectorToolStripMenuItem_Click(object sender, EventArgs e) { try { - ProcessStartInfo psInfo = new ProcessStartInfo + if (!isInspectorPluginInstalled) { - FileName = "https://inspector.appiumpro.com/", - UseShellExecute = true - }; - Process.Start(psInfo); + MessageBox.Show("Inspector plugin not installed. Please install the plugin from Server->Plugins Manager and restart the appium sever.", + "Inspector plugin not found", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + + if (!AppiumServerSetup.portServerNumberAndFilePath.Any()) + { + MessageBox.Show("No active Appium server found. Please start a server first.", + "No Server Found", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + + int selectedPort; + + if (AppiumServerSetup.portServerNumberAndFilePath.Count == 1) + { + // Only one server running, open directly without asking + selectedPort = AppiumServerSetup.portServerNumberAndFilePath.First().Value.Item1; + } + else + { + // Multiple servers running, let user pick one + using (var form = new Form()) + { + form.Text = "Select Server"; + form.Size = new Size(400, 250); + form.StartPosition = FormStartPosition.CenterParent; + form.FormBorderStyle = FormBorderStyle.FixedDialog; + form.MaximizeBox = false; + form.MinimizeBox = false; + form.Padding = new Padding(10); + + var label = new Label + { + Text = "Select a server to open Inspector:", + AutoSize = true, + Location = new Point(15, 15) + }; + + var comboBox = new ComboBox + { + DropDownStyle = ComboBoxStyle.DropDownList, + Location = new Point(15, 40), + Width = 355, + Height = 30 + }; + + // Populate dropdown with server options + foreach (var server in AppiumServerSetup.portServerNumberAndFilePath) + { + comboBox.Items.Add($"Server {server.Key} - Port {server.Value.Item1}"); + } + comboBox.SelectedIndex = 0; + + var okButton = new Button + { + Text = "Open Inspector", + Location = new Point(195, 110), + Width = 175, + Height = 35, + DialogResult = DialogResult.OK, + BackColor = Color.FromArgb(0, 122, 204), + ForeColor = Color.White, + FlatStyle = FlatStyle.Flat + }; + + var cancelButton = new Button + { + Text = "Cancel", + Location = new Point(15, 110), + Width = 175, + Height = 35, + DialogResult = DialogResult.Cancel, + FlatStyle = FlatStyle.Flat + }; + + form.Controls.Add(label); + form.Controls.Add(comboBox); + form.Controls.Add(okButton); + form.Controls.Add(cancelButton); + form.AcceptButton = okButton; + form.CancelButton = cancelButton; + + if (form.ShowDialog() != DialogResult.OK) return; + + // Get selected server port + var selectedServerNumber = AppiumServerSetup.portServerNumberAndFilePath + .Keys.ElementAt(comboBox.SelectedIndex); + selectedPort = AppiumServerSetup.portServerNumberAndFilePath[selectedServerNumber].Item1; + } + } + + OpenInspector(selectedPort); GoogleAnalytics.SendEvent("InspectorToolStripMenuItem_Click"); } catch (Exception exception) @@ -1360,6 +1455,16 @@ private void inspectorToolStripMenuItem_Click(object sender, EventArgs e) } } + private void OpenInspector(int portNumber) + { + ProcessStartInfo psInfo = new ProcessStartInfo + { + FileName = $"http://127.0.0.1:{portNumber}/inspector", + UseShellExecute = true + }; + Process.Start(psInfo); + } + private void xCUITestToolStripMenuItem_Click(object sender, EventArgs e) { try diff --git a/Appium Wizard/Plugins Manager.Designer.cs b/Appium Wizard/Plugins Manager.Designer.cs index 954e35f..e536a2c 100644 --- a/Appium Wizard/Plugins Manager.Designer.cs +++ b/Appium Wizard/Plugins Manager.Designer.cs @@ -218,6 +218,7 @@ private void InitializeComponent() ShowInTaskbar = false; StartPosition = FormStartPosition.CenterScreen; Text = "Plugins Manager"; + FormClosed += Plugins_FormClosed; Load += Plugins_Load; Shown += Plugins_Shown; ResumeLayout(false); diff --git a/Appium Wizard/Plugins Manager.cs b/Appium Wizard/Plugins Manager.cs index ff85ba8..666ccb9 100644 --- a/Appium Wizard/Plugins Manager.cs +++ b/Appium Wizard/Plugins Manager.cs @@ -15,6 +15,7 @@ namespace Appium_Wizard public partial class Plugins : Form { string selectedPlugin, selectedVersion; + public Plugins() { InitializeComponent(); @@ -53,6 +54,10 @@ public async Task UpdatePluginList(CommonProgress commonProgress = null) await Task.Run(() => { result = Common.GetListOfInstalledPlugins(); + if (result.TryGetValue("inspector", out string value) && !value.Equals("NotInstalled")) + { + MainScreen.isInspectorPluginInstalled = true; + } }); listView1.Items.Clear(); @@ -75,12 +80,12 @@ private async void installButton_Click(object sender, EventArgs e) commonProgress.Owner = this; if (showProgressCheckBox1.Checked) { - commonProgress.UpdateStepLabel("Install Plugin", "Please wait while installing plugin " + selectedPlugin + "..." + + commonProgress.UpdateStepLabel("Install Plugin", "Please wait while installing plugin - " + selectedPlugin + "..." + "\n\nPlease close the cmd window once the execution completed to continue here..."); } else { - commonProgress.UpdateStepLabel("Install Plugin", "Please wait while installing plugin " + selectedPlugin + "..."); + commonProgress.UpdateStepLabel("Install Plugin", "Please wait while installing plugin - " + selectedPlugin + "..."); } await Task.Run(() => { @@ -216,5 +221,10 @@ private void showProgressCheckBox1_CheckedChanged(object sender, EventArgs e) MessageBox.Show("Checking this box will display the CMD window where the plugin installation/updation execution occurs. You must manually close the CMD window once the execution is completed to continue accessing the Appium wizard.", "Show execution status", MessageBoxButtons.OK, MessageBoxIcon.Information); } } + + private void Plugins_FormClosed(object sender, FormClosedEventArgs e) + { + MessageBox.Show("Restart the Appium server for the plugin installation or uninstallation to take effect.", "Restart Appium Server", MessageBoxButtons.OK, MessageBoxIcon.Information); + } } } diff --git a/Appium Wizard/Resources/iOS/zsign.exe b/Appium Wizard/Resources/iOS/zsign.exe index 5451a0f..3d9b298 100644 Binary files a/Appium Wizard/Resources/iOS/zsign.exe and b/Appium Wizard/Resources/iOS/zsign.exe differ diff --git a/Appium Wizard/VersionInfo.cs b/Appium Wizard/VersionInfo.cs index 326a591..73869ab 100644 --- a/Appium Wizard/VersionInfo.cs +++ b/Appium Wizard/VersionInfo.cs @@ -2,7 +2,7 @@ { public static class VersionInfo { - public const string VersionNumber = "9.0.0"; - public const string ReleaseNotes = "Execution speed issue fix"; + public const string VersionNumber = "9.1.0"; + public const string ReleaseNotes = "Bug fixes"; } }