From 129b39ad18c010048d5a1fcd6188d8c6271dca88 Mon Sep 17 00:00:00 2001 From: Jakub Raczek Date: Wed, 4 Dec 2024 09:18:07 +0100 Subject: [PATCH] Update ExecutingTestsOnWindowsGithubActions5.ps1 --- .../ExecutingTestsOnWindowsGithubActions5.ps1 | 81 +++++++++---------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 index d1848d4d..2638a9c9 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 @@ -1,13 +1,10 @@ -echo '********************************************Downloading Selenium Grid********************************************' - +echo '********************************************Downloading Selenium Grid********************************************' + $url = $env:seleniumGridUrl - $grid = $env:seleniumGridVersion - -$output = Join-Path $PSScriptRoot + ".\..\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\$grid" - -$outputLogs = Join-Path $PSScriptRoot ".\..\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\" - +$output = Join-Path $PSScriptRoot "..\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\$grid" +$outputLogs = Join-Path $PSScriptRoot "..\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\" + $start_time = Get-Date echo url: $url @@ -16,56 +13,56 @@ echo output: $output echo outputLogs: $outputLogs echo "Downloading Selenium Grid from: $($url) to $($output)" -Invoke-WebRequest -Uri "$($url)" -Out "$($output)" - +Invoke-WebRequest -Uri "$($url)" -OutFile "$($output)" + echo "Selenium Grid downloaded to:" $output - + echo "Time taken to download $($grid): $((Get-Date).Subtract($start_time).Seconds) second(s)" - -echo '******************************************Start Selenium Grid in background****************************************' - -$appHub=Start-Process java -ArgumentList '-jar', $output' hub' -RedirectStandardOutput $outputLogs'console_hub.out' -RedirectStandardError $outputLogs'console_hub.err' -passthru + +echo '******************************************Start Selenium Grid in background****************************************' + +$appHub=Start-Process java -ArgumentList '-jar', $output, 'hub' -RedirectStandardOutput "$outputLogs\console_hub.out" -RedirectStandardError "$outputLogs\console_hub.err" -PassThru Start-Sleep -s 5 - + echo "Selenium Grid hub started" -$appNode=Start-Process java -ArgumentList '-jar', $output' node --detect-drivers true' -RedirectStandardOutput $outputLogs'console_node.out' -RedirectStandardError $outputLogs'console_node.err' -passthru - +$appNode=Start-Process java -ArgumentList '-jar', $output, 'node --detect-drivers true' -RedirectStandardOutput "$outputLogs\console_node.out" -RedirectStandardError "$outputLogs\console_node.err" -PassThru + Start-Sleep -s 5 - + echo "Selenium Grid node started" - -echo '********************************************Run tests with Selenium Grid ****************************************' - -.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\" "Ocaramba.Tests.NUnit.dll.config" "//appSettings" "browser|RemoteWebDriverHub" "RemoteWebDriver|http://localhost:4444/wd/hub" -logValues - + +echo '********************************************Run tests with Selenium Grid ****************************************' + +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\" "Ocaramba.Tests.NUnit.dll.config" "//appSettings" "browser|RemoteWebDriverHub" "RemoteWebDriver|http://localhost:4444/wd/hub" + dotnet vstest .\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"TestCategory=Grid" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.NUnitGrid.xml" - + echo '*****************************Run CloudProviderCrossBrowser tests with Selenium Grid****************************' - -.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net472" "Ocaramba.Tests.CloudProviderCrossBrowser.dll.config" "//appSettings" "RemoteWebDriverHub" "http://localhost:4444/wd/hub" -logValues - + +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net472" "Ocaramba.Tests.CloudProviderCrossBrowser.dll.config" "//appSettings" "RemoteWebDriverHub" "http://localhost:4444/wd/hub" + dotnet vstest .\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net472\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"FullyQualifiedName~Chrome" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.CloudProviderCrossBrowserGrid.xml" - + if($lastexitcode -ne 0) - { +{ echo 'lastexitcode' $lastexitcode - } +} echo '*****************************Stop Selenium Grid****************************' - -echo "Stop Selenium Grid node" - + +echo "Stop Selenium Grid node" + Stop-Process -Id $appNode.Id - -echo "Stop Selenium Grid hub" - -Stop-Process -Id $appHub.Id + +echo "Stop Selenium Grid hub" + +Stop-Process -Id $appHub.Id if($lastexitcode -ne 0) - { +{ echo 'lastexitcode' $lastexitcode - } - -exit 0 +} + +exit 0