Skip to content

V4 #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 262 commits into from
Oct 13, 2020
Merged

V4 #184

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
262 commits
Select commit Hold shift + click to select a range
f44df4a
v4
itfranck Aug 12, 2020
8116b99
scrennshots
itfranck Aug 12, 2020
76a3472
ci
itfranck Aug 12, 2020
b30b89d
output build
itfranck Aug 12, 2020
afd9f04
ci
itfranck Aug 12, 2020
6b02c46
Update Combined.tests.ps1
itfranck Aug 12, 2020
bee5ecd
ci
itfranck Aug 12, 2020
19c3da4
Update Combined.tests.ps1
itfranck Aug 12, 2020
cc5ddbc
Update CI.ps1
itfranck Aug 13, 2020
7c0a381
Update CI.ps1
itfranck Aug 13, 2020
5e240ba
Update Combined.tests.ps1
itfranck Aug 13, 2020
7efbe41
Update pipeline.yml
itfranck Aug 13, 2020
9dfc56d
Update CI.ps1
itfranck Aug 13, 2020
fe91eb9
Update Combined.tests.ps1
itfranck Aug 13, 2020
b4d3c57
Update Combined.tests.ps1
itfranck Aug 13, 2020
dd99af5
Update Combined.tests.ps1
itfranck Aug 13, 2020
607f92b
Update pipeline.yml
itfranck Aug 13, 2020
b87cea0
Update pipeline.yml
itfranck Aug 13, 2020
a703830
Update pipeline.yml
itfranck Aug 13, 2020
b05e786
Update pipeline.yml
itfranck Aug 13, 2020
6fb9d87
Update Stop-SeDriver.ps1
itfranck Aug 13, 2020
18c6bf7
Update Combined.tests.ps1
itfranck Aug 13, 2020
1829111
state fix
itfranck Aug 13, 2020
de3651a
ci
itfranck Aug 13, 2020
90aeb9f
ci / fixes
itfranck Aug 13, 2020
b0e1cce
Update Start-SeFirefoxDriver.ps1
itfranck Aug 13, 2020
f1e3fdc
Update Selenium.psm1
itfranck Aug 13, 2020
a2a6f2c
Update Start-SeFirefoxDriver.ps1
itfranck Aug 13, 2020
a15fa81
Update pipeline.yml
itfranck Aug 13, 2020
d35bc87
ci
itfranck Aug 13, 2020
ae32942
Update CI.ps1
itfranck Aug 13, 2020
4c70571
Update Combined.tests.ps1
itfranck Aug 13, 2020
ecb669d
Update Combined.tests.ps1
itfranck Aug 13, 2020
105f90a
Update Combined.tests.ps1
itfranck Aug 13, 2020
b71367f
Update Combined.tests.ps1
itfranck Aug 13, 2020
0f525c3
Update Combined.tests.ps1
itfranck Aug 13, 2020
c127296
Update Combined.tests.ps1
itfranck Aug 13, 2020
94d0380
V4 pipeline (#114)
itfranck Aug 15, 2020
52b278a
Clear-SeAlaer
itfranck Aug 15, 2020
87f4483
ci + help
itfranck Aug 15, 2020
1909fdc
Update RunTest.yml
itfranck Aug 15, 2020
9641415
Update Combined.tests.ps1
itfranck Aug 15, 2020
1db296d
Update RunTest.yml
itfranck Aug 15, 2020
6cb4d27
Update RunTest.yml
itfranck Aug 15, 2020
cd567d1
Update RunTest.yml
itfranck Aug 15, 2020
54b537e
ci
itfranck Aug 15, 2020
95e4b68
Update pipeline.yml
itfranck Aug 15, 2020
3c5a683
ci
itfranck Aug 15, 2020
8821daf
Update pipeline.yml
itfranck Aug 15, 2020
1aec6a0
ci
itfranck Aug 15, 2020
2145c21
ci
itfranck Aug 15, 2020
3b9b7c1
Update Combined.tests.ps1
itfranck Aug 15, 2020
bd6990d
Update Clear-SeAlert.ps1
itfranck Aug 15, 2020
3a17e5f
fixes
itfranck Aug 15, 2020
714ab56
#118 Get-SeHtml
itfranck Aug 15, 2020
d38642e
v4
itfranck Aug 16, 2020
f129f49
Switched Target to Driver + Removal of Driver alias
itfranck Aug 16, 2020
4d128cc
Update Combined.tests.ps1
itfranck Aug 18, 2020
9a2b074
Removed warning for Stop-SeDriver
itfranck Aug 19, 2020
0c6f120
Select / Doc / output
itfranck Aug 20, 2020
7ffc53b
Update Selenium.psm1
itfranck Aug 20, 2020
720af85
Create Selenium-help.xml
itfranck Aug 20, 2020
7a4c076
Select
itfranck Aug 20, 2020
a1b57cc
Select / Fixes
itfranck Aug 20, 2020
c31b021
#99 #115
itfranck Aug 22, 2020
5499721
v4
itfranck Aug 22, 2020
a9657a4
Get-SeElement Format fix.
itfranck Aug 22, 2020
1052310
#119 New-DriverService
itfranck Aug 22, 2020
745d578
set service host to localhost for all browsers.
itfranck Aug 22, 2020
62631ec
v4
itfranck Aug 22, 2020
241cda4
#124
itfranck Aug 23, 2020
996114b
Chrome drivers
itfranck Aug 30, 2020
eb184c8
CI
itfranck Aug 30, 2020
84f50a6
CI
itfranck Aug 30, 2020
bfeb7f0
ci
itfranck Aug 30, 2020
11def86
ci
itfranck Aug 30, 2020
8c1f282
Update CI.ps1
itfranck Aug 30, 2020
0983ea7
Update CI.ps1
itfranck Aug 30, 2020
8f2f7ab
ci
itfranck Aug 30, 2020
99e2052
Update Pester-To-XLSx.ps1
itfranck Aug 30, 2020
04f7c2f
ci
itfranck Aug 31, 2020
5b8afa8
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
fbd9ac6
Update Combined.tests.ps1
itfranck Aug 31, 2020
d07ac81
ci
itfranck Aug 31, 2020
62c1ce1
Update Combined.tests.ps1
itfranck Aug 31, 2020
4b8e897
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
c66c776
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
e89b851
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
8760f1c
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
61c26b4
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
3a575f6
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
8ad8bec
ic
itfranck Aug 31, 2020
ff86993
Update RunTest.yml
itfranck Aug 31, 2020
a9309ec
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
d25ef79
Update RunTest.yml
itfranck Aug 31, 2020
4f523bb
Update Combined.tests.ps1
itfranck Aug 31, 2020
14e7743
Update Combined.tests.ps1
itfranck Aug 31, 2020
a17bf96
Update Combined.tests.ps1
itfranck Aug 31, 2020
0f1204a
Update Combined.tests.ps1
itfranck Aug 31, 2020
b2cd1c9
Update Combined.tests.ps1
itfranck Aug 31, 2020
b851ba3
Update Combined.tests.ps1
itfranck Aug 31, 2020
2d4e889
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
d639721
Update Pester-To-XLSx.ps1
itfranck Aug 31, 2020
d0eac70
ci
itfranck Aug 31, 2020
df7e516
Update RunTest.yml
itfranck Aug 31, 2020
3178ceb
ci
itfranck Aug 31, 2020
6e1f0f5
Update Combined.tests.ps1
itfranck Aug 31, 2020
ffc3c1c
Update Combined.tests.ps1
itfranck Aug 31, 2020
a2132ba
Update Combined.tests.ps1
itfranck Aug 31, 2020
ada925a
Update Combined.tests.ps1
itfranck Aug 31, 2020
488750a
Update Combined.tests.ps1
itfranck Aug 31, 2020
aef0fc1
Update Combined.tests.ps1
itfranck Aug 31, 2020
d27fbb4
Update Combined.tests.ps1
itfranck Aug 31, 2020
a1b4f88
Update Combined.tests.ps1
itfranck Aug 31, 2020
fa47e28
Update Combined.tests.ps1
itfranck Aug 31, 2020
65887de
Update Combined.tests.ps1
itfranck Aug 31, 2020
f74005e
Update Combined.tests.ps1
itfranck Aug 31, 2020
9badd3a
Update Combined.tests.ps1
itfranck Aug 31, 2020
2418fe2
Update Combined.tests.ps1
itfranck Aug 31, 2020
2221d46
ci
itfranck Aug 31, 2020
184efc2
Update Combined.tests.ps1
itfranck Sep 1, 2020
b1e47be
Update Combined.tests.ps1
itfranck Sep 1, 2020
c06c991
Driver / elements formatting
itfranck Sep 6, 2020
6c8b095
Types path
itfranck Sep 6, 2020
24365da
Types
itfranck Sep 6, 2020
582300e
types
itfranck Sep 6, 2020
0c8f32c
Get-SeElement - All #126
itfranck Sep 6, 2020
8423278
Quiet removal #127
itfranck Sep 6, 2020
875bbcb
#117 Select-SeElement
itfranck Sep 7, 2020
bd56240
Get-SeElement parameter set fix.
itfranck Sep 7, 2020
dec0c49
.
itfranck Sep 7, 2020
39f1935
Fix - Select-SeElement
itfranck Sep 7, 2020
5b66891
Fix $option not defined on default param set
itfranck Sep 17, 2020
da9ce7f
Now produce a more approppriate error whenever multiple elements are …
itfranck Sep 18, 2020
b0d32d6
Get-SeHtml - accept pipeline input
itfranck Sep 18, 2020
f5c5634
#133
itfranck Sep 18, 2020
a7163d3
Revert on the Select-SeElement stuff
itfranck Sep 18, 2020
9f8e0e1
#125 Wait-SeDriver / Wait-SeElement
itfranck Sep 20, 2020
4252dcd
Build
itfranck Sep 20, 2020
f87d381
#134 Size + position arguments.
itfranck Sep 20, 2020
d7ed316
Update init.ps1
itfranck Sep 20, 2020
37aa9c2
Update init.ps1
itfranck Sep 20, 2020
601975e
Removed Driver default value in favor of Init-SeDriver
itfranck Sep 21, 2020
f20d369
compiled
itfranck Sep 21, 2020
0bbe1f9
Update init.ps1
itfranck Sep 22, 2020
6ee6a3f
#136
itfranck Sep 22, 2020
b0dcb56
recompile
itfranck Sep 22, 2020
c1a7cae
Update SeleniumClasses.ps1
itfranck Sep 22, 2020
7bc5df8
Update SeleniumClasses.ps1
itfranck Sep 22, 2020
e44ceb2
compile
itfranck Sep 22, 2020
7b059ac
Create Selenium-help.xml
itfranck Sep 22, 2020
7d9a19e
V4 requiredassemblies (#137)
itfranck Sep 22, 2020
df67a75
oops - random Register-ArgumentCompleter removal
itfranck Sep 22, 2020
8ca4411
Added Wait-SeDriver -Script (#138)
ili101 Sep 23, 2020
c55ad80
Feature/v4 interactions (#141)
itfranck Sep 26, 2020
87449bb
#139 Replaced ElementExists by PresenceOfAllElementsLocatedBy
itfranck Sep 26, 2020
40ec8f8
rebuild
itfranck Sep 26, 2020
a7947c0
Get-SeElement - ByChained
itfranck Sep 26, 2020
3281d9d
rebuild
itfranck Sep 26, 2020
3194cdc
Combined tests.
itfranck Sep 26, 2020
e47015d
Combined tests.
itfranck Sep 26, 2020
9c8a79f
Invoke-SeClick - Pipeline input fix.
itfranck Sep 28, 2020
a7c69a1
Cleanup / getting things out of seleniumclasses + #142 (#143)
itfranck Sep 30, 2020
5cfe0ae
#135 Explicit $null so it get picked up by downstream cmdlets
itfranck Sep 30, 2020
3fa72e5
Bug/v4 get se element error management (#145)
itfranck Sep 30, 2020
c4f1fef
#116 Throw instead of Write-error
itfranck Oct 2, 2020
1817ad6
Single switch (#147)
itfranck Oct 2, 2020
e20ff92
Smaller timeout + Implicit wait type change to double + cleanup (#148)
itfranck Oct 2, 2020
ced3f03
#144 By ID to be considered as "Single"
itfranck Oct 2, 2020
0429d4a
#151
itfranck Oct 2, 2020
d5dad6d
#146 change Timeout type for remaining cmdlet to double
itfranck Oct 2, 2020
8be4fdb
Set-SeDriverTimeout #150
itfranck Oct 2, 2020
aa9a558
#149 (#152)
itfranck Oct 2, 2020
0388572
#140
itfranck Oct 3, 2020
bbeb0e0
Rebuild
itfranck Oct 3, 2020
10c58c5
Internal function not used.
itfranck Oct 3, 2020
e8d815a
#153 (#154)
itfranck Oct 3, 2020
5ff39bd
#150
itfranck Oct 3, 2020
52822fc
Start-SeDriver with options / service parameter set missing.
itfranck Oct 3, 2020
06a3abe
rebuilt / format file / Ezout addition for
itfranck Oct 3, 2020
04b88a2
#91 Support for user agent (#155)
itfranck Oct 3, 2020
c2a4a52
Missing UserAgent param for new-sedriveroptions
itfranck Oct 3, 2020
b1bf24a
rebuild
itfranck Oct 3, 2020
a3b6bb7
Case fix
itfranck Oct 3, 2020
2706aff
Case fix
itfranck Oct 3, 2020
a47e8d5
Fix: Get-SeDriver -Browser param not working
itfranck Oct 3, 2020
7167797
doc. fix
itfranck Oct 3, 2020
489820d
Removal of Add-SeDriverOptionsArgument
itfranck Oct 3, 2020
99da128
.
itfranck Oct 3, 2020
630e803
Documentation + parameter fixes
itfranck Oct 4, 2020
f4b8712
Rebuild.
itfranck Oct 4, 2020
abc24c7
Doc.
itfranck Oct 4, 2020
6cb9db8
Doc.
itfranck Oct 4, 2020
33ff05f
#161
itfranck Oct 4, 2020
c584523
Update Get-SeElementAttribute.ps1
itfranck Oct 4, 2020
b0aa10c
#162
itfranck Oct 4, 2020
cb0ba20
#169
itfranck Oct 4, 2020
5a6174b
#168
itfranck Oct 4, 2020
c966fa7
#165
itfranck Oct 4, 2020
45b6b45
Rebuild
itfranck Oct 4, 2020
78ac1ac
#172
itfranck Oct 5, 2020
28b3139
Change to 0.2
itfranck Oct 5, 2020
ff77947
#159
itfranck Oct 5, 2020
20fd00d
Sleep should be before return.
itfranck Oct 5, 2020
ea1f371
#171
itfranck Oct 5, 2020
9a18844
SleepSeconds to Sleep + type set to double.
itfranck Oct 5, 2020
14a6967
rebuild
itfranck Oct 5, 2020
37f13e8
#167
itfranck Oct 5, 2020
8740239
#170
itfranck Oct 5, 2020
08af3fd
#163
itfranck Oct 6, 2020
13582a7
Get-SeSelect formatting / typename change
itfranck Oct 9, 2020
bb6a834
Get-SeSelectValue - formatting + other
itfranck Oct 9, 2020
a4cfd90
Formatting
itfranck Oct 11, 2020
0f602e9
#166 Removed Invoke-SeKeyAction and modified Invoke-SeKeys instead
itfranck Oct 11, 2020
4714b21
#160 Convert classname search to CSSSelector when spaces are present.
itfranck Oct 11, 2020
2728375
#173 Combined.Tests fix.
itfranck Oct 11, 2020
2190eee
Rebuild
itfranck Oct 11, 2020
ee93bb7
Invoke-SeKey fix + rebuld
itfranck Oct 11, 2020
88cc33d
Test fix + rebuild
itfranck Oct 11, 2020
df115cb
Combined test SeShouldHave fix
itfranck Oct 11, 2020
f94e4d0
Set-SeSelectValue wildcard fix.
itfranck Oct 11, 2020
b1b0497
Combined tests - reduced maximum timeout when waiting for alert.
itfranck Oct 11, 2020
85c00cf
Fixes - Combined.Tests / Wait-SeDriver
itfranck Oct 11, 2020
d683702
Wait-SeElement fix
itfranck Oct 11, 2020
fd1aeaa
Typo
itfranck Oct 11, 2020
ff4a5c5
Combined tests; Alert wait timeout increase.
itfranck Oct 11, 2020
e62c23e
Disable alert test for now.
itfranck Oct 11, 2020
71d2079
Combined.Tests
itfranck Oct 11, 2020
e3ae5ed
JS click / combined testing PSGallery
itfranck Oct 11, 2020
0a58d1f
Combined test - timeout
itfranck Oct 11, 2020
b37c152
[CmdletBinding()]
itfranck Oct 11, 2020
c9efd99
Update Combined.tests.ps1
itfranck Oct 11, 2020
6580fb0
Create Update-SeDriver.ps1
itfranck Oct 11, 2020
4f8e6d3
Rebuild / Update-SeDriver
itfranck Oct 11, 2020
c8a4312
Invoke-seclick potential AZdevops IE mitigation.
itfranck Oct 11, 2020
67b49b1
#176 Remove $Driver parameter.
itfranck Oct 11, 2020
8340687
#176 hotfix - driver parameter removal
itfranck Oct 11, 2020
2e6a774
#176 - hotfix
itfranck Oct 11, 2020
0571e04
#176 - rebuild
itfranck Oct 11, 2020
53edf8c
Stop open driver on Module unload
itfranck Oct 11, 2020
cf9d0ea
rebuild
itfranck Oct 12, 2020
b5962a7
Features/v4 optmize driver get stop #179 (#180)
itfranck Oct 12, 2020
bb1016b
#178 Get-SeInput
itfranck Oct 12, 2020
158e6f1
ConvertTo-Selenium (#175)
ili101 Oct 12, 2020
4d53417
Change log + ConvertTo-Selenium rename + Rebuild
itfranck Oct 12, 2020
73e2462
rename
itfranck Oct 12, 2020
7629318
Update ChangeLog.md
itfranck Oct 12, 2020
43e3c84
ConvertTo-Selenium send Enter (#181)
ili101 Oct 12, 2020
7009ba4
fix examples / remove obsolete
itfranck Oct 12, 2020
96bfd94
Feature/v4 driverupgrade (#183)
itfranck Oct 13, 2020
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
116 changes: 73 additions & 43 deletions CI/CI.ps1
Original file line number Diff line number Diff line change
@@ -1,69 +1,99 @@
param (
[string[]]$BrowserList = @('Chrome', 'Firefox')
[String]$ModulePath,
[string[]]$BrowserList = @('Chrome', 'Firefox'),
[Switch]$UseDebugVersion
)

if ([String]::IsNullOrEmpty($ModulePath)) { $ModulePath = $pwd.path.Replace('\', '/') }
$env:ModulePath = $ModulePath
Write-Host "ModulePath: $ModulePath"
Write-Host "BrowserList: $($BrowserList -join ',')"
$Global:BrowserList = $BrowserList
#Get the OS/PS version info for later. On Linux run headless On windows and PS 6 (but not 7) add WindowsPowershell to the module path.
$Platform = ([environment]::OSVersion.Platform).ToString() + ' PS' + $PSVersionTable.PSVersion.Major
if ($Platform -notlike 'win*') { $env:AlwaysHeadless = $true }
if ($Platform -notlike 'win*') { $Global:HeadlessOnly = $true }
if ($Platform -like 'win*6') {
$env:PSModulePath -split ';' | Where-Object { $_ -match "\w:\\Prog.*PowerShell\\modules" } | ForEach-Object {
$env:PSModulePath = ($_ -replace "PowerShell", "WindowsPowerShell") + ";" + $env:PSModulePath
}
}



#Make sure we have the modules we need
Import-Module .\Output\Selenium\Selenium.psd1 -Force -ErrorAction Stop
$checkImportExcel = Get-Module -ListAvailable ImportExcel
if (-not ($checkImportExcel)) {
Write-Verbose -Verbose 'Installing ImportExcel'
Install-Module ImportExcel -Force -SkipPublisherCheck
$ModulePathSuffix = 'Output/Selenium/'
if ($UseDebugVersion) { $ModulePathSuffix = ''; Write-Host 'Debug version will be used' -ForegroundColor Yellow }
Import-Module "$ModulePath/$($ModulePathSuffix)Selenium.psd1" -Force -ErrorAction Stop

# $checkImportExcel = Get-Module -ListAvailable ImportExcel
# if (-not ($checkImportExcel)) {
# Write-Verbose -Verbose 'Installing ImportExcel'
# Install-Module ImportExcel -Force -SkipPublisherCheck
# }
# else { $checkImportExcel | Out-Host }
# $PesterLock = @{MinimumVersion = '4.10.0.0' ; MaximumVersion = '4.99.0.0' }
# $checkPester = Get-Module -ListAvailable Pester | Where-Object { $_.version.major -ge 4 -and $_.version.minor -ge 4 }
# if (-not $checkPester) {
# Write-Verbose -Verbose 'Installing Pester'
# Install-Module Pester -Force -SkipPublisherCheck @PesterLock
# }
# else { $checkPester | Out-Host }

#Import-Module Pester -RequiredVersion 4.10.1
#Import-Module ImportExcel -RequiredVersion 7.1.1

if (Test-path "$ModulePath/Modules") {
Import-Module "$ModulePath/Modules/Pester/5.0.3/Pester.psd1"
Import-Module "$ModulePath/Modules/ImportExcel/7.1.1/ImportExcel.psd1"
}
else { $checkImportExcel | Out-Host }
$checkPester = Get-Module -ListAvailable Pester | Where-Object { $_.version.major -ge 4 -and $_.version.minor -ge 4 }
if (-not $checkPester) {
Write-Verbose -Verbose 'Installing Pester'
Install-Module Pester -Force -SkipPublisherCheck
else {
Import-Module -Name Pester -RequiredVersion 5.0.3
Import-Module -Name ImportExcel -RequiredVersion 7.1.1
}
else { $checkPester | Out-Host }

#Run the test and results export to an Excel file for current OS - Test picks up the selected browser from an environment variable.

Write-verbose -Verbose "Pester $((Get-Module -Name Pester).Version.ToString()) loaded"
Write-verbose -Verbose "ImportExcel $((Get-Module -Name ImportExcel).Version.ToString()) loaded"

# #Run the test and results export to an Excel file for current OS - Test picks up the selected browser from an environment variable.
$RunParameters = @{
XLFile = '{0}/results/Results-{1}.xlsx' -f $env:BUILD_ARTIFACTSTAGINGDIRECTORY, [environment]::OSVersion.Platform.ToString()
Script = Join-Path -Path (Join-Path $pwd 'Examples') -ChildPath 'Combined.tests.ps1'
Path = "$ModulePath/Examples/Combined.tests.ps1"
}
foreach ( $b in $BrowserList) {
$env:DefaultBrowser = $b
$Global:DefaultBrowser = $b
$RunParameters['OutputFile'] = Join-Path $pwd "TestResults-$platform$b.xml"
$RunParameters['WorkSheetName'] = "$B $Platform"
$RunParameters | Out-Host
& "$PSScriptRoot\Pester-To-XLSx.ps1" @RunParameters
}

#Merge the results sheets into a sheet named 'combined'.
$excel = Open-ExcelPackage $RunParameters.XLFile
$wslist = $excel.Workbook.Worksheets.name
Close-ExcelPackage -NoSave $excel
Merge-MultipleSheets -path $RunParameters.XLFile -WorksheetName $wslist -OutputSheetName combined -OutputFile $RunParameters.XLFile -HideRowNumbers -Property name, result
# $excel = Open-ExcelPackage $RunParameters.XLFile
# $wslist = $excel.Workbook.Worksheets.name
# Close-ExcelPackage -NoSave $excel
# Merge-MultipleSheets -path $RunParameters.XLFile -WorksheetName $wslist -OutputSheetName combined -OutputFile $RunParameters.XLFile -HideRowNumbers -Property name, result

#Hide everything on 'combined' except test name, results for each browser, and test group, Set column widths, tweak titles, apply conditional formatting.
$excel = Open-ExcelPackage $RunParameters.XLFile
$ws = $excel.combined
2..$ws.Dimension.end.Column | ForEach-Object {
if ($ws.Cells[1, $_].value -notmatch '^Name|Result$|PS\dGroup$') {
Set-ExcelColumn -Worksheet $ws -Column $_ -Hid
}
elseif ($ws.Cells[1, $_].value -match 'Result$' ) {
Set-ExcelColumn -Worksheet $ws -Column $_ -Width 17
Set-ExcelRange $ws.Cells[1, $_] -WrapText
}
if ($ws.cells[1, $_].value -match 'PS\dGroup$') {
Set-ExcelRange $ws.Cells[1, $_] -WrapText -Value 'Group'
}
if ($ws.cells[1, $_].value -match '^Name|PS\dGroup$' -and ($ws.Column($_).Width -gt 80)) {
$ws.Column($_).Width = 80
}
}
Set-ExcelRow -Worksheet $ws -Height 28.5
$cfRange = [OfficeOpenXml.ExcelAddress]::new(2, 3, $ws.Dimension.end.Row, (3 * $wslist.count - 2)).Address
Add-ConditionalFormatting -WorkSheet $ws -range $cfRange -RuleType ContainsText -ConditionValue "Failure" -BackgroundPattern None -ForegroundColor Red -Bold
Add-ConditionalFormatting -WorkSheet $ws -range $cfRange -RuleType ContainsText -ConditionValue "Success" -BackgroundPattern None -ForeGroundColor Green
Close-ExcelPackage $excel
# #Hide everything on 'combined' except test name, results for each browser, and test group, Set column widths, tweak titles, apply conditional formatting.
# $excel = Open-ExcelPackage $RunParameters.XLFile
# $ws = $excel.combined
# 2..$ws.Dimension.end.Column | ForEach-Object {
# if ($ws.Cells[1, $_].value -notmatch '^Name|Result$|PS\dGroup$') {
# Set-ExcelColumn -Worksheet $ws -Column $_ -Hid
# }
# elseif ($ws.Cells[1, $_].value -match 'Result$' ) {
# Set-ExcelColumn -Worksheet $ws -Column $_ -Width 17
# Set-ExcelRange $ws.Cells[1, $_] -WrapText
# }
# if ($ws.cells[1, $_].value -match 'PS\dGroup$') {
# Set-ExcelRange $ws.Cells[1, $_] -WrapText -Value 'Group'
# }
# if ($ws.cells[1, $_].value -match '^Name|PS\dGroup$' -and ($ws.Column($_).Width -gt 80)) {
# $ws.Column($_).Width = 80
# }
# }
# Set-ExcelRow -Worksheet $ws -Height 28.5
# $cfRange = [OfficeOpenXml.ExcelAddress]::new(2, 3, $ws.Dimension.end.Row, (3 * $wslist.count - 2)).Address
# Add-ConditionalFormatting -WorkSheet $ws -range $cfRange -RuleType ContainsText -ConditionValue "Failure" -BackgroundPattern None -ForegroundColor Red -Bold
# Add-ConditionalFormatting -WorkSheet $ws -range $cfRange -RuleType ContainsText -ConditionValue "Success" -BackgroundPattern None -ForeGroundColor Green
# Close-ExcelPackage $excel
178 changes: 89 additions & 89 deletions CI/Pester-To-XLSx.ps1
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSPossibleIncorrectComparisonWithNull','',Justification='Intentional use to select non null array items')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSPossibleIncorrectComparisonWithNull', '', Justification = 'Intentional use to select non null array items')]
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
[Parameter(Position=0)]
[string]$XLFile,
[Parameter(Position = 0)]
[string]$XLFile,

[Parameter(ParameterSetName='Default',Position=1)]
[Alias('Path', 'relative_path')]
[object[]]$Script = '.',
[Parameter(ParameterSetName = 'Default', Position = 1)]
[String]$Path = '.',

[Parameter(ParameterSetName='Existing',Mandatory=$true)]
[switch]
$UseExisting,
[Parameter(ParameterSetName = 'Existing', Mandatory = $true)]
[switch]
$UseExisting,

[Parameter(ParameterSetName='Default', Position=2)]
[Parameter(ParameterSetName='Existing',Position=2, Mandatory=$true)]
[string]$OutputFile,
[Parameter(ParameterSetName = 'Default', Position = 2)]
[Parameter(ParameterSetName = 'Existing', Position = 2, Mandatory = $true)]
[string]$OutputFile,

[Parameter(ParameterSetName='Default')]
[Alias("Name")]
[string[]]$TestName,
[Parameter(ParameterSetName = 'Default')]
[Alias("Name")]
[string[]]$TestName,

[Parameter(ParameterSetName='Default')]
[switch]$EnableExit,
[Parameter(ParameterSetName = 'Default')]
[switch]$EnableExit,

[Parameter(ParameterSetName='Default')]
[Alias('Tags')]
[string[]]$Tag,
[string[]]$ExcludeTag,
[Parameter(ParameterSetName = 'Default')]
[Alias('Tags')]
[string[]]$Tag,
[string[]]$ExcludeTag,

[Parameter(ParameterSetName='Default')]
[switch]$Strict,
[Parameter(ParameterSetName = 'Default')]
[switch]$Strict,

[string]$WorkSheetName = 'PesterResults',
[switch]$append,
[switch]$Show
[string]$WorkSheetName = 'PesterResults',
[switch]$append,
[switch]$Show
)

$InvokePesterParams = @{OutputFormat = 'NUnitXml'} + $PSBoundParameters
if (-not $InvokePesterParams['OutputFile']) {
$InvokePesterParams['OutputFile'] = Join-Path -ChildPath 'Pester.xml'-Path ([environment]::GetFolderPath([System.Environment+SpecialFolder]::MyDocuments))
}
if ($InvokePesterParams['Show'] ) {}
if ($InvokePesterParams['XLFile']) {$InvokePesterParams.Remove('XLFile')}
else {$XLFile = $InvokePesterParams['OutputFile'] -replace '.xml$','.xlsx'}
$InvokePesterParams = $PSBoundParameters

if ($InvokePesterParams['XLFile']) { $InvokePesterParams.Remove('XLFile') }
else { $XLFile = $InvokePesterParams['OutputFile'] -replace '.xml$', '.xlsx' }
if (-not $UseExisting) {
$InvokePesterParams.Remove('Append')
$InvokePesterParams.Remove('UseExisting')
$InvokePesterParams.Remove('Show')
$InvokePesterParams.Remove('WorkSheetName')
Invoke-Pester @InvokePesterParams
$InvokePesterParams.Remove('Append') | Out-Null
$InvokePesterParams.Remove('UseExisting') | Out-Null
$InvokePesterParams.Remove('Show') | Out-Null
$InvokePesterParams.Remove('WorkSheetName') | Out-Null
$InvokePesterParams.Remove('OutputFile') | Out-Null
Set-Location $env:ModulePath
Invoke-Pester @InvokePesterParams -CI -Output Detailed -ErrorAction Continue
}

if (-not (Test-Path -Path $InvokePesterParams['OutputFile'])) {
throw "Could not output file $($InvokePesterParams['OutputFile'])"; return
}
# if (-not (Test-Path -Path $InvokePesterParams['OutputFile'])) {
# throw "Could not output file $($InvokePesterParams['OutputFile'])"; return
# }

$resultXML = ([xml](Get-Content $InvokePesterParams['OutputFile'])).'test-results'
$startDate = [datetime]$resultXML.date
$startTime = $resultXML.time
$machine = $resultXML.environment.'machine-name'
#$user = $resultXML.environment.'user-domain' + '\' + $resultXML.environment.user
$os = $resultXML.environment.platform -replace '\|.*$'," $($resultXML.environment.'os-version')"
$resultXML = ([xml](Get-Content -Path (Join-Path $env:ModulePath 'testResults.xml'))).'test-results'
$startDate = [datetime]$resultXML.date
$startTime = $resultXML.time
$machine = $resultXML.environment.'machine-name'
$user = $resultXML.environment.'user-domain' + '\' + $resultXML.environment.user
$os = $resultXML.environment.platform -replace '\|.*$', " $($resultXML.environment.'os-version')"
<#hierarchy goes
root, [date], start [time], [Name] (always "Pester"), test results broken down as [total],[errors],[failures],[not-run] etc.
Environment (user & machine info)
Expand All @@ -80,52 +78,54 @@ $os = $resultXML.environment.platform -replace '\|.*$'," $($resultXML.e
Test-case [description] - name as rendered for display with <vars> filled in
#>
$testResults = foreach ($test in $resultXML.'test-suite'.results.'test-suite') {
$testPs1File = $test.name
#Test if there are context blocks in the hierarchy OR if we go straight from Describe to test-case
if ($test.results.'test-suite'.results.'test-suite' -ne $null) {
foreach ($suite in $test.results.'test-suite') {
$Describe = $suite.description
foreach ($subsuite in $suite.results.'test-suite') {
$Context = $subsuite.description
if ($subsuite.results.'test-suite'.results.'test-case') {
$testCases = $subsuite.results.'test-suite'.results.'test-case'
}
else {$testCases = $subsuite.results.'test-case'}
$testCases | ForEach-Object {
New-Object -TypeName psobject -Property ([ordered]@{
Machine = $machine ; OS = $os
Date = $startDate ; Time = $startTime
Executed = $(if ($_.executed -eq 'True') {1})
Success = $(if ($_.success -eq 'True') {1})
Duration = $_.time
File = $testPs1File; Group = $Describe
SubGroup = $Context ; Name =($_.Description -replace '\s{2,}', ' ')
Result = $_.result ; FullDesc = '=Group&" "&SubGroup&" "&Name'})
}
}
$testPs1File = $test.name
#Test if there are context blocks in the hierarchy OR if we go straight from Describe to test-case
if ($test.results.'test-suite'.results.'test-suite' -ne $null) {
foreach ($suite in $test.results.'test-suite') {
$Describe = $suite.description
foreach ($subsuite in $suite.results.'test-suite') {
$Context = $subsuite.description
if ($subsuite.results.'test-suite'.results.'test-case') {
$testCases = $subsuite.results.'test-suite'.results.'test-case'
}
}
else {
$test.results.'test-suite' | ForEach-Object {
$Describe = $_.description
$_.results.'test-case'| ForEach-Object {
New-Object -TypeName psobject -Property ([ordered]@{
Machine = $machine ; OS = $os
Date = $startDate ; Time = $startTime
Executed = $(if ($_.executed -eq 'True') {1})
Success = $(if ($_.success -eq 'True') {1})
Duration = $_.time
File = $testPs1File; Group = $Describe
SubGroup = $null ; Name =($_.Description -replace '\s{2,}', ' ')
Result = $_.result ; FullDesc = '=Group&" "&Test'})
}
else { $testCases = $subsuite.results.'test-case' }
$testCases | ForEach-Object {
New-Object -TypeName psobject -Property ([ordered]@{
Machine = $machine ; OS = $os
Date = $startDate ; Time = $startTime
Executed = $(if ($_.executed -eq 'True') { 1 })
Success = $(if ($_.success -eq 'True') { 1 })
Duration = $_.time
File = $testPs1File; Group = $Describe
SubGroup = $Context ; Name = ($_.Description -replace '\s{2,}', ' ')
Result = $_.result ; FullDesc = '=Group&" "&SubGroup&" "&Name'
})
}
}
}
}
else {
$test.results.'test-suite' | ForEach-Object {
$Describe = $_.description
$_.results.'test-case' | ForEach-Object {
New-Object -TypeName psobject -Property ([ordered]@{
Machine = $machine ; OS = $os
Date = $startDate ; Time = $startTime
Executed = $(if ($_.executed -eq 'True') { 1 })
Success = $(if ($_.success -eq 'True') { 1 })
Duration = $_.time
File = $testPs1File; Group = $Describe
SubGroup = $null ; Name = ($_.Description -replace '\s{2,}', ' ')
Result = $_.result ; FullDesc = '=Group&" "&Test'
})
}
}
}
}
if (-not $testResults) {Write-Warning 'No Results found' ; return}
if (-not $testResults) { Write-Warning 'No Results found' ; return }
$clearSheet = -not $Append
$excel = $testResults | Export-Excel -Path $xlFile -WorkSheetname $WorkSheetName -ClearSheet:$clearSheet -Append:$append -PassThru -BoldTopRow -FreezeTopRow -AutoSize -AutoFilter -AutoNameRange
$ws = $excel.Workbook.Worksheets[$WorkSheetName]
$excel = $testResults | Export-Excel -Path $xlFile -WorkSheetname $WorkSheetName -ClearSheet:$clearSheet -Append:$append -PassThru -BoldTopRow -FreezeTopRow -AutoSize -AutoFilter -AutoNameRange
$ws = $excel.Workbook.Worksheets[$WorkSheetName]
<# Worksheet should look like ..
|A |B |C D |E |F |G |H |I |J |K |L |M
1|Machine |OS |Date Time |Executed |Success |Duration |File |Group |SubGroup |Name |Result |FullDescription
Expand All @@ -136,7 +136,7 @@ $ws = $excel.Workbook.Worksheets[$WorkSheetName]
Set-Column -Worksheet $ws -Column 3 -NumberFormat 'Short Date' # -AutoSize

#Hide columns E to J (Executed, Success, Duration, File, Group and Subgroup)
(5..10) | ForEach-Object {Set-ExcelColumn -Worksheet $ws -Column $_ -Hide }
(5..10) | ForEach-Object { Set-ExcelColumn -Worksheet $ws -Column $_ -Hide }

#Use conditional formatting to make Failures red, and Successes green (skipped remains black ) ... and save
$endRow = $ws.Dimension.End.Row
Expand Down
Loading