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

90
Views
How to structure often used functions

I recognised that in few different pages i am locating elements by the exact same locators, as an example i have created LoginInPage and RegistrationPage and both of them have static function emailInput() there are more elements i am locating by the exact locators and its values through the project, so my question what would be modern approach towards it?

I did research and saw that often used functions are placed in commands.ts but personally i do not like this approach as what if commands will end up having 30+ functions it be super messy, would appreciate any solutions suggested

export class LogInPage {
  static get emailInput(): Cypress.Chainable<JQuery<HTMLInputElement>> {
    return cy.get<HTMLInputElement>('input[placeholder="Email address"]');
  }
}


 export class RegistrationPage {
      static get emailInput(): Cypress.Chainable<JQuery<HTMLInputElement>> {
    return cy.get<HTMLInputElement>('input[placeholder="Email address"]');
  }
about 4 years ago · Juan Pablo Isaza
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!