Skip to content

Instantly share code, notes, and snippets.

@checklyalex
checklyalex / playwright_page_crawler.js
Last active May 17, 2023 12:08
This JavaScript script navigates to a given webpage, checks all links, and logs their status. It handles redirections, reporting the final URL and its HTTP status code.
const { test, expect } = require('@playwright/test');
const crawl_url = "https://checklyhq.com";
test('Check all links on a page', async ({ page }) => {
test.setTimeout(120000)
// Navigate to the URL
await page.goto(crawl_url); // Replace with your URL
// Get all links on the page
@checklyalex
checklyalex / upload_image_to_s3_bucket.js
Created March 24, 2023 15:11
A Checkly Playwright/Test script to upload a screenshot to S3.
const { expect, test } = require('@playwright/test')
const aws4 = require('aws4')
const axios = require('axios').default
const S3_BUCKET_NAME = 'xxx';
const S3_OBJECT_KEY = '/image.jpg'; // The name you want to give to the uploaded image file
const AWS_REGION = 'eu-west-2'
test('visit page and take screenshot', async ({ page }) => {
const response = await page.goto(process.env.ENVIRONMENT_URL || 'https://checklyhq.com')