Merge pull request #86 from ERNI-Academy/feature/allure-report #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run-web-tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
driver_type: | ||
required: true | ||
type: string | ||
test_results_path: | ||
required: true | ||
type: string | ||
environment: | ||
required: true | ||
type: string | ||
jobs: | ||
web-tests: | ||
strategy: | ||
matrix: | ||
os: ${{fromJson(inputs.environment)}} | ||
browser: ${{fromJson(inputs.driver_type)}} | ||
fail-fast: false | ||
name: Run WEB (${{ matrix.browser }}) tests - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
- uses: LexisNexis-Public-GHA/sbs-action-download-artifact@v2.13.1 | ||
with: | ||
workflow: CI.yml | ||
name: testing-artifact-selenium-web | ||
- name: Run git init | ||
run: git init | ||
- name: Get Driver path by browser | ||
run: | | ||
switch ( "${{ matrix.browser }}".ToLower() ) | ||
{ | ||
"chrome" { $driverPathRaw = "$env:CHROMEWEBDRIVER" } | ||
"firefox" { $driverPathRaw = "$env:GeckoWebDriver" } | ||
"edge" { $driverPathRaw = "$env:EdgeWebDriver" } | ||
"internetexplorer" { $driverPathRaw = "$env:IEWebDriver" } | ||
} | ||
echo "driverPathRaw=$driverPathRaw" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append | ||
shell: pwsh | ||
- name: config replacement | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: '.\TestConfiguration.Web.json' | ||
env: | ||
Configurations.0.Capabilities.0.Path: ${{ env.driverPathRaw }} | ||
Configurations.0.Capabilities.0.Driver: ${{ matrix.browser }} | ||
Configurations.1.Capabilities.0.Driver: ${{ matrix.browser }} | ||
Configurations.1.Capabilities.0.Path: ${{ env.driverPathRaw }} | ||
Configurations.1.Capabilities.1.Driver: ${{ matrix.browser }} | ||
Configurations.1.Capabilities.1.Path: ${{ env.driverPathRaw }} | ||
Configurations.1.Capabilities.2.Driver: ${{ matrix.browser }} | ||
Configurations.1.Capabilities.2.Path: ${{ env.driverPathRaw }} | ||
TestResultPath: ${{ inputs.test_results_path }} | ||
- name: Read configuration | ||
id: config_file | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: '.\TestConfiguration.Web.json' | ||
- name: Echo configuration.json | ||
run: echo "${{ steps.config_file.outputs.content }}" | ||
- name: Run tests | ||
run: dotnet test TestWare.Samples.Selenium.Web.dll --logger "trx;LogFileName=results.trx" --results-directory "${{ inputs.test_results_path }}" | ||
- name: Archive WEB (${{ matrix.browser }}) screenshots | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: web-${{ matrix.browser }}-screenshots | ||
path: | | ||
${{ inputs.test_results_path }} | ||
- name: Archive Testing artifacts - Allure | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: allure-results-web | ||
path: '.\allure-results' | ||
- name: Test Report | ||
uses: dorny/test-reporter@v1 | ||
if: success() || failure() | ||
with: | ||
name: Report - WEB (${{ matrix.browser }} - ${{ matrix.os }}) | ||
path: ${{ inputs.test_results_path }}/results.trx | ||
reporter: dotnet-trx | ||
allure-results: | ||
uses: ./.github/workflows/Allure_Report.yml | ||
with: | ||
artifact_name: 'allure-results-web' | ||
workflow: 'Run_web_tests.yml' |