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

210
Views
CypressError: Cypress detectó que usted devolvió una promesa de un comando al mismo tiempo que invocaba uno o más comandos cy en esa promesa

Estoy usando el fixture de ciprés y la intercept para cargar un archivo y también validar si el punto final de carga (publicación) fue exitoso. aquí está el código:

 describe('something', () => { let projectID; before(() => { projectID = localStorage.getItem('projectID'); cy.intercept('POST', '/graphql', (req) => { cy.log(req.body); if (req.body.operationName === 'postRequest') { req.alias = 'postRequest'; } }); }); it('should validate file upload', () => { const fileName = 'test_file_upload.xlsx'; cy.get('.file-uploader').should('exist'); cy.get('.upload-file-label').first().click({ force: true }); cy.fixture(fileName, 'binary').then((fileContent) => { cy.get('input[type=file]') .upload( { fileContent, fileName, mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', encoding: 'utf-8', }, { subjectType: 'input' } ) .wait('@postRequest') .then((interception) => { cy.log(interception.response.body); }); }); }); });

No estoy exactamente seguro de a qué se refiere el error, pero supongo que podría ser un problema asíncrono.

gracias por su ayuda

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El .wait() debe estar encadenado a un cy cuando pasa un alias.

 // code looks good until here cy.get('input[type=file]') .upload( { fileContent, fileName, mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', encoding: 'utf-8', }, { subjectType: 'input' } ) cy.wait('@postRequest') .then((interception) => { cy.log(interception.response.body); });

Cuando pasa un agrumento de tiempo (es decir, 500 ) .wait() se puede encadenar a un cy o cualquier otro comando.

 cy.get('.selector') .wait(1000) cy.wait(500)
about 4 years ago · Santiago Trujillo 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!