Hello everyone! Hope you are doing well,
I would like ask for help on a peculiar behaviour I am getting on React web app.
Robot Framework + Browser is used, of course.
In essence, it’s a SPA form which populates bunch of data, at the end of which user can download a PDF version of the document. Now:
- When testing manually and selecting “Download” button, PDF is downloaded to selected download folder.
- When automation script touches the button, PDF is not downloaded.
As explained by a dev, when “Download” button is clicked, the following happens:
- docGen API is hit
- it returns base64 string
- front-end magic is used to decode that base64 into PDF and save it to user machine
So, when “Download” is selected manually, all works well:
- file gets downloaded to designated folder
- if no default download folder is selected, an operating system “Save As” dialog will be displayed, so user can choose where to save the PDF.
This is a process that takes some 5-7 seconds (there is a nice spinner) and then the download icon appears showing a PDF is downloaded.
But, when robot script clicks the “Download” button:
- spinner is spinning and after 5-7 seconds it stops
- a file is seemingly downloaded, named by some id, with no extension
- when test finishes, there is no file saved, it disappears
- if that file is saved “forcifully” (long Sleep) and opened, it can be opened in PDF viewer, no content whatsoever, but with expected number of pages.
- in Chrome downloads it shows as blob:{someId}, as Azure is used.
Looks like that file (with no extension) only lives during the test session. Am I missing something?
Seems like - FE code that decodes data to PDF is not executed when test is automated.
Sleep doesn’t help.
Adding downloadsPath didn’t help.
Any idea why this is happening? All help is very welcome as well as if you need more info.
Why wouldn’t it be the same behaviour as when “Download” button clicked manually?
EDIT: Uh, once I layed this out, some ideas pop up.
- since Browser is always incognito, that means tha OS “Save As” dialog will pop-up.
- but setting downloadsPath, unfortunatelly, does not help (behaviour is the same)
- and I never see the operating sistem “Save As” dialogue during test when starting any of the 3 engines (to maybe use RPA.Desktop to selelct “save” on the damned dialogue). Besides, how could I do it in CI/CD, on an agent, all headless…