Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

91
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda