I'm using the Playwright library API (not the test runner) to run tests dynamically from an external source. Unfortunately, the library doesn't support web assertions, so I'm here asking - can I do assertions at all?
const result = await page.route("**/*", async (route) => {
const request = route.request();
if (request.url().includes(".m3u8") || request.url().includes(".ts")) {
await route.continue();
const response = await request.response();
if (response?.status() !== 200) {
// how do I error here?
}
}
});
In this case, I could throw an error, but it throws in the context of the page, not my script. What are my options here for getting a web-assertion esque equivalent?
This thread is trying to answer question "How can I perform assertions in the page context when using the Playwright library API?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].