Skip to main content
Glama
deleonio
by deleonio
input-msg.ts1.56 kB
import { expect } from '@playwright/test'; import { test } from '@stencil/playwright'; import type { MsgPropType, Stringified } from '../schema'; const testInputMessage = <ElementType extends { _msg?: Stringified<MsgPropType> } & HTMLElement>(componentName: string) => { test.describe('Input messages', () => { test(`should render a message when provided as object`, async ({ page }) => { await page.setContent(`<${componentName} _label="Input" _msg="{'_description': 'This is a info message', '_type': 'info'}"></${componentName}>`); const alert = page.getByTestId('alert'); await expect(alert).toContainText('This is a info message'); }); test(`should render a error message when provided as string`, async ({ page }) => { await page.setContent(`<${componentName} _label="Input" _msg="This is a string error message" _touched></${componentName}>`); const alert = page.getByTestId('alert'); await expect(alert).toContainText('This is a string error message'); }); test('should display and hide message based on _msg value', async ({ page }) => { await page.setContent(`<${componentName} _label="Input" _msg="{'_description': 'An error message', '_type': 'error'}" _touched ></${componentName}>`); const alert = page.getByTestId('alert'); await expect(alert).toBeVisible(); const input = page.locator(componentName); await input.evaluate((element: ElementType) => { element._msg = undefined; }); await expect(alert).not.toBeVisible(); }); }); }; export { testInputMessage };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server