How to navigate to pages of a website past authentication?

I’d like to use Facebook as my example here. One condition is that the login page for Facebook only accepts GET calls. Knowing this, I’d like to perform a load test on the Marketplace page once you get past the login page.

Let’s say I write the following code to get past the authentication of the login page:

import http from 'k6/http';
import { check } from 'k6';

export default function () {
const res = http.get('https://facebook.com/#/signin/action?email=xxxxx&password=xxxx');

  check(res, {
    'is status 200': (r) => r.status === 200,
    })
}

Up to this point, I’m not quite sure how to navigate to the Marketplace page for a load test of that end point?

@ramenoir

I think after a succesful login you get some Cookies in the response. These cookies will be sent back automatically in the next request to the server, so the server will know who you are, and that you are loged in. So I think you just have to send the get request to the marketplace page with http.get(...)

2 Likes

Hi @ramenoir

As @bandorko mentions if it’s just cookies, k6 will take care of that. Sometimes there are other headers involved, and then you can have a look at:

A good example of debugging similar situations, hopefully.

Cheers!

3 Likes