Skip to content

BrowserStack Parallel Devices At Time2 #2

BrowserStack Parallel Devices At Time2

BrowserStack Parallel Devices At Time2 #2

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: BrowserStack Parallel Devices At Time2
on:
workflow_dispatch:
inputs:
filter:
description: 'Filter for tests'
required: true
default: '@Smoke and @Automated'
jobs:
test:
runs-on: ubuntu-22.04
container: crowdar/lippia:3.3.0.0-jdk17
environment: Automation
strategy:
matrix:
device:
- "Google Pixel 7 Pro"
- "Xiaomi Redmi Note 11"
- "Huawei P30"
- "Oppo Reno 6"
fail-fast: false # Permite que si un job falla, los otros continúen ejecutándose
env:
BSUSER: ${{ secrets.BSUSER }}
AUTHTOKEN: ${{ secrets.AUTHTOKEN }}
BSDEVICE: ${{ matrix.device }}
BSAPP: ${{ secrets.BSAPP }}
LTM_GENERAL: ${{ secrets.LTM_GENERAL }}
LTM_GENERAL_PASS: ${{ secrets.LTM_GENERAL_PASS }}
steps:
- name: Checkout to the repository
uses: actions/checkout@v4
- name: Configuring JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set Android version based on selected device
run: |
case "${{ matrix.device }}" in
"Google Pixel 7 Pro") echo "BSOS=13" >> $GITHUB_ENV ;;
"Xiaomi Redmi Note 11") echo "BSOS=11" >> $GITHUB_ENV ;;
"Huawei P30") echo "BSOS=9" >> $GITHUB_ENV ;;
"Oppo Reno 6") echo "BSOS=11" >> $GITHUB_ENV ;;
esac
- name: Configure Maven settings
run: |
mkdir -p ~/.m2
echo '<settings>
<mirrors>
<mirror>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>' > ~/.m2/settings.xml
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Checking Maven dependencies
run: mvn dependency:resolve
- name: Setting environment variable
run: echo "COMBINED_FILTER=${{ github.event.inputs.filter }}" >> $GITHUB_ENV
- name: Debugging environment variables
run: |
echo "BSDEVICE: $BSDEVICE"
echo "BSOS: $BSOS"
echo "BSUSER: $BSUSER"
echo "AUTHTOKEN: $AUTHTOKEN"
echo "BSAPP: $BSAPP"
echo "LTM_GENERAL: $LTM_GENERAL"
echo "LTM_GENERAL_PASS: $LTM_GENERAL_PASS"
- name: Running Maven clean test
run: |
echo "Running tests with filter: '$COMBINED_FILTER' on device: '$BSDEVICE' with OS version: '$BSOS'"
mvn clean test -Dcrowdar.cucumber.filter="'$COMBINED_FILTER'" \
-Denv.BSDEVICE="${{ matrix.device }}" \
-Denv.BSOS="$BSOS" \
-DTEST_MANAGER_RUN_NAME="AUTO-${{ matrix.device }}-${{ github.event.inputs.filter }}" \
-DLTM_GENERAL="${{ secrets.LTM_GENERAL }}" \
-DLTM_GENERAL_PASS="${{ secrets.LTM_GENERAL_PASS }}" \
-PBrowserStack -PAndroid -U
shell: bash
- name: Uploading test reports
uses: actions/upload-artifact@v4.3.4
with:
name: test-results-${{ matrix.device }}
path: target/reports/
- name: Uploading HTML test report
uses: actions/upload-artifact@v4.3.4
with:
name: html-report-${{ matrix.device }}
path: target/cucumber-reports/cucumber-html-report/*.html
- name: Uploading surefire test reports
uses: actions/upload-artifact@v4.3.4
with:
name: test-results-surefire-${{ matrix.device }}
path: target/surefire-reports/