Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Custom enzyme method to find test elements

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.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!