Skip to content

update workflow

update workflow #30

Workflow file for this run

name: E2E Tests Custom
on:
workflow_dispatch:
inputs:
testsPath:
description: 'Path to Tests to be Executed'
default: ''
browsers:
description: 'Comma-separated list of browsers to execute tests against (e.g., chrome,firefox,edge)'
default: 'all'
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
selected: ${{ steps.process.outputs.selected }}
steps:
- name: Process Browser Input
id: process
run: |
browsers="${{ github.event.inputs.browsers }}"
echo "Selected browsers: $browsers"
echo "::set-output name=selected::$browsers"
- name: Get Latest Allure Version
id: allure_version
shell: pwsh
run: |
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/allure-framework/allure2/releases/latest"
$allure_version = $response.tag_name
echo "Latest Allure version: $allure_version"
echo "::set-output name=version::$allure_version"
- name: Download Allure
shell: pwsh
run: |
$version = "${{ steps.allure_version.outputs.version }}"
Invoke-WebRequest -Uri "https://github.com/allure-framework/allure2/releases/download/$version/allure-$version.zip" -OutFile "allure.zip"
- name: Extract Allure
shell: pwsh
run: |
# Determine the destination path
if ($env:OS -eq "Windows_NT") {
$destinationPath = "$env:ProgramFiles\Allure"
} else {
$destinationPath = "/usr/local/bin/allure"
}
# Ensure the destination directory exists
if (-not (Test-Path -Path $destinationPath)) {
New-Item -ItemType Directory -Path $destinationPath -Force
}
# Extract the archive
Expand-Archive -Path "allure.zip" -DestinationPath $destinationPath
Write-Output "Allure has been extracted to $destinationPath"

Check failure on line 55 in .github/workflows/e2eCustom.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/e2eCustom.yml

Invalid workflow file

You have an error in your yaml syntax on line 55
- name: Add Allure to PATH
shell: pwsh
run: |
# Define a platform-specific program files directory
if ($env:OS -eq "Windows_NT") {
$programFiles = $env:ProgramFiles
} else {
# Use a default path for non-Windows systems
$programFiles = "/usr/local"
}
# Construct the allure path
$allurePath = Join-Path $programFiles "allure/bin"
# Add the allure path to the system PATH
$env:PATH = "$allurePath;$env:PATH"
# Output the updated PATH
Write-Output $env:PATH
- name: Verify Allure Installation
shell: pwsh
run: |
$allurePath = Join-Path $env:ProgramFiles "allure-${{ github.event.inputs.allureVersion }}\bin\allure.bat"
if (Test-Path $allurePath) {
Write-Host "Allure is correctly installed."
} else {
Write-Error "Allure command not found!"
}
E2E_Chrome_Windows_Test:
runs-on: windows-latest
needs: preprocess
if: contains(needs.preprocess.outputs.selected, 'chrome') || contains(needs.preprocess.outputs.selected, 'all')
permissions:
checks: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.6
- name: Run Tests on Chrome
continue-on-error: true
run: mvn test -DtargetBrowserName="chrome" -DexecutionAddress="local" -DtargetOperatingSystem="WINDOWS" -DheadlessExecution="true" -Dtest="${{ github.event.inputs.testsPath }}"
- name: Generate Allure Report
run: allure generate build/allure-results --single-file -o allure-report
- name: Upload Allure Report as Artifact
uses: actions/upload-artifact@v3
with:
name: Allure_Report
path: allure-report/*
# - name: Generate Allure Report
# run: .\allure.bat generate --single-file -o allure-report
# - name: Upload Allure Report as Artifact
# uses: actions/upload-artifact@v3
# with:
# name: Chrome_Windows_Allure
# path: allure-report/*
E2E_Firefox_Windows_Test:
runs-on: windows-latest
needs: preprocess
if: contains(needs.preprocess.outputs.selected, 'firefox') || contains(needs.preprocess.outputs.selected, 'all')
permissions:
checks: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.6
- name: Run Tests on Firefox
continue-on-error: true
run: mvn test -DtargetBrowserName="firefox" -DexecutionAddress="local" -DtargetOperatingSystem="WINDOWS" -DheadlessExecution="true" -Dtest="${{ github.event.inputs.testsPath }}"
E2E_Edge_Windows_Test:
runs-on: windows-latest
needs: preprocess
if: contains(needs.preprocess.outputs.selected, 'edge') || contains(needs.preprocess.outputs.selected, 'all')
permissions:
checks: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.6
- name: Run Tests on Edge
continue-on-error: true
run: mvn test -DtargetBrowserName="microsoftedge" -DexecutionAddress="local" -DtargetOperatingSystem="WINDOWS" -DheadlessExecution="true" -Dtest="${{ github.event.inputs.testsPath }}"
# - name: Generate Allure Report
# run: .\allure.bat generate --single-file -o allure-report
# - name: Upload Allure Report as Artifact
# uses: actions/upload-artifact@v3
# with:
# name: Edge_Windows_Allure
# path: allure-report/*