Usage

Query the rendered screen.

tsx
// Query the rendered screen.
import { Button, Text, VStack } from 'kuito';
import { assert, render, screen, test } from 'kuito/tests';

const Empty = () => (
  <VStack>
    <Text>No messages yet</Text>
    <Button>Write one</Button>
  </VStack>
);

test('an empty inbox invites a first message', async () => {
  await render(<Empty />);

  assert.ok(screen.getByText('No messages yet'));
  assert.ok(screen.getByRole('button', { name: 'Write one' }));
  assert.equal(screen.queryByText('Inbox'), null);
});

Properties and methods 6

NameTypeRequiredDescription
getByText(text: TextMatch) => TestViewYesThe one view showing text; throws when none or several do.
getAllByText(text: TextMatch) => TestView[]Yes—
queryByText(text: TextMatch) => TestView | nullYes—
getByRole(role: string, options?: RoleOptions) => TestViewYesThe one view with role (and name, when given); throws when none or several have it.
getAllByRole(role: string, options?: RoleOptions) => TestView[]Yes—
queryByRole(role: string, options?: RoleOptions) => TestView | nullYes—
getByText — method signatures

Signatures

ts
(text: TextMatch): TestView

Parameters

NameTypeRequiredDescription
textTextMatchYes—

Returns

TestView

getAllByText — method signatures

Signatures

ts
(text: TextMatch): TestView[]

Parameters

NameTypeRequiredDescription
textTextMatchYes—

Returns

TestView[]

queryByText — method signatures

Signatures

ts
(text: TextMatch): TestView | null

Parameters

NameTypeRequiredDescription
textTextMatchYes—

Returns

TestView

getByRole — method signatures

Signatures

ts
(role: string, options?: RoleOptions): TestView

Parameters

NameTypeRequiredDescription
rolestringYes—
optionsRoleOptionsNo—

Returns

TestView

getAllByRole — method signatures

Signatures

ts
(role: string, options?: RoleOptions): TestView[]

Parameters

NameTypeRequiredDescription
rolestringYes—
optionsRoleOptionsNo—

Returns

TestView[]

queryByRole — method signatures

Signatures

ts
(role: string, options?: RoleOptions): TestView | null

Parameters

NameTypeRequiredDescription
rolestringYes—
optionsRoleOptionsNo—

Returns

TestView

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.