chore(e2e): Disable snap assist (#6214)

This commit is contained in:
Michael Li authored and GitHub committed 2025-10-29 18:21:32 -04:00
1 parent 25847c3884
commit 5885a40ab8
1 file changed
+11 -1
+11 -1
View File
@@ -231,7 +231,7 @@ resource "aws_instance" "client" {
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
# Create a non-admin user to be used for RDP connection. This
# is needed since the scheduled task that runs pyautogui
# is needed since the scheduled task that runs desktop automation
# doesn't work in an Administrator context.
## Create a local user
$Username = "${local.test_username}"
@@ -239,6 +239,16 @@ resource "aws_instance" "client" {
New-LocalUser $Username -Password $Password -FullName "Auto Login User" -Description "User for Auto Login"
Add-LocalGroupMember -Group "Administrators" -Member $Username
# Disable windows snapping assist. This is done to reduce
# complexity in RDP automated tests since the snapping assist
# window introduces an additional UI element that needs to be handled.
Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced" -Name "SnapAssist" -Value 0 -Force
$script = 'Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "SnapAssist" -Value 0 -Force; Stop-Process -Name explorer -Force; Start-Process explorer.exe'
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NonInteractive -WindowStyle Hidden -Command $script"
$trigger = New-ScheduledTaskTrigger -AtLogOn -User "autologinuser"
Register-ScheduledTask -TaskName "RemoveSnapAssist" -Action $action -Trigger $trigger -User "autologinuser" -RunLevel Highest -Force
# Set registry keys for auto-login
$regPath = "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
Set-ItemProperty -Path $regPath -Name "AutoAdminLogon" -Value "1" -Type String