Test 03 2023 (#726)

* Update inputXML.xaml

* Compile Winutil

* Update main.ps1 (#641)

Fix DarkMode

* Compile Winutil

* Compile Winutil

* Compile Winutil

* Update tweaks.json

* fix hovertime

* shortcut (#643)

add ability to create a shortcut to invoke winutil more easily

* Compile Winutil

* Tweaks Check (#646)

* Tweaks Check

Added check for no checked tweaks plus formatting

* more formating fixing

* Compile Winutil

* [ooshutup10] Fixed link to ooshutup10 settings file (#665)

* Compile Winutil

* Features Migrated to config and runspaces (#667)

* Compile Winutil

* Document Calendar Disable/Enable

Check Disable Notification and click undo tweaks to re-enable calendar

* Compile Winutil

* Update Edge_Removal.bat

* Update Edge_Removal.bat (#660)

* garbage commit - read system

Trying to read current system registry values state and do a checkbox for enabled or disabled values

* Compile Winutil

* Add Ubisoft Connect & WinRAR as install options. (#678)

* Compile Winutil

* adding the code from asheroto to install winget (#684)

* adding the code from asheroto to get winget

with Server versions of Windows, that come without winget , the script seems unable to install it and then refuses to install any programs. so by adding two lines of code (hopefully) you can include the installation of winget and then fulfill the requirement and let the program run and do all the cool things

* instaling winget from asheroto

so the script will check if winget is installed on server and LTSC versions of Windows.  and tries to install it, when for some reason it can't, then a condition on the code gets fulfilled and the function breaks, this code from the asheroto repo should, (hopefully) make it so winget can get installed and the condition is never met, therefore allowing it the script to continue

* Compile Winutil

* Add Neovim and Node Version Manager (#691)

* Compile Winutil

* Preload Winget and tweaks with already installed (#682)

* winget

* updated runspaces and winget to update gui outside of main thread

* registry check for tweaks

* add impex to winget

* add uninstall button

* tweaks done

* update tests

---------

Co-authored-by: Chris Titus <contact@christitus.com>

* Compile Winutil

* feat: add postman into developement (#695)

Co-authored-by: Chris Titus <contact@christitus.com>

* Update inputXML.xaml (#701)

Some of the items were missing WPF in the name

* Compile Winutil

* Split up AllowGameDVR to fix breaking Xbox Game Bar (#692)

* Split up AllowGameDVR to fix breaking Xbox Game Bar

* Undo changes to winutil

* Compile Winutil

* Removed Atom due to it having been sunsetted (#711)

Co-authored-by: Chris Titus <contact@christitus.com>

* Add application GeForce NOW to Applications/Games (#724)

* Compile Winutil

* Fix syntax and typo

* Compile Winutil

* Fixing Original Service Types

* Compile Winutil

* Update inputXML.xaml (#725)

Fix typo as upgrade selection will upgrade all

* Compile Winutil

---------

Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: DeveloperDurp <developerdurp@durp.info>
Co-authored-by: jokerwrld999 <47574931+jokerwrld999@users.noreply.github.com>
Co-authored-by: Raf <69535896+Rafee-M@users.noreply.github.com>
Co-authored-by: Jack Boecker <boeckerjack@protonmail.com>
Co-authored-by: migno_chrono <75509204+mignochrono@users.noreply.github.com>
Co-authored-by: Umair Raza <52033975+umairraza96@users.noreply.github.com>
Co-authored-by: dreamsyntax <dreamsyntax@gmail.com>
Co-authored-by: Daniel <74148862+Danulal@users.noreply.github.com>
Co-authored-by: tomgrice <tomgrice@gmail.com>
This commit is contained in:
Chris Titus
2023-05-09 13:14:27 -05:00
committed by GitHub
parent a1c7501b98
commit 075f2e9a50
28 changed files with 3966 additions and 1253 deletions

View File

@ -1,16 +1,3 @@
#region Configurable Variables
<#
.NOTES
Use this section to configure testing variables. IE if the number of tabs change in the GUI update that variable here.
All variables need to be global to be passed between contexts
#>
$global:FormName = "Chris Titus Tech's Windows Utility"
#endregion Configurable Variables
#region Load Variables needed for testing
#Config Files
@ -91,25 +78,4 @@ Describe "Config Files" -ForEach @(
}
}
}
#===========================================================================
# Tests - Functions
#===========================================================================
Describe "Functions" -ForEach @(Get-ChildItem .\functions -Recurse -File){
BeforeEach -Scriptblock {
. $psitem.FullName
}
Context "$($psitem.BaseName)" {
It "Imports with no errors" {
Get-ChildItem function:\$($psitem.BaseName) | should -Not -BeNullOrEmpty
}
It "Contains Description" {
get-help $($psitem.BaseName) -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Description | should -Not -BeNullOrEmpty
}
}
}
}

View File

@ -0,0 +1,28 @@
#===========================================================================
# Tests - Functions
#===========================================================================
Describe "Functions"{
Get-ChildItem .\functions -Recurse -File | ForEach-Object {
context "$($psitem.BaseName)" {
BeforeEach -Scriptblock {
. $fullname
}
It "Imports with no errors" -TestCases @{
basename = $($psitem.BaseName)
fullname = $psitem.FullName
} {
Get-ChildItem function:\$basename | should -Not -BeNullOrEmpty
}
It "Contains Description" -TestCases @{
basename = $($psitem.BaseName)
fullname = $psitem.FullName
} {
get-help $basename -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Description | should -Not -BeNullOrEmpty
}
}
}
}

View File

@ -1,208 +1,27 @@
#region Configurable Variables
<#
.NOTES
Use this section to configure testing variables. IE if the number of tabs change in the GUI update that variable here.
All variables need to be global to be passed between contexts
#>
$global:FormName = "Chris Titus Tech's Windows Utility"
#endregion Configurable Variables
#region Load Variables needed for testing
#Config Files
$global:configs = @{}
./Compile.ps1
(
"applications",
"preset"
) | ForEach-Object {
$global:configs["$PSItem"] = Get-Content .\config\$PSItem.json | ConvertFrom-Json
}
#GUI
$global:inputXML = get-content MainWindow.xaml
$global:inputXML = $global:inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
[xml]$global:XAML = $global:inputXML
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
$global:reader = (New-Object System.Xml.XmlNodeReader $global:xaml)
$global:Form = [Windows.Markup.XamlReader]::Load( $global:reader )
$global:xaml.SelectNodes("//*[@Name]") | ForEach-Object { Set-Variable -Name "Global:WPF$($_.Name)" -Value $global:Form.FindName($_.Name) -Scope global }
#dotsource original script to pull in all variables and ensure no errors
$script = Get-Content .\winutil.ps1
$output = $script[0..($script.count - 14)] | Out-File .\pester.ps1
$script[0..($script.count - 21)] | Out-File .\pester.ps1
#endregion Load Variables needed for testing
#===========================================================================
# Tests - Application Installs
#===========================================================================
Describe "Application Installs" {
Context "Application installs" {
It "Imports with no errors" {
$global:configs.Applications | should -Not -BeNullOrEmpty
}
}
Context "Winget Install" {
$global:configs.applications | Get-Member -MemberType NoteProperty | ForEach-Object {
$TestCase = @{ name = $psitem.name }
It "$($psitem.name) should include Winget Install" -TestCases $TestCase{
param($name)
$null -eq $global:configs.applications.$name.winget | should -Befalse -because "$name Did not include a Winget Install"
}
}
}
Context "GUI Applications Checkbox" {
(get-variable | Where-Object {$psitem.name -like "*install*" -and $psitem.value.GetType().name -eq "CheckBox"}).name -replace 'Global:','' | ForEach-Object {
$TestCase = @{ name = $psitem }
It "$($psitem) should include application.json " -TestCases $TestCase{
param($name)
$null -eq $global:configs.applications.$name | should -Befalse -because "$name Does not have entry in applications.json"
}
}
}
BeforeAll {
. .\pester.ps1
}
#===========================================================================
# Tests - Tweak Presets
#===========================================================================
Describe "Tweak Presets" {
Context "Json Import" {
It "Imports with no errors" {
$global:configs.preset | should -Not -BeNullOrEmpty
}
}
}
#===========================================================================
# Tests - GUI
#===========================================================================
Describe "GUI" {
Context "XML" {
It "Imports with no errors" {
$global:XAML | should -Not -BeNullOrEmpty
}
It "Title should be $global:FormName" {
$global:XAML.window.Title | should -Be $global:FormName
$inputXML | should -Not -BeNullOrEmpty
}
}
Context "Form" {
It "Imports with no errors" {
$global:Form | should -Not -BeNullOrEmpty
}
It "Title should match XML" {
$global:Form.title | should -Be $global:XAML.window.Title
$sync.Form | should -Not -BeNullOrEmpty
}
}
}
#===========================================================================
# Tests - Functions
#===========================================================================
Describe "Functions" {
BeforeEach -Scriptblock {
. ./pester.ps1
$x = 0
while($sync.ConfigLoaded -ne $True -or $x -eq 100){
start-sleep -Milliseconds 100
$x ++
}
}
It "Get-InstallerProcess should return the correct values" {
Get-InstallerProcess | should -Befalse
$process = Start-Process powershell.exe -ArgumentList "-c start-sleep 5" -PassThru
Get-InstallerProcess $process | should -Not -Befalse
}
It "Runspace background load should have data" {
$sync.configs.applications | should -Not -BeNullOrEmpty
$sync.configs.tweaks | should -Not -BeNullOrEmpty
$sync.configs.preset | should -Not -BeNullOrEmpty
$sync.configs.feature | should -Not -BeNullOrEmpty
$sync.ComputerInfo | should -Not -BeNullOrEmpty
}
}
#===========================================================================
# Tests - GUI Functions
#===========================================================================
Describe "GUI Functions" {
BeforeEach -Scriptblock {
. ./pester.ps1
$x = 0
while($sync.ConfigLoaded -ne $True -or $x -eq 100){
start-sleep -Milliseconds 100
$x ++
}
}
It "GUI should load with no errors" {
$WPFTab1BT | should -Not -BeNullOrEmpty
$WPFundoall | should -Not -BeNullOrEmpty
$WPFPanelDISM | should -Not -BeNullOrEmpty
$WPFPanelAutologin | should -Not -BeNullOrEmpty
$WPFUpdatesdefault | should -Not -BeNullOrEmpty
$WPFFixesUpdate | should -Not -BeNullOrEmpty
$WPFUpdatesdisable | should -Not -BeNullOrEmpty
$WPFUpdatessecurity | should -Not -BeNullOrEmpty
$WPFFeatureInstall | should -Not -BeNullOrEmpty
$WPFundoall | should -Not -BeNullOrEmpty
$WPFtweaksbutton | should -Not -BeNullOrEmpty
$WPFminimal | should -Not -BeNullOrEmpty
$WPFlaptop | should -Not -BeNullOrEmpty
$WPFdesktop | should -Not -BeNullOrEmpty
$WPFInstallUpgrade | should -Not -BeNullOrEmpty
$WPFinstall | should -Not -BeNullOrEmpty
}
Context "Get-CheckBoxes" {
It "Get-CheckBoxes Install should return data" {
$TestCheckBoxes = @(
"WPFInstallvc2015_32"
"WPFInstallvscode"
"WPFInstallgit"
)
$OutputResult = New-Object System.Collections.Generic.List[System.Object]
$TestCheckBoxes | ForEach-Object {
$global:configs.applications.$psitem.winget -split ";" | ForEach-Object {
$OutputResult.Add($psitem)
}
}
$OutputResult = Sort-Object -InputObject $OutputResult
$TestCheckBoxes | ForEach-Object {(Get-Variable $PSItem).value.ischecked = $true}
$Output = Get-CheckBoxes -Group WPFInstall | Sort-Object
$Output | should -Not -BeNullOrEmpty -Because "Output did not contain applications to install"
$Output | Should -Not -Be $OutputResult -Because "Output contains duplicate values"
$Output | Should -Be $($OutputResult | Select-Object -Unique | Sort-Object) -Because "Output doesn't match"
$TestCheckBoxes | ForEach-Object {(Get-Variable $PSItem).value.ischecked | should -be $false}
}
}
Context "Set-Presets" {
$global:configs.preset | Get-Member -MemberType NoteProperty | ForEach-Object {
$TestCase = @{ name = $psitem.name }
It "preset $($psitem.name) should modify the correct values" -TestCases $TestCase {
param($name)
Set-Presets $name
get-variable $global:configs.preset.$name | Select-Object -ExpandProperty value | Select-Object -ExpandProperty ischecked | Where-Object {$psitem -eq $false} | should -BeNullOrEmpty
}
}
}
}