Merge pull request #574 from ili101/TestsFix

Fix Test accidentally closing focused window
This commit is contained in:
Doug Finke
2019-04-07 12:50:56 -04:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

1
.gitignore vendored
View File

@@ -61,5 +61,6 @@ testCCFMT.ps1
testHide.ps1
ImportExcel.zip
.vscode/launch.json
.vscode/settings.json
~$*

View File

@@ -51,8 +51,15 @@ Describe "Compare Worksheet" {
Context "Setting the background to highlight different rows, use of grid view." {
BeforeAll {
$useGrid = ($PSVersionTable.PSVersion.Major -LE 5)
$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView:$useGrid
if ($useGrid) {Start-Sleep -sec 5; [System.Windows.Forms.SendKeys]::Sendwait("%{F4}") }
if ($useGrid) {
$ModulePath = (Get-Command -Name 'Compare-WorkSheet').Module.Path
$PowerShellExec = if ($PSEdition -eq 'Core') {'pwsh.exe'} else {'powershell.exe'}
$PowerShellPath = Join-Path -Path $PSHOME -ChildPath $PowerShellExec
. $PowerShellPath -Command ("Import-Module $ModulePath; " + '$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView; Start-Sleep -sec 5')
}
else {
$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView:$useGrid
}
$xl1 = Open-ExcelPackage -Path "$env:temp\Server1.xlsx"
$xl2 = Open-ExcelPackage -Path "$env:temp\Server2.xlsx"
$s1Sheet = $xl1.Workbook.Worksheets[1]