Skip to content

Commit

Permalink
Update tests to create the driver it uses
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybatt committed May 30, 2024
1 parent 30ebe09 commit fceded6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions k6.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function simulateUserLoginTest() {

const params = { headers: { 'Content-Type': 'application/json' } };
let response = http.post(url, payload, params);
check(response, { 'is status 200': (r) => r.status === 200 });
check(response, { 'Fetch Driver Profile': (r) => r.status === 200 });
sleep(1);
}

Expand Down Expand Up @@ -96,9 +96,27 @@ export const options = {
// vus: 2000,
// iterations: 1,
// exec: 'simulateUserLogin'
// }
// }
};

export function setup() {
// Create a driver user
let url = `${ENDPOINT}/driver/create`;
const payload = JSON.stringify({
"username": "jDoe11",
"password": "53%32",
"name": "John Doe",
"phone_number": "1234567890",
"email": "[email protected]",
"max_available_seats": 4,
"licence_plate": "319IRG"
});
const params = { headers: { 'Content-Type': 'application/json' } };
let response = http.post(url, payload, params);
check(response, { 'Sign Up a Driver': (r) => r.status === 201 });

}

export function simulateUserLogin() {
group('User Actions', function () {
simulateUserLoginTest();
Expand Down

0 comments on commit fceded6

Please sign in to comment.