Skip to content

Commit 0e40d51

Browse files
Merge pull request #3 from lucas-scandido/ci-cd
[CI/CD] Create CI/CD Pipeline
2 parents b2e28b3 + 4fdeeb8 commit 0e40d51

File tree

14 files changed

+98
-37
lines changed

14 files changed

+98
-37
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Robot Framework Tests
2+
3+
on: push
4+
5+
jobs:
6+
api_tests:
7+
name: API Test
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.13'
18+
19+
- name: Install Dependencies
20+
run: pip install -r requirements.txt
21+
22+
- name: Run API Tests
23+
run: robot -d results/api tests/api
24+
25+
- name: Upload API Test Results
26+
uses: actions/upload-artifact@v4
27+
if: always()
28+
with:
29+
name: api-test-results
30+
path: results/api
31+
32+
e2e_tests:
33+
name: E2E Test
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.13'
44+
45+
- name: Install Dependencies
46+
run: pip install -r requirements.txt
47+
48+
- name: Run E2E Tests
49+
run: robot -d results/e2e -v OPTIONS:"add_argument('--headless')" tests/e2e
50+
51+
- name: Upload E2E Test Results
52+
uses: actions/upload-artifact@v4
53+
if: always()
54+
with:
55+
name: e2e-test-results
56+
path: results/e2e

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# ServeRest - Automated Tests
2-
E2E Test Automation Project for the application **[ServeRest](https://serverest.dev/)** using **Robot Framework** with **Selenium Library**.
1+
# ServeRest - Automated Tests [![Robot Framework Tests](https://github.com/lucas-scandido/challenge-robot-ambev/actions/workflows/ci.yml/badge.svg)](https://github.com/lucas-scandido/challenge-robot-ambev/actions/workflows/ci.yml)
2+
Test Automation Project for the application **[ServeRest](https://serverest.dev/)** using **Robot Framework** with **Selenium Library**.
33

44
# Prerequisites
55
1. **[Python](https://www.python.org/downloads/)** version: `>=3.13.1`.
@@ -36,6 +36,9 @@ The project structure was developed based on documentation: [Robot Framework - P
3636

3737
- **Folder Structure:**
3838
```
39+
├── .github/ # GitHub specific configurations, such as workflows and other GitHub Actions.
40+
└── workflows # CI Workflows Folder
41+
└── ci.yml/ # Continuous integration configuration file
3942
├── helpers/ # Helpers needed to run the tests, including fixtures and locators
4043
└── fixtures/ # Static data files used during test execution
4144
└── signup/ # Signup Fixtures
@@ -44,7 +47,7 @@ The project structure was developed based on documentation: [Robot Framework - P
4447
└── response.json # JSON file that stores all response messages returned from the user API
4548
└── locators/ # Locators used to interact with page elements
4649
└── locators.py # Python file containing the mapped locators
47-
├── resources/ # Reusable keywords
50+
├── resources/ # Reusable Keywords
4851
└── api/ # API Keywords
4952
└── users/ # API Users Folder
5053
└── users.resource # API Users Keywords

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ robotframework==7.2
22
robotframework-faker==5.0.0
33
robotframework-jsonlibrary==0.5
44
robotframework-requests==0.9.7
5-
robotframework-seleniumlibrary==6.7.0
5+
robotframework-seleniumlibrary==6.7.0
6+
setuptools>=58.0.0

resources/api/api_common.resource

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Documentation This file contains API common variables and keywords that are
33
... used across all the API test cases.
44
5-
Library RequestsLibrary
5+
Library RequestsLibrary
66

7-
Resource ../../resources/e2e/e2e_common.resource
8-
Resource ../../resources/api/users/users.resource
7+
Resource ../../resources/e2e/e2e_common.resource
8+
Resource ../../resources/api/users/users.resource
99

1010
*** Variables ***
1111
${API_URL} https://serverest.dev

resources/api/users/users.resource

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Library RequestsLibrary
33
Library Collections
44

5-
Resource ../../../resources/api/api_common.resource
5+
Resource ../../../resources/api/api_common.resource
66

77
*** Variables ***
88
${USERS} /usuarios
@@ -26,9 +26,9 @@ Delete Users
2626
Send DELETE Request ${USERS}/${POST_RESPONSE}[_id] 200
2727

2828
Response Should Contain Message
29-
[Arguments] ${response_type} ${field} ${expected_message}
30-
Dictionary Should Contain Item ${response_type} ${field} ${expected_message}
31-
Should Not Be Empty ${expected_message}
29+
[Arguments] ${response_type} ${field} ${expected_message}
30+
Dictionary Should Contain Item ${response_type} ${field} ${expected_message}
31+
Should Not Be Empty ${expected_message}
3232

3333
Dictionary Should Contain
3434
[Arguments] ${response} @{expected_keys}

resources/e2e/e2e_common.resource

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ Resource ../../resources/e2e/signup/signup.resource
1111
Variables ../../helpers/locators/locators.py
1212

1313
*** Variables ***
14+
${OPTIONS} ${None}
1415
${BASE_URL} https://front.serverest.dev
1516
${USER_NAME} Lucas Candido
1617
${USER_EMAIL} beltrano@qa.com.br
1718
${USER_PASSWORD} password2025
1819

1920
*** Keywords ***
2021
Start Session
21-
Open Browser browser=chrome
22+
Open Browser browser=chrome options=${OPTIONS}
2223

2324
Close Session
2425
Close Browser

resources/e2e/signup/signup.resource

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Library SeleniumLibrary
33
Library String
44

5-
Resource ../../../resources/e2e/e2e_common.resource
5+
Resource ../../../resources/e2e/e2e_common.resource
66

77
*** Keywords ***
88
Input Name
@@ -34,7 +34,7 @@ Select User As Admin
3434
END
3535

3636
Submit Registration
37-
Button Action ${SIGNUP_BUTTON}
37+
Button Action ${SIGNUP_BUTTON}
3838

3939
Alert Success Should Be Displayed
4040
Wait Until Element Is Visible ${ALERT}
@@ -45,12 +45,12 @@ Alert Success Should Be Displayed
4545

4646
Alert Error Should Be
4747
[Arguments] ${alerts} ${expected_errors}
48-
Wait Until Element Is Visible ${ALERT}
48+
Wait Until Element Is Visible ${ALERT}
4949
@{errors_list} Split String ${expected_errors} ,
5050
FOR ${error} IN @{errors_list}
51-
${error} Strip String ${error}
52-
${locator} Set Variable ${ERROR_MESSAGES.replace('{}', "${alerts}[${error}]")}
53-
Check Element Details ${locator} ${alerts}[${error}]
51+
${error} Strip String ${error}
52+
${locator} Set Variable ${ERROR_MESSAGES.replace('{}', "${alerts}[${error}]")}
53+
Check Element Details ${locator} ${alerts}[${error}]
5454
END
5555
${alert_error_color} = Execute Javascript
5656
... return window.getComputedStyle(document.querySelector('.alert')).backgroundColor;

tests/api/users/get/get_invalid_users.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Test Teardown Delete Users
1212
Suite Teardown Close Api Session
1313
Test Template Search Users With Invalid Data
1414

15-
*** Test Cases *** KEY VALUE FIELD MESSAGE
15+
*** Test Cases *** KEY VALUE FIELD MESSAGE
1616
Empty Email email ${EMPTY} email emailShouldBeString
1717
Invalid Email email ${INVALID_EMAIL} email invalidEmail
1818
Invalid Email As A Number email ${INVALID_DATA} email emailShouldBeString

tests/api/users/get/get_users.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ Search Admin User administrador true
2626
*** Keywords ***
2727
Search Users
2828
[Arguments] ${key} ${value}
29-
${params} Create Dictionary ${key}=${value}
29+
${params} Create Dictionary ${key}=${value}
3030
Send GET Request 200 ${USERS} params=${params}
31-
Dictionary List Should Contain ${GET_RESPONSE} @{EXPECTED_KEYS}
31+
Dictionary List Should Contain ${GET_RESPONSE} @{EXPECTED_KEYS}

tests/api/users/post/post_invalid_users.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Invalid Administrator As A Number ${USER_NAME} ${USER_EMAIL} ${US
2626
*** Keywords ***
2727
Create User With Invalid Data
2828
[Arguments] ${name} ${email} ${password} ${is_admin} ${field} ${expected_message}
29-
${body} Update User Data ${name} ${email} ${password} ${is_admin}
29+
${body} Update User Data ${name} ${email} ${password} ${is_admin}
3030
${message} Get fixture users response errors
3131
Send POST Request ${USERS} ${body} 400
3232
Response Should Contain Message ${POST_RESPONSE} ${field} ${message}[${expected_message}]

0 commit comments

Comments
 (0)