I’m trying to login from the login page of my site which opens up the next web page. I’m fairly new to k6 so I don’t know if I need and html look up function to find the places to put the login information. I want it to log in and check if it did and then get the next webpage after the login. So far I have this, thanks in advance. I know my script doesn’t even run but it gives you an understanding of what I’m trying to do. More or less a user scenario that I wouldn’t like to use the recording tool for.
import { sleep, group } from "k6";
import http from "k6/http";
export let options = {
maxRedirects: 0,
stages: [
{ duration: "30s", target: 5}, //simulate ramp-up of traffic from 1 to 5 users over 30 seconds
{ duration: "30s", target:5}, // stay at 5 users for 90 seconds
{ duration: "30s", target: 0}, //ramp down to 0 users over 5 seconds
]
};
export default function () {
group('visit page and login', function () {
// load homepage
var url = 'https://socialscape.dev.sociallydetermined.com/login';
var payload = JSON.stringify({
email: 'aaa',
password: 'bbb',
});
var params = {
headers: {
'Content-Type': 'application/json',
},
};
http.post(url, payload, params);
}
check(res, {
'is status 200': (r) => r.status === 200,
});
}