Added testcases and made few changes #12
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: Java Maven Test with ChromeDriver | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Set up JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
# Install Google Chrome | |
- name: Install Google Chrome | |
run: | | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
sudo apt-get update | |
sudo apt-get install google-chrome-stable -y | |
# Get Chrome version and install ChromeDriver | |
- name: Install ChromeDriver | |
run: | | |
CHROME_VERSION=$(google-chrome-stable --version | grep -oP '(?<=Google Chrome )[^ ]+') | |
echo "Detected Chrome Version: $CHROME_VERSION" | |
wget -q -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION%.*}/chromedriver_linux64.zip | |
echo "Downloaded ChromeDriver zip" | |
sudo unzip -o /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ || true | |
echo "Unzipped ChromeDriver" | |
sudo chmod +x /usr/local/bin/chromedriver | |
echo "Changed ChromeDriver permissions" | |
# Build with Maven and run tests | |
- name: Build with Maven and run tests | |
run: mvn clean test |