Throughout our test suite we litter the tests with something like
it('should do something', () => {
const component = mount(<Something />);
expect(component.find('[data-testid="some-test-id"]').hostNodes().length).toBe(true);
});
With cypress, we were able to add a getTestEl method which basically is a wrapper for their find method
Cypress.Commands.add('getTestEl', (selector, ...args) => {
return cy.get(`[data-testid="${selector}"]`, ...args);
});
We want to do something with enzyme so we don't have to repeat the test attribute code.
I cannot find any examples of this anywhere and may not be possible.