-
-
Save tnolet/d3da0d7db33e6cd278b6b9195e3d78be to your computer and use it in GitHub Desktop.
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
// This script logs in, enters the "create API check flow" and tries out the API check debugger. | |
const playwright = require("playwright"); | |
async function run () { | |
const browser = await playwright.chromium.launch(); | |
const page = await browser.newPage(); | |
await page.setViewportSize({width: 1280, height: 694}); | |
await page.goto("https://app.checklyhq.com?utm_source=monitoring", | |
{ | |
waitUntil: "domcontentloaded", | |
} | |
); | |
// Wait for Auth0 Universal Login to load | |
await page.waitForSelector(".auth0-lock-submit"); | |
await page.waitForSelector('input[type="email"]', { | |
visible: true, | |
}); | |
await page.waitForSelector('input[type="password"]', { | |
visible: true, | |
}); | |
// Login to Auth0 | |
await page.fill('input[type="email"]', 'info+replay@checklyhq.com') | |
await page.fill('input[type="password"]', process.env.MY_PASSWORD) | |
await page.click('button[type="submit"]'); | |
// Wait to get back to Checkly | |
await page.waitForNavigation({waitUntil: "domcontentloaded"}); | |
// We are back in Checkly | |
await page.waitForSelector(".home-dash-table"); | |
// Click the new button on the dash | |
await page.waitForSelector("#create-check-button__BV_button_"); | |
await page.click("#create-check-button__BV_button_"); | |
await page.waitForSelector(".add-api-check-button"); | |
await page.click(".add-api-check-button"); | |
await page.waitForSelector(".api-check"); | |
await page.screenshot({path: "create_api_check_screen.png"}); | |
// Add a URL and run adhoc check | |
await page.waitForSelector(".type-ahead-variables"); | |
await page.click(".type-ahead-variables"); | |
await page.type( | |
".type-ahead-variables > input.form-control", | |
"https://google.com" | |
); | |
await page.waitForSelector("#run-request-button"); | |
await page.click("#run-request-button"); | |
// Wait for response and close modal | |
await page.waitForSelector(".response-body"); | |
await page.screenshot({path: "adhoc_check.png"}); | |
await page.click( | |
".modal-content > #run-check-modal__BV_body_ > div > div > .btn" | |
); | |
browser.close(); | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment