Skip to content

Commit

Permalink
Merge pull request #1 from serverlessdays-dublin/checkly/browser-chec…
Browse files Browse the repository at this point in the history
…k-2_yvy6h

[Checkly] adds "Browser Check #2" code
  • Loading branch information
simonjgr authored Mar 15, 2023
2 parents 9ad03ea + 37b0062 commit d1c91cc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions __checks__/browser-check-2.check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* To learn more about Playwright Test visit:
* https://www.checklyhq.com/docs/browser-checks/playwright-test/
* https://playwright.dev/docs/writing-tests
*/

const { expect, test } = require('@playwright/test')

// Set the action timeout to 10 seconds to quickly identify failing actions.
// By default Playwright Test has no timeout for actions (e.g. clicking an element).
// Learn more here: https://www.checklyhq.com/docs/browser-checks/timeouts/
test.use({ actionTimeout: 10000 })

test('visit page and take screenshot', 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
const response = await page.goto(process.env.ENVIRONMENT_URL || 'https://checklyhq.com')

// Test that the response did not fail
expect(response.status()).toBeLessThan(400)

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

0 comments on commit d1c91cc

Please sign in to comment.