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

112
Visualizações
Feature flags in Next js application

I am using Cypress to test my Next.js application. Also I have set feature flags to hide a specific item. In _app.js I wrapped my components like this:

<FlagsContainer><Component {...props} /></FlagsContainer>

Inside FlagsContainer I fetch my feature flags from an external service and if the page for example corresponds to login I hide that page. The feature is working well.

Also I test my app using Cypress and Cucumber. Taking into account that for local environment the feature flag is not set, my tests are working because the page is displayed, but on prod env. the feature flag is set and the page will be hidden, and deploying the app to prod will run again the CI making the test to fail because the page won't be there. Inside my Cucumber file I have a test like this:

Scenario: Get login page
   Given i am on welcome page
   And i click on login page
   Then i should see login page
 

Also I implemented this test and all works.

How to avoid failing the Cypress test on production? How to run the tests/scenarios taking into account that when the flag is set to true the scenario above should work and if is false another scenario should be applied? How to configure Cypress?

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