react native testing library, No instances found with testID

Viewed 938

Im getting the error,

No instances found with testID: CreateAccount.errorMessage

But Im referencing the ID on "CreateAccount.js"

   <ErrorText
      text={this.state.errorMessage}
      testID="CreateAccount.errorMessage"
    />

Then on "CreateAccount.test.js"

test("display error msg if all fields are not completed", () => {
  const { getByTestId, getByText } = render(<CreateAccount />);

  fireEvent.press(getByText("Submit"));

  console.log(getByTestId("CreateAccount.errorMessage").props);
});

What is missing on my component for the testID to work?

thanks in advance

0 Answers
Related