nightwatch-testing-library icon indicating copy to clipboard operation
nightwatch-testing-library copied to clipboard

Nightwatch Testing Library injects testing library and simmer on each call of getByRole, getByText etc

Open davidholyko opened this issue 11 months ago • 0 comments

I have an example here from a simple test

https://github.com/davidholyko/nightwatch-sandbox/blob/3d34d1b35a7476619a9d5f4caa0d2a3b3fc43289/src/tests/06-nwtl-example.ts

Whenever getByRole or a query function is called, the injectNWTL function

https://github.com/testing-library/nightwatch-testing-library/blob/a6a1b8fa2bc2f9f545a9359b52992b3645347eb4/src/index.js#L43

I believe causes page crash errors eventually when we have enough of these. the execute scripts are fairly large (> 30,000 characters).

In webdriver flavor, there seems to be some extra code to conditionally inject the script if it has not already been loaded

https://github.com/testing-library/webdriverio-testing-library/blob/2eeee0106b1bd687045bbd111f041f0022e62103/src/index.ts#L61-L86

Image

davidholyko avatar Mar 05 '25 20:03 davidholyko