Skip to content

Merge pull request #173 from ismail-elshafeiy/testing2 #343

Merge pull request #173 from ismail-elshafeiy/testing2

Merge pull request #173 from ismail-elshafeiy/testing2 #343

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: CI Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
browser:
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, windows-latest, macOS-12 ]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: '16'
- name: Set up Selenium Grid with one hub and four Chrome nodes
if: runner.os == 'Linux'
run: docker-compose -f src/main/resources/docker-compose.yml up --scale chrome=4 --remove-orphans -d
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
- name: Check running containers
if: runner.os == 'Linux'
run: docker ps
- name: Run tests on Linux/MacOS
if: runner.os != 'Windows'
continue-on-error: true
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
mvn test -Dtest="web.elementActions.**" -DexecutionType="Local" -DbrowserType="Chrome" -Dheadless="true"
elif [ "$RUNNER_OS" == "macOS" ]; then
mvn test -Dtest="web.elementActions.**" -DexecutionType="Local" -DbrowserType="Chrome" -Dheadless="true"
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Run tests on Windows
if: runner.os == 'Windows'
continue-on-error: true
run: |
mvn test -Dtest="web.elementActions.**" -Dexecution.type="Local" -Dbrowser.type="Edge" -Dheadless="true"
- name: Upload Allure Report as Pipeline Artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }} - Desktop Browsers Tests Allure Report HTML
path: "allure-report/index.html"
- name: Upload Extent Report as Pipeline Artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }} - Desktop Browsers Tests Extent Report HTML
path: "ExtentReport/ExtentReports.html"
# - name: Get Allure history
# uses: actions/checkout@v4
# if: always()
# continue-on-error: true
# with:
# ref: gh-pages
# path: gh-pages
# - name: Generate Allure Report with history
# uses: simple-elf/allure-report-action@master
# if: always()
# id: allure-report
# with:
# allure_results: target/allure-results
# gh_pages: gh-pages
# allure_report: allure-report
# allure_history: allure-history
# subfolder: allure
# - name: Deploy Allure report to Github Pages
# uses: peaceiris/[email protected]
# with:
# personal_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: allure-history/allure
# destination_dir: allure
# publish_branch: gh-pages
# - name: Post the link to the Allure report
# if: always()
# continue-on-error: true
# uses: Sibz/[email protected]
# with:
# authToken: ${{secrets.GITHUB_TOKEN}}
# context: 'Allure Test Execution Report'
# state: 'success'
# sha: ${{ github.event.pull_request.head.sha }}
# target_url: https://github.com/ismailElshafeiy/TestAutomation_JAVA/allure/${{ github.run_number }}