Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions E2E/CheckInTest/Helper-library.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.".\Library\LookUpTable.ps1"
.".\Library\DeviceDetails.ps1"
.".\Library\SetupandCompleteTestRun"
.".\Library\TeamsAppHandlers.ps1"

.".\CheckInTest\CameraAppTest.ps1"
.".\CheckInTest\SettingAppTest.ps1"
Expand Down
26 changes: 19 additions & 7 deletions E2E/Library/FindClickableElement.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ INPUT PARAMETERS:
RETURN TYPE:
- [object] :- Returns the UI element if found, otherwise returns $null.
#>
function CheckIfElementExists($uiEle, $clsNme, $proptyNme, $timeoutSeconds = 2) {
$classNameCondition = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::ClassNameProperty, $clsNme)
$nameCondition = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::NameProperty, $proptyNme)
$jointCondition = New-Object Windows.Automation.AndCondition($classNameCondition, $nameCondition)

function CheckIfElementExists($uiEle, $clsNme, $proptyNme, $timeoutSeconds = 2)
{

$condition = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::NameProperty, $proptyNme)
if($clsNme -ne $null)
{
$classCondition = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::ClassNameProperty, $clsNme)
$condition = New-Object Windows.Automation.AndCondition($classCondition, $condition)
}
$elemt = $null
$endTime = [DateTime]::Now.AddSeconds($timeoutSeconds)
while ([DateTime]::Now -lt $endTime -and $elemt -eq $null) {
$elemt = $uiEle.FindFirst([Windows.Automation.TreeScope]::Descendants, $jointCondition)
$elemt = $uiEle.FindFirst([System.Windows.Automation.TreeScope]::Descendants,$condition)
Start-Sleep -Milliseconds 100 # Check every 100ms
}

}
return $elemt
}

Expand Down Expand Up @@ -345,3 +350,10 @@ function FindAndClickList
Write-Error "Could not locate element in this list: $($proptyNmeLst -join ', ')" -ErrorAction Stop
}
}
function FindUIElementByProcessID($procID)
{
$root = [Windows.Automation.AutomationElement]::RootElement
$condition = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::ProcessIdProperty, $procID)
$uiELe = $root.FindFirst([Windows.Automation.TreeScope]::Children, $condition)
return $uiELe
}
93 changes: 93 additions & 0 deletions E2E/Library/TeamsAppHandlers.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<#
DESCRIPTION:
Starts a Microsoft Teams meeting using the given link and automates
camera, audio, and join actions.

INPUT PARAMETERS:
@param teamsMeetingLink [String] - Teams meeting URL.

