import { test, expect } from '@playwright/experimental-ct-react';
import Button from '@/components/Button';
import DefaultChildren from '@/components/DefaultChildren';
import MultipleChildren from '@/components/MultipleChildren';
test('render a default child', async ({ mount }) => {
const component = await mount(
Main Content
);
await expect(component).toContainText('Main Content');
});
test('render a component as child', async ({ mount }) => {
const component = await mount(
);
await expect(component).toContainText('Submit');
});
test('render multiple children', async ({ mount }) => {
const component = await mount(
One
Two
);
await expect(component.getByTestId('one')).toContainText('One');
await expect(component.getByTestId('two')).toContainText('Two');
});
test('render named children', async ({ mount }) => {
const component = await mount(
Header
Main Content
Footer
);
await expect(component).toContainText('Header');
await expect(component).toContainText('Main Content');
await expect(component).toContainText('Footer');
});
test('render string as child', async ({ mount }) => {
const component = await mount({'string'});
await expect(component).toContainText('string');
});
test('render array as child', async ({ mount }) => {
const component = await mount({[4,2]});
await expect(component).toContainText('42');
});
test('render number as child', async ({ mount }) => {
const component = await mount({1337});
await expect(component).toContainText('1337');
});