Use configure from @testing-library/react instead.
Insight 📝
The custom testIdAttribute: 'data-test-id' is ignored somehow when running the unit test. (It works well in UI test)
TestingLibraryElementError: Unable to find an element by: [data-testid="app-link"]
Maybe the @testing-library/dom's version and @testing-library/react's version are not the same and React ignore all custom attributes from @testing-library/dom. Ref
Proof Of Work 📹
Use cli-tool locally to generate a new app with local changes by running the commands:
$ cd ./packages/cli-tool/
$ npm i
$ ./bin/dev generate app-name ~/{react-templates_path}/ file:react-templates/packages/cra-template
What happened 👀
Use
configure
from@testing-library/react
instead.Insight 📝
testIdAttribute: 'data-test-id'
is ignored somehow when running the unit test. (It works well in UI test)TestingLibraryElementError: Unable to find an element by: [data-testid="app-link"]
@testing-library/dom
's version and@testing-library/react
's version are not the same and React ignore all custom attributes from@testing-library/dom
. RefProof Of Work 📹
cli-tool
locally to generate a new app with local changes by running the commands:All the tests passed!~