-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from clickoneagencia/ci
Configure validations using CI
- Loading branch information
Showing
8 changed files
with
218 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Automation Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
pages: write | ||
|
||
jobs: | ||
build-and-test: | ||
name: Automation for agencia-clickone | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
with: | ||
path: automation | ||
- name: Run automation tests | ||
run: | | ||
cd automation | ||
ls -la | ||
./run_tests.sh -S ${{ env.INPUT_SRC }} | ||
env: | ||
INPUT_SRC: automation | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: github-pages | ||
path: automation/results/ | ||
|
||
deploy: | ||
needs: build-and-test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM python:3.11.9-slim | ||
|
||
ENV PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python3.11/site-packages:/usr/lib/python3.11/site-packages:/app" | ||
ENV FORCE_COLOR true | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_CACHE_DIR="/cache/pip" | ||
|
||
USER root | ||
WORKDIR /app | ||
RUN ["/bin/bash", "-c", "mkdir -p /app"] | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends build-essential gnupg2 libnss3 libxss1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libnspr4 libxcomposite1 libxdamage1 libxfixes3 xvfb make gcc git curl wget unzip && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/ | ||
|
||
# Download and install Docker binaries | ||
RUN curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz -o /tmp/docker.tgz && \ | ||
tar --extract --file /tmp/docker.tgz --strip-components=1 --directory /usr/local/bin/ && \ | ||
rm /tmp/docker.tgz | ||
|
||
# Install containerd (optional, if not included in the Docker binaries) | ||
RUN curl -fsSL https://github.com/containerd/containerd/releases/download/v1.4.11/containerd-1.4.11-linux-amd64.tar.gz -o /tmp/containerd.tgz && \ | ||
tar --extract --file /tmp/containerd.tgz --strip-components=1 --directory /usr/local/bin/ && \ | ||
rm /tmp/containerd.tgz | ||
|
||
RUN curl https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.61/linux64/chrome-linux64.zip --output chrome-linux64.zip | ||
RUN unzip chrome-linux64.zip | ||
RUN mv chrome-linux64 /chrome | ||
RUN ln -s /chrome/chrome /usr/bin/google-chrome | ||
RUN chown root:root /usr/bin/google-chrome | ||
RUN chmod +x /usr/bin/google-chrome | ||
RUN rm chrome-linux64.zip | ||
|
||
RUN curl https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.61/linux64/chromedriver-linux64.zip --output chromedriver-linux64.zip | ||
RUN unzip chromedriver-linux64.zip | ||
RUN mv chromedriver-linux64/chromedriver /usr/bin/chromedriver | ||
RUN chown root:root /usr/bin/chromedriver | ||
RUN chmod +x /usr/bin/chromedriver | ||
RUN rm chromedriver-linux64.zip | ||
|
||
# Set environment variables | ||
ENV DISPLAY=:99 | ||
|
||
# Start Xvfb and keep the container running | ||
CMD ["sh", "-c", "Xvfb :99 -screen 0 1024x768x16 & robot --outputdir /opt/robotframework/reports /opt/robotframework/tests"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
*** Settings *** | ||
Documentation Contact Form | ||
Library SeleniumLibrary | ||
Library Process | ||
|
||
*** Variables *** | ||
${BROWSER} chrome | ||
|
||
*** Test Cases *** | ||
Verify contact form for ClickOne - Google Chrome | ||
Verify contact form for ClickOne | ||
[Documentation] This test case verifies the contact form | ||
[Tags] Functional | ||
Open Browser https://agenciaclickone.com/ chrome | ||
${chrome_options}= Create Chrome Options | ||
Open Browser https://agenciaclickone.com/ ${BROWSER} options=${chrome_options} | ||
Input Text //*[@id="form-field-name"] John Doe | ||
Input Text //*[@id="form-field-email"] [email protected] | ||
Input Text //*[@id="form-field-message"] 30000000 | ||
Click Element //*[@id="form-field-Aceptolapoliticadeprivacidad"] | ||
Click Button //*[@id="colophon"]/div/div/div/div/section[1]/div[2]/div/div[2]/div/div/div/div/form/div/div[5]/button | ||
Wait Until Page Contains Gracias por contactarnos 15 | ||
Close Browser | ||
|
||
Verify contact form for ClickOne - Forefox | ||
[Documentation] This test case verifies the contact form | ||
[Tags] Functional | ||
Open Browser https://agenciaclickone.com/ firefox | ||
Input Text //*[@id="form-field-name"] John Doe | ||
Input Text //*[@id="form-field-email"] [email protected] | ||
Input Text //*[@id="form-field-message"] 30000000 | ||
Click Element //*[@id="form-field-Aceptolapoliticadeprivacidad"] | ||
Click Button //*[@id="colophon"]/div/div/div/div/section[1]/div[2]/div/div[2]/div/div/div/div/form/div/div[5]/button | ||
Wait Until Page Contains Gracias por contactarnos 15 | ||
Close Browser | ||
[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} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3' | ||
|
||
services: | ||
nextjs-app: | ||
container_name: clickone-automation | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ./:/app | ||
command: robot -d results /app/Tests | ||
restart: always |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
appdirs==1.4.4 | ||
attrs==23.2.0 | ||
beautifulsoup4==4.12.3 | ||
certifi==2024.6.2 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
grpcio==1.63.0 | ||
grpcio-tools==1.63.0 | ||
h11==0.14.0 | ||
idna==3.7 | ||
lxml==5.2.2 | ||
outcome==1.3.0.post0 | ||
overrides==7.7.0 | ||
packaging==24.1 | ||
protobuf==5.26.1 | ||
PySocks==1.7.1 | ||
python-dotenv==1.0.1 | ||
requests==2.32.3 | ||
robotframework==7.0.1 | ||
robotframework-assertion-engine==3.0.3 | ||
robotframework-browser==18.5.1 | ||
robotframework-pythonlibcore==4.4.1 | ||
robotframework-seleniumlibrary==6.4.0 | ||
selenium==4.21.0 | ||
sniffio==1.3.1 | ||
sortedcontainers==2.4.0 | ||
soupsieve==2.5 | ||
tqdm==4.66.4 | ||
trio==0.25.1 | ||
trio-websocket==0.11.1 | ||
typing_extensions==4.12.2 | ||
urllib3==2.2.1 | ||
wrapt==1.16.0 | ||
wsproto==1.2.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
while getopts "I:S:" flag | ||
do | ||
case "${flag}" in | ||
S) INPUT_SRC=${OPTARG};; | ||
I) INSTALL_PACKAGES=${OPTARG};; | ||
*) echo "${OPTARG} is an invalid parameter";; | ||
esac | ||
done | ||
|
||
SRC=${INPUT_SRC:=""} | ||
INSTALL_PACKAGES=true | ||
RUN_COMMAND="cd /app/$SRC" | ||
|
||
if [ "$INSTALL_PACKAGES" = true ] ; then | ||
UPDATE_PACKAGE_MANAGER_CMD="python3.11 -m pip install --upgrade pip" | ||
INSTALLATION_PACKAGES_CMD="pip3.11 install -r requirements.txt" | ||
RUN_COMMAND="${RUN_COMMAND}; ${UPDATE_PACKAGE_MANAGER_CMD}; ${INSTALLATION_PACKAGES_CMD}" | ||
fi | ||
|
||
RUN_COMMAND="${RUN_COMMAND}; robot -d results Tests" | ||
|
||
# exit when any command fails | ||
set -e | ||
|
||
docker run -i --name automation_tests --rm \ | ||
-v $(pwd):/app/automation \ | ||
-v $(pwd)/ci-cache/py/3.11/cache:/cache/pip \ | ||
clickoneagencia/automation \ | ||
/bin/sh -c "$RUN_COMMAND" |