Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions __checks__/block-unnecessary-requests.check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* To learn more about Playwright Test visit:
* https://www.checklyhq.com/docs/browser-checks/playwright-test/
* https://playwright.dev/docs/writing-tests
*/

const { test } = require("@playwright/test")

const DIMENSIONS = [
{ width: 1920, height: 1080, name: "large" },
{ width: 1000, height: 800, name: "middle" },
{ width: 600, height: 800, name: "small" },
]

test.describe("emulate different viewport sizes", () => {
// Iterate over defined dimensions
for (const { name, width, height } of DIMENSIONS) {
test("take screenshot on " + name + " viewport", async ({ page }) => {
// Change checklyhq.com to your site's URL,
// or, even better, define a ENVIRONMENT_URL environment variable
// to reuse it across your browser checks
await page.setViewportSize({
height,
width,
})

await page.goto(
process.env.ENVIRONMENT_URL || "https://www.checklyhq.com/"
)

await page.screenshot({
path: `${name}.png`,
})
})
}
})