Web scenario file (any-name.spec.ts)
- Organization of this page
Format
Write in spec.ts file format.
import { test, expect } from '@playwright/test';
test.use({
locale: 'ja-JP'
});
test('test', async ({ page }) => {
await page.goto('http://host-name:20703/login');
await page.locator('input[name="username"]').fill('user-name');
await page.locator('input[name="password"]').fill('password');
await page.getByRole('button', { name: 'login' }).click();
await expect(page.getByRole('button', { name: 'logout' })).toBeVisible();
await page.getByRole('button', { name: 'logout' }).click();
await expect(page.getByRole('button', { name: 'login' })).toBeVisible();
});
File
any-name.spec.ts
The following characters can be used in file names: Filenames that use other characters cannot be monitored by Web scenario monitoring function.
-
Half-width English uppercase letters, half-width English lowercase letters
-
One-byte numbers
-
Hyphen (-)
-
Underscore (_)
-
Half-width period (.)
Storage directory
■Integrated manager host
- In Windows
-
-
For a physical host
Agent-path\lib\playwright\tests\
-
For a logical host
shared-folder\jp1ima\lib\playwright\tests\
-
Description
Web scenario monitor feature uses Web scenario described in this file.
Web scenario files are created using the playwright codegen command and are used when executing a Web scenario.
This file cannot be edited.
Character code
UTF-8 (without BOM)
Line feed code
CR+LF or LF
When the definitions are applied
Reflected when Web exporter executes Web scenario.