From 8b2bcc0a4ad9abda61983067bcdb9fd0601b9f7a Mon Sep 17 00:00:00 2001 From: Jakub Raczek Date: Wed, 22 Jan 2025 07:58:33 +0100 Subject: [PATCH] selenium hub on docker (#509) * added docker hub * fixed path * fixed * fixed TestResults * fixed * rebuild * fix path * added build * fixed * fixed path * fixed build issue * fixed --------- Co-authored-by: Jakub Raczek --- .github/workflows/github-actions.yml | 178 ++++++++++-------- .../ExecutingTestsOnWindowsGithubActions1.ps1 | 8 +- .../ExecutingTestsOnWindowsGithubActions2.ps1 | 14 +- .../ExecutingTestsOnWindowsGithubActions3.ps1 | 8 +- .../ExecutingTestsOnWindowsGithubActions4.ps1 | 8 +- .../ExecutingTestsOnWindowsGithubActions5.ps1 | 78 +------- .../ExecutingTestsOnWindowsGithubActions6.ps1 | 6 +- 7 files changed, 135 insertions(+), 165 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 3337141b..c1ba702c 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -87,16 +87,6 @@ jobs: with: path: ./OcarambaLite/bin/Release/OcarambaLite.${{ env.frameworkVersion }}.snupkg name: OcarambaLiteS${{ env.frameworkVersion }} - - shell: cmd - run: | - 7z a -mx9 -spf2 "OcarambaBuild.zip" ".\**\bin\**" -xr!*.nupkg -xr!*.snupkg - 7z a -mx9 -spf2 "OcarambaBuild.zip" ".\scripts\**" -xr!*.nupkg -xr!*.snupkg - - uses: actions/upload-artifact@v4 - with: - path: OcarambaBuild.zip - name: OcarambaBuild - compression-level: 0 - if: (${{ job.status }} != 'cancelled') test_Stage_RunTestsOnDocker: runs-on: ubuntu-latest steps: @@ -214,16 +204,26 @@ jobs: check_name: test_Stage_RunTestsOnLinuxBrowserStack test_Stage_RunTestsOnWindowsCore1: runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 + - shell: powershell + run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln''' + - name: Setup nuget + uses: nuget/setup-nuget@v2 with: - name: OcarambaBuild - - shell: cmd - run: | - 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions1.ps1 + nuget-version: latest + - name: Cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files + restore-keys: | + ${{ runner.os }}-nuget- + - name: NuGet restore + run: nuget restore ${{ env.solution }} + - run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal + - run: ./scripts/ExecutingTestsOnWindowsGithubActions1.ps1 - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/windows@v2 if: always() @@ -231,7 +231,7 @@ jobs: files: ${{ env.TestResultsDirWindows }}\*.trx check_name: ExecutingTestsOnWindowsGithubActionsCore1 - name: Zip artifact - run: Compress-Archive -Path D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnitExtentReports\bin\Release\net8.0\TestOutput -Destination ExtentReports_${{ github.run_id }}.zip + run: Compress-Archive -Path .\Ocaramba.Tests.NUnitExtentReports\bin\Release\net8.0\TestOutput -Destination ExtentReports_${{ github.run_id }}.zip - uses: actions/upload-artifact@v4 with: path: ExtentReports_${{ github.run_id }}.zip @@ -239,15 +239,26 @@ jobs: if: always() test_Stage_RunTestsOnWindowsCore2: runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 + - shell: powershell + run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln''' + - name: Setup nuget + uses: nuget/setup-nuget@v2 with: - name: OcarambaBuild - - shell: cmd - run: 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions2.ps1 + nuget-version: latest + - name: Cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files + restore-keys: | + ${{ runner.os }}-nuget- + - name: NuGet restore + run: nuget restore ${{ env.solution }} + - run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal + - run: ./scripts/ExecutingTestsOnWindowsGithubActions2.ps1 - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/windows@v2 if: always() @@ -257,15 +268,26 @@ jobs: check_name: ExecutingTestsOnWindowsGithubActionsCore2 test_Stage_RunTestsOnWindowsFramework: runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 + - shell: powershell + run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln''' + - name: Setup nuget + uses: nuget/setup-nuget@v2 + with: + nuget-version: latest + - name: Cache + uses: actions/cache@v4 with: - name: OcarambaBuild - - shell: cmd - run: 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions3.ps1 + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files + restore-keys: | + ${{ runner.os }}-nuget- + - name: NuGet restore + run: nuget restore ${{ env.solution }} + - run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal + - run: ./scripts/ExecutingTestsOnWindowsGithubActions3.ps1 - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/windows@v2 if: false @@ -274,15 +296,26 @@ jobs: check_name: ExecutingTestsOnWindowsGithubActionsNet3 test_Stage_RunTestsOnWindowsBrowserStack: runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 + - shell: powershell + run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln''' + - name: Setup nuget + uses: nuget/setup-nuget@v2 with: - name: OcarambaBuild - - shell: cmd - run: 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions4.ps1 + nuget-version: latest + - name: Cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files + restore-keys: | + ${{ runner.os }}-nuget- + - name: NuGet restore + run: nuget restore ${{ env.solution }} + - run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal + - run: ./scripts/ExecutingTestsOnWindowsGithubActions4.ps1 env: MAPPED_ENV_BROWSERSTACKKEY: ${{ secrets.BROWSERSTACKKEY }} MAPPED_ENV_BROWSERSTACKUSER: ${{ secrets.BROWSERSTACKUSER }} @@ -292,53 +325,50 @@ jobs: MAPPED_ENV_SAUCELABSUSERNAME: ${{ secrets.saucelabsusername }} - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/windows@v2 - if: always() + if: false with: files: ${{ env.TestResultsDirWindows }}\*.xml check_name: ExecutingTestsOnWindowsGithubActionsBrowserStack4 test_Stage_RunTestsSeleniumGrid: - runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows + runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v4 - with: - name: OcarambaBuild - - shell: cmd - run: 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - name: Set up JDK - uses: actions/setup-java@v4.6.0 - with: - distribution: 'zulu' - java-version: '21' - - shell: powershell - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions5.ps1 - - uses: actions/upload-artifact@v4 - with: - path: ./console_hub.out - name: hub - - uses: actions/upload-artifact@v4 - with: - path: ./console_hub.err - name: huberr + - uses: actions/checkout@v4 + - run: | + ls + export ASPNETCORE_ENVIRONMENT=Linux + echo $ASPNETCORE_ENVIRONMENT + sed -i '/Documentation/,+5 d' ./Ocaramba.sln + - run: dotnet build ./Ocaramba.sln --configuration ${{ env.buildConfiguration }} + - shell: pwsh + run: ./scripts/ExecutingTestsOnWindowsGithubActions5.ps1 - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action/windows@v2 + uses: EnricoMi/publish-unit-test-result-action/linux@v2 if: false with: files: | - ${{ env.TestResultsDirWindows }}\*.xml - check_name: ExecutingTestsOnWindowsGithubActionsSeleniumGrid5 + /home/runner/work/**/TestResults/*.xml test_Stage_RunTestsOnWindowsSaucelabs: runs-on: windows-latest - needs: - - build_Stage_BuildTestsOnWindows steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 + - shell: powershell + run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln''' + - name: Setup nuget + uses: nuget/setup-nuget@v2 + with: + nuget-version: latest + - name: Cache + uses: actions/cache@v4 with: - name: OcarambaBuild - - shell: cmd - run: 7z x "OcarambaBuild.zip" -o.\Ocaramba -y -bb0 - - run: ./Ocaramba/ExecutingTestsOnWindowsGithubActions6.ps1 + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files + restore-keys: | + ${{ runner.os }}-nuget- + - name: NuGet restore + run: nuget restore ${{ env.solution }} + - run: dotnet build ./Ocaramba.sln --configuration ${{ env.buildConfiguration }} + - run: ./scripts/ExecutingTestsOnWindowsGithubActions6.ps1 env: MAPPED_ENV_BROWSERSTACKKEY: ${{ secrets.BROWSERSTACKKEY }} MAPPED_ENV_BROWSERSTACKUSER: ${{ secrets.BROWSERSTACKUSER }} diff --git a/scripts/ExecutingTestsOnWindowsGithubActions1.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions1.ps1 index 70bca650..be8f3a1e 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions1.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions1.ps1 @@ -2,11 +2,11 @@ echo '********************************************Executing tests*************** echo '********************************************net8.0 tests********************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Angular\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnitExtentReports\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Angular\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnitExtentReports\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -dotnet vstest D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Angular\bin\Release\net8.0\Ocaramba.Tests.Angular.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.trx" +dotnet vstest .\Ocaramba.Tests.Angular\bin\Release\net8.0\Ocaramba.Tests.Angular.dll .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.trx" echo '********************************************net472 tests********************************************' diff --git a/scripts/ExecutingTestsOnWindowsGithubActions2.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions2.ps1 index 799abbf5..be183ad5 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions2.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions2.ps1 @@ -2,20 +2,20 @@ echo '********************************************Executing tests*************** echo '********************************************net8.0 tests********************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Features\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Xunit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.MsTest\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Features\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Xunit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.MsTest\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.UnitTests\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json -dotnet vstest D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Features\bin\Release\net8.0\Ocaramba.Tests.Features.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Xunit\bin\Release\net8.0\Ocaramba.Tests.Xunit.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.MsTest\bin\Release\net8.0\Ocaramba.Tests.MsTest.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net8.0\Ocaramba.UnitTests.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.xml" +dotnet vstest .\Ocaramba.Tests.Features\bin\Release\net8.0\Ocaramba.Tests.Features.dll .\Ocaramba.Tests.Xunit\bin\Release\net8.0\Ocaramba.Tests.Xunit.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.MsTest\bin\Release\net8.0\Ocaramba.Tests.MsTest.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net8.0\Ocaramba.UnitTests.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.xml" echo '********************************************EdgeChrominum tests********************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToEdgeChromiumDriverDirectory" "EdgeChromium|C:\SeleniumWebDrivers\EdgeDriver" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToEdgeChromiumDriverDirectory" "EdgeChromium|C:\SeleniumWebDrivers\EdgeDriver" -logValues -json -dotnet vstest D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory=Grid)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.EdgeChrominum.xml" +dotnet vstest .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory=Grid)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.EdgeChrominum.xml" if($lastexitcode -ne 0) { diff --git a/scripts/ExecutingTestsOnWindowsGithubActions3.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions3.ps1 index 9e924c7a..b3f5095d 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions3.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions3.ps1 @@ -2,12 +2,12 @@ echo '********************************************Executing tests*************** echo '********************************************net472 tests*********************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Angular\bin\Release\net472" "Ocaramba.Tests.Angular.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472" "Ocaramba.Tests.NUnit.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -.\Ocaramba\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net472" "Ocaramba.UnitTests.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Angular\bin\Release\net472" "Ocaramba.Tests.Angular.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net472" "Ocaramba.Tests.NUnit.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.UnitTests\bin\Release\net472" "Ocaramba.UnitTests.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -dotnet vstest D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Angular\bin\Release\net472\Ocaramba.Tests.Angular.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net472\Ocaramba.Tests.NUnit.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net472\Ocaramba.UnitTests.dll /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.net4.xml" +dotnet vstest .\Ocaramba.Tests.Angular\bin\Release\net472\Ocaramba.Tests.Angular.dll .\Ocaramba.Tests.NUnit\bin\Release\net472\Ocaramba.Tests.NUnit.dll .\Ocaramba.UnitTests\bin\Release\net472\Ocaramba.UnitTests.dll /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.net4.xml" if($lastexitcode -ne 0) diff --git a/scripts/ExecutingTestsOnWindowsGithubActions4.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions4.ps1 index dd8e75f8..a9a408d3 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions4.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions4.ps1 @@ -1,7 +1,7 @@ echo '********************************************CloudProviderCrossBrowser tests********************************************' echo '********************************************BrowserStack tests********************************************' -$filePath = ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\browserstack.yml" +$filePath = ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\browserstack.yml" $fileContent = Get-Content -Path $filePath @@ -10,10 +10,10 @@ $fileContent = $fileContent -replace "BROWSERSTACKKEY", "`$($env:MAPPED_ENV_BROW # Write the updated content back to the file Set-Content -Path $filePath -Value $fileContent -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub" -json -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub" -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json -dotnet vstest D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /Logger:"trx;LogFileName=Ocaramba.Tests.BrowserStack.xml" +dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /Logger:"trx;LogFileName=Ocaramba.Tests.BrowserStack.xml" if($lastexitcode -ne 0) { diff --git a/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 index 17c24ddb..7463bb37 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions5.ps1 @@ -1,85 +1,25 @@ echo '********************************************Downloading Selenium Grid********************************************' -$url = $env:seleniumGridUrl -$grid = $env:seleniumGridVersion -$output = ".\$grid" -$outputLogs = ".\" +docker network create grid -$start_time = Get-Date +docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:latest +docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub --shm-size="2g" -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 selenium/node-chrome:latest -echo url: $url -echo grid: $grid -echo output: $output -echo outputLogs: $outputLogs +$Env:ASPNETCORE_ENVIRONMENT="Linux" -echo "Downloading Selenium Grid from: $($url) to $($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****************************************' - -java --version -$firstIPAddress = Get-NetIPConfiguration | Select-Object -ExpandProperty IPv4Address | Select-Object -First 1 -$firstIPAddress = $firstIPAddress.IPAddress -Write-Output $firstIPAddress -$appHub=Start-Process java -ArgumentList '-jar', $output, 'hub' -RedirectStandardOutput "$outputLogs\console_hub.out" -RedirectStandardError "$outputLogs\console_hub.err" -PassThru - -Start-Sleep -s 5 - -$retryCount = 6 -$delay = 10 -for ($i = 0; $i -lt $retryCount; $i++) { - try { - $response = Invoke-RestMethod -Uri "http://$($firstIPAddress):4444/wd/hub/status" - if ($response.ready) { - Write-Output "Selenium Grid is ready." - break - } - } catch { - Write-Output "Attempt $($i + 1) failed. Retrying in $delay seconds..." - Start-Sleep -Seconds $delay - } -} -if ($i -eq $retryCount) { - Write-Output "Failed to connect to Selenium Grid after $retryCount attempts." -} -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 - -Start-Sleep -s 5 - -echo "Selenium Grid node started" +echo $Env:ASPNETCORE_ENVIRONMENT echo '********************************************Run tests with Selenium Grid ****************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0\" "appsettings.json" "appSettings" "browser|RemoteWebDriverHub" "RemoteWebDriver|http://$($firstIPAddress):4444/wd/hub" -json -logValues +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0\" "appsettings.Linux.json" "appSettings" "browser|RemoteWebDriverHub" "RemoteWebDriver|http://localhost:4444/wd/hub" -json -logValues -dotnet vstest .\Ocaramba\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"TestCategory=Grid" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.NUnitGrid.xml" +dotnet vstest .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"TestCategory=Grid" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.NUnitGrid.xml" echo '*****************************Run CloudProviderCrossBrowser tests with Selenium Grid****************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "http://$($firstIPAddress):4444/wd/hub" -json -logValues - -dotnet vstest .\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\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" - -Stop-Process -Id $appNode.Id - -echo "Stop Selenium Grid hub" +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.Linux.json" "appSettings" "RemoteWebDriverHub" "http://localhost:4444/wd/hub" -json -logValues -Stop-Process -Id $appHub.Id +dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"FullyQualifiedName~Chrome" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.CloudProviderCrossBrowserGrid.xml" if($lastexitcode -ne 0) { diff --git a/scripts/ExecutingTestsOnWindowsGithubActions6.ps1 b/scripts/ExecutingTestsOnWindowsGithubActions6.ps1 index 4c88db44..f33235a1 100644 --- a/scripts/ExecutingTestsOnWindowsGithubActions6.ps1 +++ b/scripts/ExecutingTestsOnWindowsGithubActions6.ps1 @@ -2,11 +2,11 @@ echo '********************************************CloudProviderCrossBrowser test echo '********************************************saucelabs tests********************************************' -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_SAUCELABSUSERNAME):$($env:MAPPED_ENV_SAUCELABSACCESSKEY)@ondemand.us-west-1.saucelabs.com:443/wd/hub" -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_SAUCELABSUSERNAME):$($env:MAPPED_ENV_SAUCELABSACCESSKEY)@ondemand.us-west-1.saucelabs.com:443/wd/hub" -json -.\Ocaramba\set_AppConfig_for_tests.ps1 ".\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.SauceLabsCrossBrowser$($env:BuildVersion)" -logValues -json +.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.SauceLabsCrossBrowser$($env:BuildVersion)" -logValues -json -dotnet vstest .\Ocaramba\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"(FullyQualifiedName!~Iphone)&(FullyQualifiedName!~Android)&(FullyQualifiedName!~Samsung)" /Logger:"trx;LogFileName=Ocaramba.Tests.saucelabsnet8.xml" +dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"(FullyQualifiedName!~Iphone)&(FullyQualifiedName!~Android)&(FullyQualifiedName!~Samsung)" /Logger:"trx;LogFileName=Ocaramba.Tests.saucelabsnet8.xml" if($lastexitcode -ne 0) {