Skip to content

Commit

Permalink
feat: Update GitHub Actions workflow to ensure ChromeDriver compatibi…
Browse files Browse the repository at this point in the history
…lity

- Added steps to install Google Chrome dynamically in the CI environment
- Configured dynamic ChromeDriver version matching based on Chrome version
- Addressed compatibility warnings for Selenium tests
- Maintained existing test setup and artifact upload steps
  • Loading branch information
md-sikder committed Nov 22, 2024
1 parent 125defa commit 482ba57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -17,6 +18,20 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt

- name: Install Chrome
run: |
sudo apt-get update
sudo apt-get install -y google-chrome-stable
- name: Install ChromeDriver
run: |
CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+')
DRIVER_VERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION)
wget https://chromedriver.storage.googleapis.com/$DRIVER_VERSION/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
- name: Set environment variable (Test)
run: echo "ENV=test" >> $GITHUB_ENV # Set the default environment to 'test'

Expand Down
5 changes: 3 additions & 2 deletions tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def test_login():
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920x1080")

driver = webdriver.Chrome(options=chrome_options)

# driver = webdriver.Chrome(options=chrome_options)
driver = webdriver.Chrome()
try:
# Initialize the LoginPage object
login_page = LoginPage(driver)
Expand All @@ -26,6 +26,7 @@ def test_login():
base_url = Config.BASE_URL
driver.get(base_url)
logger.info(f"{base_url} url opened successfully")
print(f"{base_url} url opened successfully")

login_page.login(Config.USERNAME, Config.PASSWORD)
# login_page.login("rahulshettyacademy", "learning")
Expand Down

0 comments on commit 482ba57

Please sign in to comment.