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

158
Views
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 answers
Answer question

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 Report
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!