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

159
Visualizações
Fetching external api with cypress

I would like to fetch an email from an email provider and i know that i could use axios or any other http client however since i added cypress can i just use cy.request to get data and store it or it should not be used for such purposes.

I can use axios as it shows here but why if i have cy.request

context('Verify email', () => {
    let inbox;
    before((done) => {
      // Configure timeout
      this.timeout(1000*60*5); // five minutes
      // Query the inbox
      axios.get(`${ENDPOINT}&tag=${TAG}&timestamp_from=${startTimestamp}&livequery=true`).then((response) => {
        inbox = response.data;
        done();
      }).catch((err) => {
        done(err);
      });
    });
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You could store the response in a Cypress environment variable.

context('Verify email', () => {
  before(() => {
    cy.request(`${ENDPOINT}}&tag=${TAG}&timestamp_from=${startTimestamp}&livequery=true`)
      .then((response) => {
        Cypress.env('inbox', response.body);
    });
  });

  it('test', () => {
    // reference the variable by Cypress.env('inbox')
  });
});
about 4 years ago · Santiago Gelvez Relatório
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