From 37b00623ad6d2d67deb98635ada7a00ca877dfcf Mon Sep 17 00:00:00 2001 From: "checkly[bot]" <54914329+checkly[bot]@users.noreply.github.com> Date: Wed, 15 Mar 2023 21:39:52 +0000 Subject: [PATCH] [Checkly] adds "Browser Check #2" code --- __checks__/browser-check-2.check.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 __checks__/browser-check-2.check.js diff --git a/__checks__/browser-check-2.check.js b/__checks__/browser-check-2.check.js new file mode 100644 index 0000000..bca4ebd --- /dev/null +++ b/__checks__/browser-check-2.check.js @@ -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' }) +})