Skip to content

Commit

Permalink
Update ExecutingTestsOnWindowsGithubActions5.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
raczeja authored Dec 4, 2024
1 parent ead1d98 commit 129b39a
Showing 1 changed file with 39 additions and 42 deletions.
81 changes: 39 additions & 42 deletions scripts/ExecutingTestsOnWindowsGithubActions5.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 129b39a

Please sign in to comment.