yml edited for chrome+tests #50
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: E2E Tests | |
on: | |
push: | |
branches: | |
- units_piatachenko | |
pull_request: | |
branches: | |
- sumdu.edu.ua | |
- units_piatachenko | |
jobs: | |
e2e-tests: | |
runs-on: ubuntu-latest # Use Linux environment | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Java 19 | |
- name: Set up Java 19 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '19' | |
# Step 3: Install Chrome and necessary libraries | |
- name: Install Chrome and dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y google-chrome-stable | |
sudo apt-get install -y libnss3 libgconf-2-4 fonts-liberation # Install additional libraries | |
sudo apt-get install -y xvfb # Install X virtual framebuffer | |
# Step 4: Install dependencies without running tests | |
- name: Install dependencies without tests | |
run: mvn install -DskipTests | |
# Step 5: Package the JAR | |
- name: Package the JAR | |
run: mvn clean package -DskipTests | |
# Step 6: Verify JAR file exists | |
- name: Verify JAR file | |
run: | | |
ls -al target/ | |
if [ ! -f target/universe.jar ]; then # Corrected the JAR file name here | |
echo "JAR file not found!" | |
exit 1 | |
fi | |
# Step 7: Start Javalin Application from the JAR | |
- name: Start Javalin Application | |
run: | | |
java -jar target/universe.jar & # Removed application.properties as discussed | |
# Step 8: Start Xvfb | |
- name: Start Xvfb | |
run: | | |
Xvfb :99 -ac & | |
export DISPLAY=:99 | |
# Step 9: Wait for the application to start | |
- name: Wait for the application to start | |
run: sleep 30 | |
# Step 10: Run Cucumber + Selenium tests | |
- name: Run Cucumber + Selenium tests | |
run: mvn test | |
# Step 11: Archive test results | |
- name: Archive test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: | | |
target/surefire-reports | |
results/ |