Skip to content

Commit d78cefb

Browse files
Merge pull request #5 from lucas-scandido/general-adjustments
[Refactor] General Adjustments
2 parents 4a2d374 + 2ece670 commit d78cefb

File tree

7 files changed

+54
-56
lines changed

7 files changed

+54
-56
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
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)
1+
# ServeRest - Automated Tests
22
Test Automation Project for the application **[ServeRest](https://serverest.dev/)** using **Robot Framework** with **Selenium Library**.
33

4+
![Repo Size](https://img.shields.io/github/repo-size/lucas-scandido/challenge-robot-ambev?label=size&color=blue) [![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)
5+
46
# Prerequisites
5-
1. **[Python](https://www.python.org/downloads/)** version: `>=3.13.1`.
6-
2. **[Robot Framework](https://docs.robotframework.org/docs/getting_started/testing#install-robot-framework)** version: `>=7.2`.
7-
3. **`WebDriver`** version: first, check your browser version and then download the compatible version from the **[Link](https://googlechromelabs.github.io/chrome-for-testing/)**.
7+
[![Python Version](https://img.shields.io/badge/Python-3.13.1-blue)](https://www.python.org/downloads/) [![Robot Framework Version](https://img.shields.io/badge/Robot%20Framework-7.2-blue)](https://docs.robotframework.org/docs/getting_started/testing#install-robot-framework) [![ChromeDriver](https://img.shields.io/badge/ChromeDriver-115.0-blue)](https://googlechromelabs.github.io/chrome-for-testing/)
88

99
📝 On Windows machines, make sure to add [Python ao PATH](https://docs.python.org/3/using/windows.html#the-full-installer) during installation.
1010

1111
# Installation
1212
**1. Clone the repository:**
1313
```
14-
https://github.com/lucas-scandido/challenge-robot-ambev.git
14+
git clone https://github.com/lucas-scandido/challenge-robot-ambev.git
1515
```
1616

1717
**2. Navigate to the directory:**

resources/api/api_common.resource

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,48 @@ ${INVALID_DATA} ${{12345}}
1414

1515
*** Keywords ***
1616
Start Api Session
17-
${headers} Create Dictionary
18-
... accept=application/json
19-
... Content-Type=application/json
20-
Create Session alias=ServeRest
21-
... url=${API_URL} verify=True
22-
... headers=${headers}
17+
${headers}= Create Dictionary
18+
... accept=application/json
19+
... Content-Type=application/json
20+
Create Session alias=ServeRest
21+
... url=${API_URL} verify=True
22+
... headers=${headers}
2323

2424
Close Api Session
2525
Delete All Sessions
2626

2727
Send POST Request
28-
[Arguments] ${url} ${body} ${status_code}
29-
${response} POST On Session
30-
... alias=ServeRest
31-
... url=${url}
32-
... json=${body}
33-
... expected_status=${status_code}
28+
[Arguments] ${url} ${body} ${status_code}
29+
${response}= POST On Session
30+
... alias=ServeRest
31+
... url=${url}
32+
... json=${body}
33+
... expected_status=${status_code}
3434
Set Global Variable ${POST_RESPONSE} ${response.json()}
3535

3636
Send GET Request
37-
[Arguments] ${status_code} ${url} ${id}=${None} ${params}=${None}
38-
${url} Set Variable If '${id}' != 'None' ${url}/${id} ${url}
39-
${response} GET On Session
40-
... alias=ServeRest
41-
... url=${url}
42-
... params=${params}
43-
... expected_status=${status_code}
37+
[Arguments] ${status_code} ${url} ${id}=${None} ${params}=${None}
38+
${url} Set Variable If '${id}' != 'None' ${url}/${id} ${url}
39+
${response}= GET On Session
40+
... alias=ServeRest
41+
... url=${url}
42+
... params=${params}
43+
... expected_status=${status_code}
4444
Set Global Variable ${GET_RESPONSE} ${response.json()}
45-
RETURN ${response}
4645

4746
Send PUT Request
48-
[Arguments] ${url} ${body} ${status_code}
49-
${response} PUT On Session
50-
... alias=ServeRest
51-
... url=${url}
52-
... json=${body}
53-
... expected_status=${status_code}
47+
[Arguments] ${url} ${body} ${status_code}
48+
${response}= PUT On Session
49+
... alias=ServeRest
50+
... url=${url}
51+
... json=${body}
52+
... expected_status=${status_code}
5453
Set Global Variable ${PUT_RESPONSE} ${response.json()}
5554

5655
Send DELETE Request
57-
[Arguments] ${url} ${status_code}
58-
${response} DELETE On Session
59-
... alias=ServeRest
60-
... url=${url}
61-
... expected_status=${status_code}
56+
[Arguments] ${url} ${status_code}
57+
${response}= DELETE On Session
58+
... alias=ServeRest
59+
... url=${url}
60+
... expected_status=${status_code}
6261
Set Global Variable ${DELETE_RESPONSE} ${response.json()}

resources/api/users/users.resource

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ Create User
1313
Send POST Request ${USERS} ${DATA} 201
1414

1515
Update User Data
16-
[Arguments] ${name} ${email} ${password} ${is_admin}
17-
18-
${body} Create Dictionary
19-
... nome=${name}
20-
... email=${email}
21-
... password=${password}
22-
... administrador=${is_admin}
23-
RETURN ${body}
16+
[Arguments] ${name} ${email} ${password} ${is_admin}
17+
${body}= Create Dictionary
18+
... nome=${name}
19+
... email=${email}
20+
... password=${password}
21+
... administrador=${is_admin}
22+
RETURN ${body}
2423

2524
Delete Users
2625
Send DELETE Request ${USERS}/${POST_RESPONSE}[_id] 200

resources/e2e/e2e_common.resource

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Generate User Data
3838
${password} FakerLibrary.Password
3939
${administrator} Set Variable ${is_admin}
4040

41-
${data} Create Dictionary
42-
... nome=${name}
43-
... email=${random_email}
44-
... password=${password}
45-
... administrador=${administrator}
41+
${data}= Create Dictionary
42+
... nome=${name}
43+
... email=${random_email}
44+
... password=${password}
45+
... administrador=${administrator}
4646
Set Global Variable ${DATA} ${data}
4747
RETURN ${DATA}
4848

resources/e2e/signup/signup.resource

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Submit Registration
3939
Alert Success Should Be Displayed
4040
Wait Until Element Is Visible ${ALERT}
4141
Check Element Details ${SUCCESS_MESSAGE} Cadastro realizado com sucesso
42-
${alert_success_color} = Execute Javascript
42+
${alert_success_color}= Execute Javascript
4343
... return window.getComputedStyle(document.querySelector('.alert')).backgroundColor;
4444
Should Be Equal ${alert_success_color} rgb(120, 194, 173)
4545

@@ -52,6 +52,6 @@ Alert Error Should Be
5252
${locator} Set Variable ${ERROR_MESSAGES.replace('{}', "${alerts}[${error}]")}
5353
Check Element Details ${locator} ${alerts}[${error}]
5454
END
55-
${alert_error_color} = Execute Javascript
55+
${alert_error_color}= Execute Javascript
5656
... return window.getComputedStyle(document.querySelector('.alert')).backgroundColor;
5757
Should Be Equal ${alert_error_color} rgb(243, 150, 154)

tests/api/users/get/get_invalid_users.robot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Invalid Administrator As A Number administrador ${{1}} admini
2222

2323
*** Keywords ***
2424
Search Users With Invalid Data
25-
[Arguments] ${key} ${value} ${field} ${expected_message}
26-
${params} Create Dictionary ${key}=${value}
27-
${message} Get fixture users response errors
25+
[Arguments] ${key} ${value} ${field} ${expected_message}
26+
${params}= Create Dictionary ${key}=${value}
27+
${message} Get fixture users response errors
2828
Send GET Request 400 ${USERS} params=${params}
2929
Response Should Contain Message ${GET_RESPONSE} ${field} ${message}[${expected_message}]

tests/api/users/get/get_users.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Search Admin User administrador true
2525

2626
*** Keywords ***
2727
Search Users
28-
[Arguments] ${key} ${value}
29-
${params} Create Dictionary ${key}=${value}
28+
[Arguments] ${key} ${value}
29+
${params}= Create Dictionary ${key}=${value}
3030
Send GET Request 200 ${USERS} params=${params}
3131
Dictionary List Should Contain ${GET_RESPONSE} @{EXPECTED_KEYS}

0 commit comments

Comments
 (0)