using LoginPI.Engine.ScriptBase; public class windows3DViewer : 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/U97QW2R3Bn0 -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 -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: false This workload will: -Simulate a user opening the built-in Windows 10 3D Viewer app and performing various 3D rendering tasks as an actual user might perform. This generates realistic graphically-intensive load. The following steps will be performed: -Opening app and capturing app-opening timing with a custom timer -Changing the default animating model's animation speed -Changing the Quick Animation setting away from default -Changing the Model animation setting away from default -Turning the 2D grid (plane) on and off -Cycling through the different shading options/presets of the model -Cycling through the view/camera angle presets in the Grid & Views page -Cycling through the presets in the Environment & Lighting page -*Comment this section out of the code if the targets don't have an internet connection* Opening up the 3D library popup, choosing All Animated Models category, loading the first (top-left) model, and idling on the new model after having loaded -Closing out of the 3D Viewer app Supplemental information: -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 -Developed with: Login Enterprise Scripting Toolset version 4.6.5, Windows 10 Pro x64 21H1 -Last updated on: 12 Oct 2021 */ // Setting global vars int globalFunctionTimeoutInSeconds = 60; int globalCharactersPerMinuteToType = 2000; double globalIntermittentWaitInSeconds = 0.3; double idleAnimationTimeInSeconds = 2; // Configure how long to allow for the animation(s) to be idling for when in view int changeShadingModelKeyboardShortcutCharactersPerMinuteToType = 130; double idleTimeOnNewModelInSeconds = 10; MouseMove(1,1); // Optional -- killing 3D viewer if it's already open ShellExecute("cmd /c taskkill /f /im ApplicationFrameHost.ex*",waitForProcessEnd:true,timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); // Invoking the application and verifying it's running; using custom timer StartTimer("Windows3DViewer_InvocationTime"); ShellExecute(@"cmd /c start com.microsoft.3dviewer:",waitForProcessEnd:false,forceKillOnExit:true,timeout:globalFunctionTimeoutInSeconds); var MainWindow = FindWindow(title:"*- 3D Viewer*", className:"Win32 Window:ApplicationFrameWindow",processName:"ApplicationFrameHost",timeout:globalFunctionTimeoutInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot",timeout:globalFunctionTimeoutInSeconds); // Looking for the right-side controls frame, which should be present when the 3D viewer app is loaded StopTimer("Windows3DViewer_InvocationTime"); MainWindow.Maximize(); MainWindow.Focus(); Wait(idleAnimationTimeInSeconds); // Change animation speed var changeSpeedButton = MainWindow.FindControl(className : "Button:Button", title : "* animation speed",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); changeSpeedButton.Click(); MainWindow.FindControl(className : "Xaml Window:Xaml_WindowedPopupClass", title : "PopupHost",timeout:globalFunctionTimeoutInSeconds); // Verifying the speed selection pop-up shows MainWindow.Type("x ",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // This will choose the x2.0 speed selection Wait(idleAnimationTimeInSeconds); // Change Quick Animation setting to something other than default var changeQuickAnimationButton = MainWindow.FindControl(className : "Button:Button", title : "Quick Animations",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); changeQuickAnimationButton.Click(); MainWindow.FindControl(className : "Xaml Window:Xaml_WindowedPopupClass", title : "PopupHost",timeout:globalFunctionTimeoutInSeconds); // Verifying the Quick Animation selection pop-up shows MainWindow.Type("{down}{enter}",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // This will choose the second option in the pop up Wait(idleAnimationTimeInSeconds); // Change the Model animation setting to something other than default var changeModelAnimationButton = MainWindow.FindControl(className : "Button:Button", title : "Animation 1",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); changeModelAnimationButton.Click(); MainWindow.FindControl(className : "Xaml Window:Xaml_WindowedPopupClass", title : "PopupHost",timeout:globalFunctionTimeoutInSeconds); // Verifying the Model animation selection pop-up shows MainWindow.Type("{down}{enter}",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // This will choose the second option in the pop up Wait(idleAnimationTimeInSeconds); // Turn 2D grid on and off MainWindow.Type("g",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // Toggle grid on Wait(idleAnimationTimeInSeconds); MainWindow.Type("g",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // Toggle grid off Wait(idleAnimationTimeInSeconds); // Cycle through the different shading options of the model MainWindow.Type("{ctrl+1}{ctrl+2}{ctrl+3}{ctrl+4}{ctrl+5}{ctrl+6}{ctrl+7}{ctrl+8}{ctrl+9}{ctrl+0}",cpm:changeShadingModelKeyboardShortcutCharactersPerMinuteToType,hideInLogging:false); // Cycle through view presets in the Grid & Views page MainWindow.Type("v",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // Get into Grid & Views page MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Isometric (Right)",timeout:globalFunctionTimeoutInSeconds); // Verifying the Grid & Views page's loaded Wait(globalIntermittentWaitInSeconds); MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Isometric (Left)",timeout:globalFunctionTimeoutInSeconds).Click(); Wait(globalIntermittentWaitInSeconds); MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Cabinet",timeout:globalFunctionTimeoutInSeconds).Click(); Wait(globalIntermittentWaitInSeconds); MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Military (right)",timeout:globalFunctionTimeoutInSeconds).Click(); Wait(globalIntermittentWaitInSeconds); MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Military (Left)",timeout:globalFunctionTimeoutInSeconds).Click(); Wait(globalIntermittentWaitInSeconds); MainWindow.FindControl(className : "ListItem:GridViewItem", title : "Cavalier",timeout:globalFunctionTimeoutInSeconds).Click(); Wait(globalIntermittentWaitInSeconds); // Cycle through presets in Environment & Lighting MainWindow.Type("l",cpm:globalCharactersPerMinuteToType,hideInLogging:false); // Get into Environment & Lighting page MainWindow.FindControl(className : "TabItem:PivotItem", title : "Environment & Lighting",timeout:globalFunctionTimeoutInSeconds); // Verifying the Environment & Lighting page has loaded Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[1]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the second theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[2]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the third theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[3]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the fourth theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[4]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the fifth theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[5]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the sixth theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[6]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the seventh theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[7]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the eighth theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[8]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the ninth theme Wait(globalIntermittentWaitInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Tab:Pivot/TabItem:PivotItem/Pane:ScrollViewer/Button:Expander/List:GridView/ListItem:GridViewItem[0]",timeout:globalFunctionTimeoutInSeconds).Click(); // Opening the default theme Wait(globalIntermittentWaitInSeconds); // *Note an internet connection is needed for the following to work* // Open up the 3D library popup, verify it opens, choose All Animated Models category, loading the first (top-left) model, and idling on the new model being loaded MainWindow.FindControl(className : "Button:Button", title : "3D library").Click(); MainWindow.FindControl(className : "List:GridView", title : "3D Items",timeout:globalFunctionTimeoutInSeconds); // Verifying the 3D library popup is present MainWindow.Type("{pagedown}".Repeat(3),cpm:globalCharactersPerMinuteToType,hideInLogging:false); var allAnimatedModelsButton = MainWindow.FindControl(className : "ListItem:GridViewItem", title : "All Animated Models",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); allAnimatedModelsButton.Click(); MainWindow.FindControl(className : "Text:TextBlock", title : "All Animated Models", text : "All Animated Models",timeout:globalFunctionTimeoutInSeconds); // Verifying All Animated Models page has loaded var allAnimatedModelsPageFirstModel = MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Xaml Window:Popup[1]/Pane:ScrollViewer/List:GridView/ListItem:GridViewItem",timeout:globalFunctionTimeoutInSeconds); // This is locating the top-left model in the page Wait(globalIntermittentWaitInSeconds); allAnimatedModelsPageFirstModel.Click(); Wait(idleTimeOnNewModelInSeconds); ShellExecute(@"cmd /c taskkill /f /im ApplicationFrameHost.ex*",timeout:globalFunctionTimeoutInSeconds,forceKillOnExit:true,waitForProcessEnd:true); // Close out of the 3D Viewer app } }