To automate script tests for a website like https://ray.run/, you'll need to use Playwright Test. This tool is great for end-to-end testing and supports all modern rendering engines.
First, install the VS Code extension. Open the command panel, type "Install Playwright", and select "Test: Install Playwright". Choose the browsers you want to test on.
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
use: {
// Configure which browser to use.
browserName: 'chromium',
// Any Chromium-specific options.
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true,
// Test against this website.
baseURL: 'https://ray.run/',
},
};
export default config;
When writing tests, only test what you control. Avoid testing third-party dependencies.
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://ray.run/');
const title = page.locator('.title');
await expect(title).toHaveText('Welcome to Ray.run');
});
Playwright Test provides built-in locators with auto waiting and retry-ability features. This ensures element visibility before performing any action, making your scripts more resilient against flaky failures.
For more tips on writing efficient Playwright Test scripts, check out this blog post.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].