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

92
Views
Cypress no sube la imagen

Estoy automatizando uno de los casos de uso en cypress y no puedo cargar la imagen usando la función de archivo adjunto. A continuación se muestra el código y los fragmentos de las etiquetas HTML

Cargar imagen de interfaz de usuario

Cargar imagen de interfaz de usuario

Etiquetas HTML

Etiquetas HTML

código VS

código VS

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que desea adjuntar el archivo a <input> como primer paso. Luego haga clic en el botón, o es posible que ni siquiera tenga que hacer clic().

De los documentos,

 // start watching the POST requests cy.intercept({ method: 'POST', url: /upload_endpoint/ }).as('upload'); const myFilePath = 'product.jpeg'; // file is in "/cypress/fixtures/" folder cy.fixture(myFilePath, 'binary') .then(Cypress.Blob.binaryStringToBlob) .then(fileContent => { cy.get('input#productImageUpload').attachFile({ fileContent, fileName: myFilePath, mimeType: 'application/octet-stream', encoding:'utf8', lastModified: new Date().getTime( }) }) cy.get('.label-side').click() // may not need to do this // wait for the 'upload_endpoint' request, and leave a 2 minutes delay before throwing an error cy.wait('@upload', { requestTimeout: 120000 });
about 4 years ago · Juan Pablo Isaza 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!