-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Open
Labels
Description
🚀 Feature Request
As a user I want to have an option that allows to save generated aria snapshot .yml files in raw mode, without generating regular expressions.
Example
Should save aria snapshot in raw mode:
import { test, expect } from '@playwright/test';
import fs from 'fs';
test('test', async ({ page }) => {
await page.setContent(\`<h1>hello world 123</h1>\`);
await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'test.aria.yml', exact: true });
expect(fs.readFileSync('a.spec.ts-snapshots/test.aria.yml', {encoding: 'utf8'})).toEqual('- heading "hello world 123" [level=1]');
});Should save aria snapshot in regex mode:
import { test, expect } from '@playwright/test';
import fs from 'fs';
test('test', async ({ page }) => {
await page.setContent(\`<h1>hello world 123</h1>\`);
await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'test.aria.yml', exact: false });
expect(fs.readFileSync('a.spec.ts-snapshots/test.aria.yml', {encoding: 'utf8'})).toEqual('- heading /hello world \\d+/ [level=1]');
});Motivation
Sometimes I need to check exact values (data calculation or mocked data) and this is the fastest way to achieve the result