I'm using codeceptjs with puppeteer to test if endpoints of a single page app are up and have the correct content on them. I need to use something like codeceptjs w/ puppeteer since each of the endpoints have to render, because much of the content on the page is retrieved by AJAX requests that would not be triggered if using the regular PHP version of codeception.
I first retrieve a list of the endpoints that I'll be testing via a GET request. Then I loop through them and run some assertions to check if various elements are present. The problem I'm facing is that if some content from one of the endpoints is missing the test fails and immediately exits, so the remaining endpoints are not checked. I need a way to be able to continue checking the remaining endpoints.
Scenario('Test Endpoints From Sitemap', async (I) => {
// get the sitemap
var sitemap = await I.sendGetRequest("url/to/sitemap");
sitemap = JSON.parse(sitemap.raw_body);
for(i = 0; i < sitemap.length; i++){
await I.amOnPage(sitemap[i].url); // load the endpoint
I.seeElement(sitemap[i].element) // check for an element
}
});
Is it possible to not exit a test case immediately with codeceptjs if a failed assertion is reached? If not, could someone please suggest another way to accomplish what I'm trying to do? Thanks