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
30 changes: 30 additions & 0 deletions __checks__/test123.check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* This is a basic Playwright script to get you started!
* To learn more about Browser checks and Playwright visit: https://www.checklyhq.com/docs/browser-checks
*/

// Create a Chromium browser
const { chromium } = require('playwright')

// Checkly supports top level await, but we wrap your code in an async function so you can run it locally too.
async function run () {
const browser = await chromium.launch()
const page = await browser.newPage()

// We visit the page. This waits for the "load" event by default.
const response = await page.goto('https://google.com')

// If the page doesn't return a successful response code, we fail the check.
if (response.status() > 399) {
throw new Error(`Failed with response code ${response.status()}`)
}

// We snap a screenshot.
await page.screenshot({ path: 'screenshot.jpg' })

// We close the page to clean up and gather performance metrics.
await page.close()
await browser.close()
}

run()