Verify the URL is returning 200 , 400 or 404

I want to verify that the pages of my websites are returning 200 , 400 or 404.
I know mocking API can be verified but I want to verify the URL itself.
e.g

https://codecept.io/” is returning 200.

How can I do that?

Have you tried using the REST helper? https://codecept.io/helpers/REST/#rest

If you need authentication e.g. via cookies, there are ways to do that, e.g. if you are using puppeteer its possible to copy cookies into requests with onRequest, like in here https://codecept.io/helpers/REST/#example

So for authenticated pages steps would be:
0. configure onRequest to extract auth and put it on request headers

  1. go to website as normal
  2. use REST helper e.g. I.sendGetRequest, you can get the status code by awaiting the response
    const res = await I.sendGetRequest();
    res.status…

Example onRequest that grabs auth cookies using Puppeteer (not sure how to do with other helpers)

      onRequest: async request => {
      let cookies;
      try {
        const puppeteer = codeceptjs.container.helpers("Puppeteer");
        const cookiesObj = await puppeteer.grabCookie();
        if (cookiesObj) {
          cookies = cookiesObj
            .map(c => `${c.name}=${c.value}`)
            .join("; ");
        }
      } catch (e) {
        // dont care
      }
    request.headers = Object.assign(
      {
        Cookie: cookies || ""
      },
      request.headers || {}
    );
  },