generated from simonjgr/serverlessdays-dublin-new
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from serverlessdays-dublin/checkly/browser-chec…
…k-2_yvy6h [Checkly] adds "Browser Check #2" code
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }) | ||
}) |