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

115
Visualizações
How to constructor inject dependencies to cypress cucumber step classes

Is there a way to constructor inject dependencies to cypress cucumber step classes. I am using cypress-cucumber-preprocessor. I have some service classes and it will be convenient if there is a way to inject them instead of manually initializing them inside the steps. If I declare a class as below, the compiler is not happy. If we can not achieve what I have coded below, Is there a way to initialize an instance that lives within the scenario lifetime and is available to all steps? Thanks in advance.

import { Before, After, Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { LoginPage } from "../../../support/PageObjects/LoginPage";

export class Login {
       
       constructor(private service:MyService)
       {
       }

       Given("I am logged in", () => {
        let bla = service.method1();
       });

       When("I navigate to {menuItem}", (menuItem) => {
        let blabla = service.method2();
       });

} ```
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