I have a test where I want to create a new document. In order to create the document I need to click on a "Save" button. Clicking "Save" triggers a POST request and opens the newly created document in a portlet on the same page.
However, when I do this in Cypress, clicking the save button opens the URL of the POST request in the browser. This page simply displays the response of the POST request.
{"response":"248"}
How is it possible that clicking the button manually opens the newly created document, while clicking the button in cypress opens a new URL?
This is the cypress code:
cy.visit(url_document_sets)
cy.get('.is_flatten').click({force:true}
cy.get('#TcDocumentFile_valid_from').type(current_date)
cy.get('.k-button').contains('Speichern') //Speichern = Save
Which is exactly what I do manually. I go the the URL, click 2 buttons, then click the Save button. Doing this in Cypress though will open the URL of the POST request https://**********/index.php?r=tc/documentSet/documentSet/saveFile&language=de in the browser.
Cypress does not throw an error, it just opens the URL.
I know this question is very hard to reproduce, so if there is anything I can provide to make the question clearer, please help me out.