-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistoricoLista.feature
76 lines (69 loc) · 3.1 KB
/
historicoLista.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Feature: Histórico de lista de compras
Como um usuário com conta no sistema
Desejo consultar minhas últimas listas de compra
Para visualizar minhas últimas compras
Background: Acessa a tela de usuario para alteração de dados
* def emailAleatorio = Date.now() + "@raro.com"
* def emailAleatorioExiste = Date.now() + "[email protected]"
Given url baseUrl
And path "users"
When request {"name": "Romerito","email": "#(emailAleatorioExiste)","password": "1234"}
And method post
And path "users"
When request {"name": "Romerito","email": "#(emailAleatorio)","password": "1234"}
And method post
Given url baseUrl
And path "auth/login"
When request {"email":"#(emailAleatorio)","password": "1234"}
And method post
* def token = response.session.token
Given path "list"
And header X-JWT-Token = token
When request { description: "Supermercado", items: [{ name: "jose duarte", amount: 1}]}
And method post
Scenario: Histórico de listas
And path "list/history"
And header X-JWT-Token = token
When method get
Then status 200
And match response[].tags[].id =="#present"
And match response[].tags[].userId =="#present"
And match response[].tags[].description =="#present"
And match response[].tags[].createdAt =="#present"
And match response[].tags[].updatedAt =="#present"
Scenario: inserir token inválido
And path "list/history"
And header X-JWT-Token = "asfg"
When method get
Then status 401
And match response contains {status: 401, message: "Invalid token."}
@focus
Scenario: Encontra lista inativa por ID
Given path "list"
And header X-JWT-Token = token
When method get
* def idlist = response.listId
And path "list/history"
And header X-JWT-Token = token
And path idlist
When method get
Then status 200
And match response[].tags[].id =="#present"
And match response[].tags[].userId =="#present"
And match response[].tags[].description =="#present"
And match response[].tags[].createdAt =="#present"
And match response[].tags[].updatedAt =="#present"
Scenario: Encontra lista inativa por ID com credenciais inválidas
And path "list/history"
And header X-JWT-Token = "1"
And path "0993dfe0-40bb-45dc-9d97-f85e6807f4ba"
When method get
Then status 401
And match response contains {status:401, message :"Invalid token."}
Scenario: Encontra lista inativa por ID
And path "list/history"
And header X-JWT-Token = token
And path "0993dfe0-40bb-45dc-9d97-f85e6807f4ba"
When method get
Then status 404
And match response contains {error: "List not found."}