RETURN TYPE:
void
#>
function Start-TeamsMeeting
{
Write-Log -Message "Entering Start-TeamsMeeting function" -IsOutput

# Launch the Teams app with the meeting link
Start-Process "https://teams.live.com/meet/9393388815307?p=DjwPrJ9iFrjS0pdlyT"
Comment on lines +13 to +17
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Teams meeting link is hardcoded. Consider making this configurable through a parameter or configuration file to improve maintainability and reusability.

Suggested change
{
Write-Log -Message "Entering Start-TeamsMeeting function" -IsOutput
# Launch the Teams app with the meeting link
Start-Process "https://teams.live.com/meet/9393388815307?p=DjwPrJ9iFrjS0pdlyT"
(
[Parameter(Mandatory=$true)]
[string]$teamsMeetingLink
)
{
Write-Log -Message "Entering Start-TeamsMeeting function" -IsOutput
# Launch the Teams app with the meeting link
Start-Process $teamsMeetingLink

Copilot uses AI. Check for mistakes.

# Toggle Camera button
[System.Windows.Forms.SendKeys]::SendWait('^+o')

# Wait and check if Teams process is running
Start-Sleep -Seconds 5
$Teams = Get-Process -Name "ms-teams" -ErrorAction SilentlyContinue
if (-not $Teams) {
Write-Host "Teams process not found."
return
}
$TeamsProcessIDDetails = $Teams.Id
foreach($TeamsProcessID in $TeamsProcessIDDetails)
{
$uiTeams = FindUIElementByProcessID -procID $TeamsProcessID
if ($uiTeams -ne $null)
{
# Click Join, then check camera & mic is On.
start-sleep -s 5
FindAndClick -uiEle $uiTeams -autoID "prejoin-join-button"
Start-Sleep -s 5
Start-Camera -uiEle $uiTeams
Start-Sleep -s 5
Start-Audio -uiEle $uiTeams

# End and Close Teams after 60 secs
Start-Sleep -s 60
[System.Windows.Forms.SendKeys]::SendWait('^+H')
Stop-Process -Name "ms-teams"
Start-Sleep -s 2
}

}
}
<#
DESCRIPTION:
This function turns on the camera in the Teams app if it's not already on.
INPUT PARAMETERS:
- uiEle [object] :- The Teams UI element for camera control.
RETURN TYPE:
- void
#>

function Start-Camera($uiEle)
{
Write-Log -Message "Entering Start-Camera function" -IsOutput
$elemt = CheckIfElementExists -uiEle $uiEle -proptyNme "Turn camera off"
if ($elemt -ne $null){
Write-Log -Message "Camera is already On" -IsHost -IsOutput
}
else
{
FindAndClick -uiEle $uiEle -proptyNme "Turn camera on"
}
}
<#
DESCRIPTION:
This function unmutes the microphone in the Teams app if it's muted.
INPUT PARAMETERS:
- uiEle [object] :- The Teams UI element for audio control.
RETURN TYPE:
- void
#>

function Start-Audio($uiEle)
{
Write-Log -Message "Entering Start-Audio function" -IsOutput
$elemt = CheckIfElementExists -uiEle $uiEle -proptyNme "Mute mic"
if ($elemt -ne $null){
Write-Log -Message "Audio is already On" -IsHost -IsOutput
}
else
{
FindAndClick -uiEle $uiEle -proptyNme "Unmute mic"
}
}
93 changes: 93 additions & 0 deletions E2E/TeamsTest.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
param (
[string] $token = $null,
[string] $SPId = $null,
[string] $targetMepCameraVer = $null,
[string] $targetMepAudioVer = $null,
[string] $targetPerceptionCoreVer = $null

)
# Sign In Teams with UserName: MEPTesting and check @jdugar for password. One time setup- Teams meeting link opens in browser, Select option to open in App always.

<#
DESCRIPTION:
This function runs an end-to-end test for the Teams application,
checking device power states, starting a Teams meeting, and capturing performance data.
INPUT PARAMETERS:
- token [string] :- Authentication token required to control the smart plug.
- SPId [string] :- Smart plug ID used to control device power states.
- targetMepCameraVer [string] :- Target version of the MEP.
- targetMepAudioVer [string] :- Target version of the MEP.
- targetPerceptionCoreVer [string] :- Target version of the Perception Core.
RETURN TYPE:
- void
#>
function Teamse2eTesting
{
Write-Log -Message "Entering Teamse2eTesting function" -IsOutput
$startTime = Get-Date
$ErrorActionPreference='Stop'
foreach($devPowStat in "Pluggedin" , "Unplugged")
{
$scenarioLogFolder = "$devPowStat\Teamse2eTesting"
$logFile = "Teamse2eTesting.txt"

try
{
# Create Scenario folder
CreateScenarioLogsFolder $scenarioLogFolder

$devState = CheckDevicePowerState $devPowStat $token $SPId
if($devState -eq $false)
{
TestOutputMessage $scenarioLogFolder "Skipped" $startTime "Token is empty"
return
}


# Toggling All effects on
Write-Output "Entering ToggleAIEffectsInSettingsApp function to toggle all effects On"
ToggleAIEffectsInSettingsApp -AFVal "On" -PLVal "On" -BBVal "On" -BSVal "False" -BPVal "True" `
-ECVal "On" -ECSVal "False" -ECTVal "True" -VFVal "On" `
-CF "On" -CFI "False" -CFA "False" -CFW "True"


# Checks if frame server is stopped
Write-Output "Entering CheckServiceState function"
CheckServiceState 'Windows Camera Frame Server'

# Starting to collect Traces
Write-Output "Entering StartTrace function"
StartTrace $scenarioLogFolder

# Open Task Manager
Write-output "Opening Task Manager"
$uitaskmgr = OpenApp 'Taskmgr' 'Task Manager'
Start-Sleep -s 1
setTMUpdateSpeedLow -uiEle $uitaskmgr

# Start Teams Meeting
Start-sleep -s 2
Start-TeamsMeeting

# Capture CPU and NPU Usage screenshot
Write-output "Entering CPUandNPU-Usage function to capture CPU and NPU usage Screenshot"
stopTaskManager -uitaskmgr $uitaskmgr -Scenario $scenarioLogFolder

# Verify logs and capture results.
Complete-TestRun $scenarioLogFolder $startTime $token $SPId
}
catch
{
Error-Exception -snarioName $scenarioLogFolder -strttme $startTime -rslts $Results -logFile $logFile -token $token -SPID $SPID
}
}
#For our Sanity, we make sure that we exit the test in neutral state, which is plugged in
SetSmartPlugState $token $SPId 1
}
Add-Type -AssemblyName UIAutomationClient
Add-Type -AssemblyName UIAutomationTypes
Add-Type -AssemblyName System.Windows.Forms

.".\CheckInTest\Helper-library.ps1"
InitializeTest 'Teamse2eTesting' $targetMepCameraVer $targetMepAudioVer $targetPerceptionCoreVer
Teamse2eTesting | Out-File -FilePath "$pathLogsFolder\Teamse2eTesting.txt" -Append
Loading