From d1c611a76bf2b07b92b3a1b9d6b83c4d806292cd Mon Sep 17 00:00:00 2001 From: Juliana Rossi Date: Mon, 20 Nov 2023 11:36:48 -0300 Subject: [PATCH] 08 criando workflow github actions --- .github/workflows/github-actions-demo.yml | 34 +++++++++++++++++++++++ Dockerfile | 27 ++++++++++++++++++ README.md | 5 +++- resources/config/chromesync.py | 2 ++ resources/config/edgesync.py | 3 +- resources/config/firefoxsync.py | 1 + 6 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/github-actions-demo.yml create mode 100644 Dockerfile diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..53202fb --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,34 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions-1: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." + + Explore-GitHub-Actions-2: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + echo "Listando os arquivos do meu diretorio" + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a5f1bb3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Passo 01: Instancio uma imagem de SO linux, no caso usei o FEDORA, +# mas pode ser o Ubunto, Alpine, Debian, etc... +# Procure no Docker Hub a imagem que desejar! https://hub.docker.com +FROM fedora:29 + +# Passo 02: Vou mapear os volumes (diretórios do container) onde deixarei +# os testes (inputs) e os resultados (outputs). +VOLUME /opt/robotframework/results +VOLUME /opt/robotframework/tests + +# Passo 03: Vou rodar os comandos que instalam tudo que preciso para rodar o robot +# nesse container linux. Como estou usando o FEDORA, os comandos aqui executados +# devem ser compatíveis com ele!! +RUN dnf upgrade -y && dnf install -y python37 + +# Passo 04: Instalo o Robot e as libraries que precisarei. No caso abaixo, +# especifiquei a versão do robot que eu quero e não especifiquei a da +# library Faker, com isso ele pegara a mais recente liberada. +# Obs.: As barras são para indicar quebra de linha, mas o comando é um só, +# é como se eu tivesso rodando tudo numa linha só. +RUN pip3 install \ +robotframework \ +robotframework-faker \ +robotframework-requests==0.5.0 \ +robotframework-seleniumlibrary \ +robotframework-databaselibrary \ +robotframework-sshlibrary==3.2.1 diff --git a/README.md b/README.md index 25a8626..8de0026 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Web test project using the robot framework tool ## INSTALLATION +If you already have Python with pip installed, you can simply run: + ```bash pip install -r .\requirements.txt ``` @@ -17,7 +19,8 @@ Web test project using the robot framework tool - tests: Contains test files organized by test type and by page. Within each test file, Page Object classes and keywords defined in resource files are used. -- requirements.txt: File that contains project dependencies and their versions. Installation: pip install -r requirements.txt +- requirements.txt: File that contains project dependencies and their versions. Installation: + ## AUTHORS diff --git a/resources/config/chromesync.py b/resources/config/chromesync.py index 34e22c9..c78c389 100644 --- a/resources/config/chromesync.py +++ b/resources/config/chromesync.py @@ -9,4 +9,6 @@ def get_chromedriver_path(): driver = webdriver.Chrome(service=ChromeService(driver_path)) print(f'Driver name: {driver.name}') + driver.quit + return driver_path \ No newline at end of file diff --git a/resources/config/edgesync.py b/resources/config/edgesync.py index 9a6712b..82eb170 100644 --- a/resources/config/edgesync.py +++ b/resources/config/edgesync.py @@ -8,5 +8,6 @@ def get_edgedriver_path(): driver = webdriver.Edge(service=EdgeService(driver_path)) print(f'Driver name: {driver.name}') - + driver.close + return driver_path diff --git a/resources/config/firefoxsync.py b/resources/config/firefoxsync.py index 6f11406..68ca00b 100644 --- a/resources/config/firefoxsync.py +++ b/resources/config/firefoxsync.py @@ -8,5 +8,6 @@ def get_firefoxdriver_path(): driver = webdriver.Firefox(service=FirefoxService(driver_path)) print(f'Driver name: {driver.name}') + driver.quit return driver_path