using LoginPI.Engine.ScriptBase; public class productivityWorker_BuiltInWindowsApps_SmokeTests_EndpointVerification : ScriptBase { private void Execute() { /* -Disclaimer: This workload is provided as-is and might need further configuration and customization to work successfully in each unique environment. For further Professional Services-based customization please consult with the Login VSI Support and Services team. Please refer to the Help Center section "Application Customization" for further self-help information regarding workload crafting and implementation. -YouTube video: https://youtu.be/-fkrQfmKqEU -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: false This workload will: -Simulate a user opening built-in Windows app they might open throughout the day, in order to perform Productivity tasks. The tests herein are currently essentially smoke tests for these application launches; however, they could be built on with our scripting tooling. Please refer to our documentation on this for the Application XRay and Script Editor tooling. -It will showcase launching, validating launching, and have a custom timer encapsulated around (each launch) for built-in Windows apps of the category: "Productivity Worker" The following steps will be performed -- start timer, start app, verify app GUI present, stop timer, short wait, close app -- for the following apps: -3D viewer (com.microsoft.3dviewer:) -Paint 3D (ms-paint:) -Camera (microsoft.windows.camera:) -Microsoft Edge (microsoft-edge:) -Windows Media Player (dvdplay) -Photos (ms-photos:) -Snipping Tool (snippingtool) -Calculator (calc) -Microsoft Paint (mspaint) -Internet Explorer (iexplore) -Wordpad (wordpad) -Notepad (notepad) -Remote Desktop Connection (mstsc) (rdp) -Bluetooth File Transfer (fsquirt) Preemptively, the following needs to be setup prior to running the workload: -If needed, configure the "Set global vars" section of this workload -Go through the workload to understand what it's doing. Comment out any unneeded app tests (code blocks) or add on any needed functional testing -Manually execute the statements in the ShellExecute(); statements in a Run dialog box. This will help understand what apps are built into your particular Windows image (i.e. if an app doesn't launch after manually running a statement, and if the app isn't currently installed in the image, then the app will either need to be installed or the corresponding code block in this script will need to be removed/commented-out) Developed with: -Scripting Toolset version: Login Enterprise 4.5.11 -Last updated on: 30 June 2021 -winver: Windows 10 Pro x64 21H1 */ // Set global vars double globalIntermittentWaitInSeconds = 3.0; // How long to wait once its been detected each app's GUI is running successfully int globalFunctionTimeoutInSeconds = 60; // How long a function will wait up to for something to occur, such as an app's GUI being detected as present MouseMove(0,0); // Get the mouse pointer out of the way // The following will start a timer, start: com.microsoft.3dviewer: (3D viewer) app, ensure the app's been opened, stop the timer, and close the app StartTimer("3dViewer_AppTimeToInvoke"); ShellExecute(@"cmd /c start com.microsoft.3dviewer:",forceKillOnExit:true,waitForProcessEnd:false); var threeDViewerWindow = FindWindow(title : "* ‎- 3D Viewer",timeout:globalFunctionTimeoutInSeconds); threeDViewerWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main frame in the 3D Viewer app StopTimer("3dViewer_AppTimeToInvoke"); threeDViewerWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFramehost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: Paint 3D app, ensure the app's been opened, stop the timer, and close the app StartTimer("Paint3D_AppTimeToInvoke"); ShellExecute(@"cmd /c start ms-paint:",forceKillOnExit:true,waitForProcessEnd:false); var paint3DWindow = FindWindow(title : "*‎- Paint 3D*",timeout:globalFunctionTimeoutInSeconds); paint3DWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Group",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the Paint 3D canvas pane StopTimer("Paint3D_AppTimeToInvoke"); paint3DWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFramehost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: Camera app, ensure the app's been opened, stop the timer, and close the app StartTimer("Camera_AppTimeToInvoke"); ShellExecute(@"cmd /c start microsoft.windows.camera:",forceKillOnExit:true,waitForProcessEnd:false); var cameraWindow = FindWindow(title : "Camera",timeout:globalFunctionTimeoutInSeconds); cameraWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main Camera pane StopTimer("Camera_AppTimeToInvoke"); cameraWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFramehost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: msedge, ensure the app's been opened, stop the timer, and close the app // version of app this code block was made against/with: Version 90.0.818.62 (Official build) (64-bit) StartTimer("Microsoft_Edge_AppTimeToInvoke"); ShellExecute(@"microsoft-edge:",forceKillOnExit:true,waitForProcessEnd:false); var msedgeWindow = FindWindow(title : "* - Microsoft​ Edge",timeout:globalFunctionTimeoutInSeconds); msedgeWindow.FindControlWithXPath(xPath : "Pane:BrowserRootView/Pane:NonClientView/Pane:BrowserView/Pane:View",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main msedge webpage pane StopTimer("Microsoft_Edge_AppTimeToInvoke"); msedgeWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im msedge.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: Windows Media Player (dvdplay) app, ensure the app's been opened, stop the timer, and close the app StartTimer("WindowsMedia_AppTimeToInvoke"); ShellExecute(@"cmd /c start dvdplay",forceKillOnExit:true,waitForProcessEnd:false); var windowsMediaPlayerWindow = FindWindow(title : "Windows Media Player",timeout:globalFunctionTimeoutInSeconds); windowsMediaPlayerWindow.FindControlWithXPath(xPath : "Pane:WMPAppHost",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main frame in the dvdplay window StopTimer("WindowsMedia_AppTimeToInvoke"); windowsMediaPlayerWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im wmplayer.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: Photos app, ensure the app's been opened, stop the timer, and close the app StartTimer("Photos_AppTimeToInvoke"); ShellExecute(@"cmd /c start ms-photos:",forceKillOnExit:true,waitForProcessEnd:false); var photosWindow = FindWindow(title : "Photos",timeout:globalFunctionTimeoutInSeconds); photosWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main photos app frame StopTimer("Photos_AppTimeToInvoke"); photosWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFramehost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: snippingtool, ensure the app's been opened, stop the timer, and close the app StartTimer("SnippingTool_AppTimeToInvoke"); ShellExecute(@"snippingtool",forceKillOnExit:true,waitForProcessEnd:false); var snippingToolWindow = FindWindow(title : "Snipping Tool",timeout:globalFunctionTimeoutInSeconds); snippingToolWindow.FindControlWithXPath(xPath : "ToolBar:ToolbarWindow32",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the top toolbar of snipping tool StopTimer("SnippingTool_AppTimeToInvoke"); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im snippingtool.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: calc, ensure the app's been opened, stop the timer, and close the app StartTimer("Calc_AppTimeToInvoke"); ShellExecute(@"cmd /c calc",forceKillOnExit:true,waitForProcessEnd:false); var calcWindow = FindWindow(title : "Calculator",timeout:globalFunctionTimeoutInSeconds); StopTimer("Calc_AppTimeToInvoke"); calcWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im calculator.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); ShellExecute(@"cmd /c taskkill /f /im win32calc.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFramehost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: mspaint, ensure the app's been opened, stop the timer, and close the app StartTimer("Mspaint_AppTimeToInvoke"); ShellExecute(@"mspaint.exe",forceKillOnExit:true,waitForProcessEnd:false); var mspaintWindow = FindWindow(className : "Win32 Window:MSPaintApp", title : "Untitled - Paint", processName : "mspaint",timeout:globalFunctionTimeoutInSeconds); mspaintWindow.FindControlWithXPath(xPath : "Pane:MSPaintView",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main canvas pane StopTimer("Mspaint_AppTimeToInvoke"); mspaintWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im mspaint.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: iexplore, ensure the app's been opened, stop the timer, and close the app // version of app this code block made against/with: Win 10 Pro 20H2 x64 StartTimer("Iexplore_AppTimeToInvoke"); ShellExecute(@"iexplore.exe about:blank",forceKillOnExit:true,waitForProcessEnd:false); var iexploreWindow = FindWindow(title : "* - Internet Explorer",timeout:globalFunctionTimeoutInSeconds); iexploreWindow.FindControlWithXPath(xPath : "Pane:Frame Tab",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main iexplore webpage viewer pane StopTimer("Iexplore_AppTimeToInvoke"); iexploreWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im iexplore.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: wordpad, ensure the app's been opened, stop the timer, and close the app StartTimer("Wordpad_AppTimeToInvoke"); ShellExecute(@"wordpad.exe",forceKillOnExit:true,waitForProcessEnd:false); var wordpadWindow = FindWindow(title : "* - Wordpad",timeout:globalFunctionTimeoutInSeconds); wordpadWindow.FindControlWithXPath(xPath : "Document:RICHEDIT50W",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main text editor pane StopTimer("Wordpad_AppTimeToInvoke"); wordpadWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im wordpad.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: notepad, ensure the app's been opened, stop the timer, and close the app StartTimer("Notepad_AppTimeToInvoke"); ShellExecute(@"notepad.exe",forceKillOnExit:true,waitForProcessEnd:false); var notepadWindow = FindWindow(title : "* - Notepad",timeout:globalFunctionTimeoutInSeconds); notepadWindow.FindControlWithXPath(xPath : "Document:Edit",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main text editor pane StopTimer("Notepad_AppTimeToInvoke"); notepadWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im notepad.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: mstsc (RDP) app, ensure the app's been opened, stop the timer, and close the app StartTimer("Mstsc_AppTimeToInvoke"); ShellExecute(@"mstsc",forceKillOnExit:true,waitForProcessEnd:false); var mstscWindow = FindWindow(title : "Remote Desktop Connection",timeout:globalFunctionTimeoutInSeconds); mstscWindow.FindControlWithXPath(xPath : "Text:Static",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the "Computer" string object in the mstsc window StopTimer("Mstsc_AppTimeToInvoke"); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im mstsc.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); // The following will start a timer, start: Bluetooth Transfer Wizard (fsquirt) app, ensure the app's been opened, stop the timer, and close the app StartTimer("BluetthFlTrnsfer_AppTimeToInvoke"); ShellExecute(@"fsquirt",forceKillOnExit:true,waitForProcessEnd:false); var bluetoothFileTransferWindow = FindWindow(title : "Bluetooth File Transfer",timeout:globalFunctionTimeoutInSeconds); bluetoothFileTransferWindow.FindControlWithXPath(xPath : "Pane:Win32PropSheetPageHost",timeout:globalFunctionTimeoutInSeconds); // This will verify the app's running by looking for: the main text/frame in the Bluetooth File Transfer window StopTimer("BluetthFlTrnsfer_AppTimeToInvoke"); Wait(globalIntermittentWaitInSeconds); ShellExecute(@"cmd /c taskkill /f /im fsquirt.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); } }