Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure firefox #2

Merged
merged 7 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
branches:
- main
schedule:
- cron: "0 */3 * * *"
- cron: "0 */6 * * *"
concurrency:
group: automation-${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write
Expand All @@ -17,8 +20,12 @@ permissions:

jobs:
build-and-test:
name: Automation for agencia-clickone
name: Automation
runs-on: ubuntu-latest
strategy:
matrix:
browser: [chrome]
client: [agenciaclickone, fracturasyfracturas]
timeout-minutes: 5

steps:
Expand All @@ -29,12 +36,11 @@ jobs:
- name: Run automation tests
run: |
cd automation
ls -la
./run_tests.sh -S ${{ env.INPUT_SRC }}
./run_tests.sh -S ${{ env.INPUT_SRC }} -B ${{ matrix.browser }} -C ${{ matrix.client }}
env:
INPUT_SRC: automation
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: github-pages
path: automation/results/
# - name: Upload test results
# uses: actions/upload-artifact@v4
# with:
# name: github-pages
# path: automation/results/
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ RUN chown root:root /usr/bin/chromedriver
RUN chmod +x /usr/bin/chromedriver
RUN rm chromedriver-linux64.zip

RUN curl -L -o firefox-127.0.tar.bz2 "https://download.mozilla.org/?product=firefox-127.0&os=linux64&lang=en-US"
RUN tar xjf firefox-127.0.tar.bz2 -C /opt/
RUN ln -s /opt/firefox/firefox /usr/local/bin/firefox

# Download the latest version of geckodriver using curl
ENV GECKODRIVER_VERSION="v0.34.0"
RUN curl -L -o geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz "https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz"
RUN tar -xvzf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz
RUN mv geckodriver /usr/local/bin/

# Set environment variables
ENV DISPLAY=:99

Expand Down
26 changes: 26 additions & 0 deletions Tests/chrome/fracturasyfracturas/IndexView.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*** Settings ***
Documentation Contact Form
Library SeleniumLibrary
Library Process

*** Variables ***
${BROWSER} chrome

*** Test Cases ***
Verify contact form render
[Documentation] This test case verifies
[Tags] Functional

${chrome_options}= Create Chrome Options
Open Browser https://fracturasyfracturas.com.co/ ${BROWSER} options=${chrome_options}
Wait Until Element Is Visible xpath=//*[@id="agenda"]/div/div[1]/div 30s
[Teardown] Close Browser

*** Keywords ***
Create Chrome Options
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${options} add_argument --headless
Call Method ${options} add_argument --disable-gpu
Call Method ${options} add_argument --no-sandbox
Call Method ${options} add_argument --disable-dev-shm-usage
RETURN ${options}
12 changes: 0 additions & 12 deletions docker-compose.yml

This file was deleted.

8 changes: 6 additions & 2 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/usr/bin/env bash

while getopts "I:S:" flag
while getopts "I:S:B:C:" flag
do
case "${flag}" in
B) INPUT_BROWSER=${OPTARG};;
C) INPUT_CLIENT=${OPTARG};;
S) INPUT_SRC=${OPTARG};;
I) INSTALL_PACKAGES=${OPTARG};;
*) echo "${OPTARG} is an invalid parameter";;
esac
done

SRC=${INPUT_SRC:=""}
BROWSER=${INPUT_BROWSER:=""}
CLIENT=${INPUT_CLIENT:=""}
INSTALL_PACKAGES=true
RUN_COMMAND="cd /app/$SRC"

Expand All @@ -19,7 +23,7 @@ if [ "$INSTALL_PACKAGES" = true ] ; then
RUN_COMMAND="${RUN_COMMAND}; ${UPDATE_PACKAGE_MANAGER_CMD}; ${INSTALLATION_PACKAGES_CMD}"
fi

RUN_COMMAND="${RUN_COMMAND}; robot -d results Tests"
RUN_COMMAND="${RUN_COMMAND}; robot -d results Tests/${BROWSER}/${CLIENT}"

# exit when any command fails
set -e
Expand Down
Loading