Browser checks allow you to monitor critical parts of your services, using Node.js' Playwright and @playwright/test APIs to run headless browsers for end-to-end testing.
It allows you to automate the Chromium browser using a single simple API. Use the powerful @playwright/test API to automate tests ran periodically. Typescript support.
Access logs for each run, and replay a record or view traces of failed runs. Each run has a time limit of 2 minutes. Make sure your tests end within this time frame, or it will occur of a timeout.You probably use sensitive information in your code base, and it is preferrable to use environment variables. You will find them below the code editor, in your browser check settings.
To access them, reference them in your code using standard Node.js syntax: process.env.ENV_VAR.
When creating a browser check, the Double Check setting is enabled by default. Upon failure, it will retry a second run right away to confirm a failed check.
This runtime version 2023.04 uses Node 16.x with a specific set of widely used libraries such as lodash, moment or axios.
The version of Node we use is 16x.
The full list of packages you can use are:
import { test, expect } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto('https://app.acme.com/login');
await page.locator('input[type="text"]').type(process.env.EMAIL);
await page.locator('input[type="password"]').type(process.env.PASSWORD);
await page.getByRole('button', { name: 'Sign in', exact: true }).click();
});
test('has title', async ({ page }) => {
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Acme/);
});
test('is logged in', async ({ page }) => {
const content = page.locator('#project-id');
await expect(content).toHaveText('project_12345');
});
This runtime uses a specific Nodejs version with a specific set of widely used libraries such as lodash, moment or axios.
The version of Node we use is v14.18.1.
The full list of packages you can use are: