v0.2.0
Minor Changes
-
064e5b4
#48 Thanks @calebeby! - - Add user.type method- Add actionability checks: visible and attached
-
beb1914
#43 Thanks @calebeby! - Provide a helpful message if the user forgets to useawait
.For example, if a user forgets to use
await
in the jest-dom assertion:test( 'example', withBrowser(async ({ screen, utils }) => { await utils.injectHTML('<button>Hi</button>'); const button = await screen.getByText(/hi/i); expect(button).toBeVisible(); }), );
Then a useful error message is produced:
Cannot execute assertion toBeVisible after test finishes. Did you forget to await? 103 | await utils.injectHTML('<button>Hi</button>'); 104 | const button = await screen.getByText(/hi/i); > 105 | expect(button).toBeVisible(); | ^ 106 | }), 107 | ); 108 |
This is also handled for utility functions, user methods, and Testing Library queries.
-
732fbff
#45 Thanks @calebeby! - Now it is possible to pass variables to the browser in runJS:import { withBrowser } from 'test-mule'; test( 'runJS example with argument', withBrowser(async ({ utils, screen }) => { // element is an ElementHandle (pointer to an element in the browser) const element = await screen.getByText(/button/i); // we can pass element into runJS and the default exported function can access it as an Element await utils.runJS( ` export default (element) => console.log(element); `, [element], ); }), );