Update ui-tests.yml #8
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 UI Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ui-tests: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Install Chrome and dependencies | |
- name: Install Chrome and dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y google-chrome-stable | |
sudo apt-get install -y xvfb | |
# Step 3: Start Xvfb (Virtual Display for GUI Testing) | |
- name: Start Xvfb | |
run: | | |
export DISPLAY=:99 | |
Xvfb :99 -screen 0 1920x1080x16 & | |
sleep 3 | |
# Step 4: Set up Java | |
- name: Set up Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
# Step 5: Cache Maven dependencies | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven | |
# Step 6: Debug Chrome Environment | |
- name: Debug Chrome Environment | |
run: | | |
google-chrome --version | |
ls -la /usr/bin/google-chrome | |
echo $DISPLAY | |
# Step 7: Install Maven dependencies | |
- name: Install Maven dependencies | |
run: mvn install -DskipTests=true | |
# Step 8: Run UI Tests | |
- name: Run UI Tests | |
run: mvn test | |
# Step 9: Upload Test Reports (Optional) | |
- name: Upload Test Reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: target/surefire-reports/ |