using LoginPI.Engine.ScriptBase; using System.Diagnostics; public class officeTeamsDesktop : 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. -Run the workload against the "target" using Script Editor to ensure it will work before uploading it and testing with it -If needed, configure the Set global variables 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 -This workload will: run Teams, go into Activity, Calendar, and Teams pages, send a Test Chat, send a Test Call -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: false */ // Script variables int globalIntermittentWaitInSeconds = 1; int waitToEnumerateCommandBarActions = 1; int waitToEnumerateRecipient = 2; int globalCharactersPerMinuteToType = 2000; int globalFunctionTimeoutInSeconds = 60; string chatRecipient = "user@domain.com"; // Teams chat message recipient - define name or email address. string testMessage = "This is a test message."; // Chat test message // this will kill teams if it's running. comment out if not needed foreach (Process proc in Process.GetProcessesByName("teams")) {proc.Kill();} Wait(globalIntermittentWaitInSeconds); // this will start narrator and verify it's running ShellExecute(@"cmd /c start narrator",waitForProcessEnd:false); var narratorWindow = FindWindow(title:"*Narrator*",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); StartTimer("Teams_App_LaunchAuth_Time"); START(mainWindowTitle:"* | Microsoft Teams*",mainWindowClass: "Pane:Chrome_WidgetWin_1",processName:"Teams",timeout:globalFunctionTimeoutInSeconds); // put the teams initial window information here var MainWindowActivityToolbarButton = MainWindow.FindControl(className : "Button", title : "Activity Toolbar",timeout:globalFunctionTimeoutInSeconds); // This verifies Teams is running in a fashion in which the objects are find-able StopTimer("Teams_App_LaunchAuth_Time"); foreach (Process proc in Process.GetProcessesByName("narrator")) { proc.Kill(); } foreach (Process proc in Process.GetProcessesByName("ApplicationFrameHost")) { proc.Kill(); } MainWindow.Focus(); MainWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); // Click on the Activity button, wait for page to load, and have custom timer around something that will be present when the page is loaded Wait(globalIntermittentWaitInSeconds, showOnScreen: true, onScreenText: "Clicking Activity button"); MainWindowActivityToolbarButton.Click(); StartTimer("Teams_Activity_Page_Load_Time"); MainWindow.FindControl(className : "Group", title : "Activity and Notifications list",timeout:globalFunctionTimeoutInSeconds); StopTimer("Teams_Activity_Page_Load_Time"); // Click on the calendar button, wait for page to load, and have custom timer around something that will be present when the page is loaded Wait(globalIntermittentWaitInSeconds, showOnScreen: true, onScreenText: "Clicking Calendar button"); var MainWindowCalendarButton = MainWindow.FindControl(className : "Button", title : "Calendar Toolbar",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); MainWindowCalendarButton.Click(); StartTimer("Teams_Calendar_Page_Load_Time"); MainWindow.FindControl(className : "Group", title : "Calendar grid",timeout:globalFunctionTimeoutInSeconds); StopTimer("Teams_Calendar_Page_Load_Time"); // Click on the teams button, wait for page to load, and have custom timer around something that will be present when the page is loaded Wait(globalIntermittentWaitInSeconds, showOnScreen: true, onScreenText: "Clicking Teams button"); var MainWindowTeamsButton = MainWindow.FindControl(className : "Button", title : "Teams Toolbar",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); MainWindowTeamsButton.Click(); StartTimer("Teams_Teams_Page_Load_Time"); MainWindow.FindControl(className : "Group", title : "Teams and Channels list",timeout:globalFunctionTimeoutInSeconds); StopTimer("Teams_Teams_Page_Load_Time"); // this will send a new chat to the defined recipient Wait(globalIntermittentWaitInSeconds, showOnScreen: true, onScreenText: "Performing a test chat sequence"); MainWindow.Type("{ctrl+e}",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type("/chat",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type("{enter}",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type(chatRecipient,cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateRecipient); // this is a wait which is allowing the recipient chat user to be enumerated/found/populated. this is a moving target in terms of how long it takes; likely depends on local client network connection and Teams server bandwidth MainWindow.Type(@"{enter}",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type(testMessage,cpm:globalCharactersPerMinuteToType); Type("{enter}{enter}{enter}{enter}",cpm:60); StartTimer("Teams_Chat_Page_Load_Time"); MainWindow.FindControl(className : "Group", title : "Chat list",timeout:globalFunctionTimeoutInSeconds); StopTimer("Teams_Chat_Page_Load_Time"); // this will perform Test Call Wait(globalIntermittentWaitInSeconds, showOnScreen: true, onScreenText: "Performing a test call sequence"); MainWindow.Focus(); MainWindow.Type(@"{ctrl+e}",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type("/testcall",cpm:globalCharactersPerMinuteToType); Wait(waitToEnumerateCommandBarActions); MainWindow.Type("{enter}",cpm:globalCharactersPerMinuteToType); StartTimer("Teams_TestCall_Load_Time"); var MainWindowCallPage = FindWindow(title:"Microsoft Teams",className:"Pane:Chrome_WidgetWin_1",processName:"Teams",timeout:globalFunctionTimeoutInSeconds); // get window metadata for when the calls page is loaded MainWindowCallPage.FindControl(className : "Group",title:"Call controls",timeout:globalFunctionTimeoutInSeconds); StopTimer("Teams_TestCall_Load_Time"); FindWindow(title:"*| Microsoft Teams",timeout:globalFunctionTimeoutInSeconds); // this will make sure the call has been ended by looking for a certain window (looking for the chat page being open). make sure the timeout value is set high enough to accommodate the test call feature ending by itself; likely at least ~30 seconds // this ends the workload and app foreach (Process proc in Process.GetProcessesByName("teams")) { proc.Kill(); } } }