question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: findTabs() always return null in the test

See original GitHub issue

Browser

No response

Package version

v3.0.11

React version

v18.0.0

Description

When I use the Tabs component, I can not find it by findTabs() method, it always return null.

I add Tabs as the content in Container, I can findHeader, findActions, findDescription, but can not findTabs()

Source code

<Container
    header={
        <Header
          variant="h2"
          description="Container description"
          actions={
            <SpaceBetween
              direction="horizontal"
              size="xs"
            >
              <Button>Action</Button>
              <Button>Another action</Button>
            </SpaceBetween>
          }
>
    <Tabs
        tabs={[
            {
                label: "HOME",
                id: "home",
                content: "home page"
            },
            {
                label: "feedback",
                id: "feedback",
                content: "feedback",
            },
            {
                label: "setting",
                id: "setting",
                content: "setting",
            }
        ]}
    />
</Container>

Reproduction

No response

Code of Conduct

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
just-boriscommented, Aug 12, 2022

It is required to import components in and the test utils from the same package.

If you are importing component from your custom package abc, the test-utils should be imported from abc/test-utils/dom

P.S. for your custom packages it is recommended to use your own NPM namespace, because npm will deny publishing if you decide to publish your themed package.

1reaction
just-boriscommented, Aug 11, 2022

Could you post your test code as well? Currently we only see the source code

Read more comments on GitHub >

github_iconTop Results From Across the Web

Moq test on inherited class always returns null - Stack Overflow
I am having a problem with setting up Unit Tests for a controller that implements a repository pattern. I want to ...
Read more >
callTestCase allways returns null if it fails, even If exists a ...
Hello. I´ve some shared test cases that return data. Some days ago I´ve realized that, if the test fails, it is returning null...
Read more >
Unit Test Method Always Returns A Null Value - .NET - SitePoint
I'm trying to unit test a method using MSTest and MOQ but it always fails. The following is a method in the BL...
Read more >
`queryByText` always return null · Issue #636 - GitHub
Describe the bug I set up a new react-native project and install the testing library following the docs. But it seems all the...
Read more >
Custom Setting returns null in apex test
In it I have a lookup element to a custom setting that returns a string based on a date value. When I run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found