Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(ct): solid hooks (#16864)

sand4rt849da28dc4a0
diff --git a/tests/components/ct-solid/src/tests.spec.tsx b/tests/components/ct-solid/src/tests.spec.tsx
index 918df8d02c..d44c4b37b8 100644
--- a/tests/components/ct-solid/src/tests.spec.tsx
+++ b/tests/components/ct-solid/src/tests.spec.tsx
@@ -26,6 +26,17 @@ test('default child should work', async ({ mount }) => {
await expect(component).toContainText('Main Content')
})
+test('should run hooks', async ({ page, mount }) => {
+ const messages: string[] = [];
+ page.on('console', m => messages.push(m.text()));
+ await mount(<Button title="Submit" />, {
+ hooksConfig: {
+ route: 'A'
+ }
+ });
+ expect(messages).toEqual(['Before mount: {\"route\":\"A\"}', 'After mount']);
+});
+
test('should unmount', async ({ page, mount }) => {
const component = await mount(<Button title="Submit" />)
await expect(page.locator('#root')).toContainText('Submit')