Skip to content

Commit

Permalink
Work in progress at e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damarisnicolae committed Sep 20, 2024
1 parent 786f61e commit ca8037c
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 72 deletions.
108 changes: 108 additions & 0 deletions api/e2etests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
version "2"
name: Users testsuite

vars:
sql.url: "damaris:damarisub@(localhost:3306)/users"
api.url: "http://localhost:8080"

testcases:
- name: init db
steps:
- type: sql
driver: mysql
dsn: "{{.sql.url}}"
commands:
- "INSERT INTO `users` (`jobtitle`, `firstname`, `lastname`, `email`, `phone`, `address`, `city`, `country`, `postalcode`, `dateofbirth`, `nationality`, `summary`, `workexperience`, `education`, `skills`, `languages`) VALUES ('Inginer Software', 'Sophye', 'Soph', '[email protected]', '07076965173', 'Str. Zambilelor nr.4', 'Timișoara', 'Romania', '010001', '1990-11-11', 'română')"
- "INSERT INTO `users` (`jobtitle`, `firstname`, `lastname`, `email`, `phone`, `address`, `city`, `country`, `postalcode`, `dateofbirth`, `nationality`, `summary`, `workexperience`, `education`, `skills`, `languages`) VALUES ('Inginer Software', 'Myriam', 'Myr', '[email protected]', '07076965173', 'Str. Zambilelor nr.4', 'Timișoara', 'Romania', '010001', '1990-11-11', 'română')"
- name: GetUsers
steps:
- type: http
method: GET
headers:
Accept: application/json
Content-Type: application/json
url: "{{api.url}}/users"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson ShouldBeArray
- result.bodyjson.users[0] ShouldContainKey ID
- result.bodyjson.users[0] ShouldContainKey Firstname
- result.bodyjson.users[0].ID ShouldBeNumber
- result.bodyjson.users[0].Firstname ShouldBeString
- name: GetUser
steps:
- type: http
method: GET
headers:
Accept: application/json
Content-Type: application/json
url: "{{api.url}}/user"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson ShouldBeArray
- result.bodyjson.user[0] ShouldContainKey ID
- result.bodyjson.user[0] ShouldContainKey Firstname
- result.bodyjson.user[0].ID ShouldBeNumber
- result.bodyjson.user[0].Firstname ShouldBeString
- name: CreateUser
steps:
- type: http
method: POST
url: "{{api.url}}/user"
body: |
{
"Jobtitle": "Developer"
"Firstname": "Christian",
"Lastname": "Ungurean",
"Email": "[email protected]",
"Phone": "07076965173",
"Address": "Str. Zambilelor nr.4",
"City": "Timișoara",
"Country": "România",
"Postalcode": "111111",
"Dateofbirth": "1990-11-11",
"Nationality": "română"
}
headers:
Content-Type: application/json
assertions:
- result.statuscode ShouldEqual 201
- result.bodyjson ShouldContainKey Firstname
- result.bodyjson.Firstname ShouldEqual Christian
- result.bodyjson.Email ShouldEqual "[email protected]"
- name: UpdateUser
steps:
- type: http
method: PUT
url: "{{.url}}/user/1"
body: |
{
"Jobtitle": "Developer"
"Firstname": "Christian",
"Lastname": "Ungurean",
"Email": "[email protected]",
"Phone": "07076965173",
"Address": "Str. Zambilelor nr.4",
"City": "Timișoara",
"Country": "România",
"Postalcode": "111111",
"Dateofbirth": "1990-11-11",
"Nationality": "română"
}
headers:
Content-Type: application/json
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson ShouldContainKey Firstname
- result.bodyjson.Firstname ShouldEqual Christian
- result.bodyjson.Lastname ShouldEqual Ungurean
- result.bodyjson.Email ShouldEqual "[email protected]"
- name: DeleteUser
steps:
- type: http
method: DELETE
url: "{{.url}}/user/1"
headers:
Content-Type: application/json
assertions:
- result.statuscode ShouldEqual 204
71 changes: 0 additions & 71 deletions api/testsuite.yml

This file was deleted.

2 changes: 1 addition & 1 deletion bff/templates/view/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
<a href="/signup" class="signup-button">SIGNUP</a>

</div>
<script src="../static/js/users.js"></script>
<script src="/static/js/users.js"></script>
</body>
</html>

0 comments on commit ca8037c

Please sign in to comment.