cypress
cypress copied to clipboard
Support Portable Firefox
Current behavior
using https://portableapps.com/apps/internet/firefox_portable
yarn cypress run --browser N:\foo\bar\portable\firefox\FirefoxPortable.exe
yields
DevTools listening on ws://127.0.0.1:62527/devtools/browser/13d2578b-562c-4b94-af24-7d18df8219fe
We could not identify a known browser at the path you provided: N:\foo\bar\portable\firefox\FirefoxPortable.exe
Read more about how to troubleshoot launching browsers: https://on.cypress.io/troubleshooting-launching-browsers
The output from the command we ran was:
Unable to find browser with path N:\foo\bar\portable\firefox\FirefoxPortable.exe
We could not identify a known browser at the path you provided: N:\foo\bar\portable\firefox\FirefoxPortable.exe
Read more about how to troubleshoot launching browsers: https://on.cypress.io/troubleshooting-launching-browsers
The output from the command we ran was:
Unable to find browser with path N:\foo\bar\portable\firefox\FirefoxPortable.exe
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Desired behavior
please run with the specified browser
Test code to reproduce
You can use any test. It's all the same.
Cypress Version
12.15
Node version
20.3.1
Operating System
Windows 10
Debug Logs
Could not submit form (to create this issue) after pasting the logs here, because github says: “There was an error creating your issue: body is too long (maximum is 65536 characters).”
Thus please download logs here instead: http://stormlight.de/cypress-27123.log
Other
No response
Hi @mb73 , thanks for reaching out. You may be hitting some unique Windows behaviors that we have referenced in our Troubleshooting Guide.
Occasionally Cypress will have issues detecting the type of browser in Windows environments. To manually detect the browser type, append the browser type to the end of the path:
cypress open --browser C:/User/Application/browser.exe:chrome
Can you try including the :firefox hint and try using forward instead of back-slashes? Let me know if that doesn't work and I'll take a deeper look
Hi @mb73 , thanks for reaching out. You may be hitting some unique Windows behaviors that we have referenced in our Troubleshooting Guide.
Occasionally Cypress will have issues detecting the type of browser in Windows environments. To manually detect the browser type, append the browser type to the end of the path:
cypress open --browser C:/User/Application/browser.exe:chromeCan you try including the
:firefoxhint and try using forward instead of back-slashes? Let me know if that doesn't work and I'll take a deeper look
Thanks! Now it says (both with slashes or backslashes):
DevTools listening on ws://127.0.0.1:51896/devtools/browser/6d7a09c6-4ae3-41ba-9da1-eede34dcf945
Cypress does not support running Custom Firefox version 2. To use Custom Firefox with Cypress, install a version of Custom Firefox newer than or equal to 86.
However, this is not Firefox 2 but 141.0.1.
@mb73 I set up a fresh Firefox Portable install and did not receive the error you did - do you maybe have an old version of the portable app? The browser opened up for me without any command line errors, but it doesn't look like it's going to work with Cypress as-is.
Cypress depends on being able to install a dedicated browser profile and Firefox Portable seems to want to open the profile as a webpage rather than the Cypress app using that profile. From what I can tell Firefox Portable has a very roundabout process to kinda-sorta support multiple profiles which makes it incompatible with the standard Firefox CLI. There might be a way to trick Cypress into using the profile by leveraging the special profile executable referenced in their support docs combined with a customized browser definition for Cypress but I can't say for certain. Is there a reason you have to use Firefox Portable instead of actual Firefox? I can send this along to the team as a feature request but I can't speak to when it would be prioritized. You may have better luck reaching out on Discord to see if anyone else has already solved this problem (or wants to collaborate on finding a fix).
@mike-plummer Thanks for your reply! It’s strange that you don’t get that error message. I downloaded Firefox Portable from https://portableapps.com/apps/internet/firefox_portable just today. The installer file is called FirefoxPortable_114.0.1_German.paf.exe. Now I downloaded FirefoxPortable_114.0.1_English.paf.exe instead (the non-localized one), to make sure I have the same installer file as you. Same result as before.
The reason for Firefox Portable is that I want to use it on a corporate Citrix, which has still Firefox 68 installed. And I have no admin rights to install anything there.
I understand why this might look confusing to you. I have linked the logs from my local Windows machine (dev box) instead of those from Citrix. They look quite the same only with (regularly installed) Firefox found 114.0.2 instead of 68.0.1.
Here is a screenshot of the Citrix command line with DEBUG set (note the 68.0.1 at the top and the error message in dark red below): http://stormlight.de/cypress-27123.png
I guess I have to convince the admins to update Firefox on Citrix. 🤞
@mb73 I suspect it's a long-shot, but is there any chance the box you're accessing has Docker? If so you could build a cypress/factory Docker image with whatever browser(s) you want and run headlessly using that.
One other long-shot: If I remember correctly, the Firefox Windows installer asks for admin permissions because it wants to install for all users, but if you just "Cancel" or "No" the request it will install just for the current user. That may no longer be the case, and even installing just for your user might make your admins unhappy
Finally, I assume you're using Firefox because you have a hard requirement to do so? Cypress ships with a built-in Electron browser that can be used headed or headlessly if that's an option.
@mb73 I suspect it's a long-shot, but is there any chance the box you're accessing has Docker? If so you could build a
cypress/factoryDocker image with whatever browser(s) you want and run headlessly using that.
Hi Mike! Thanks a lot, I really appreciate your help! However, it seems there is no docker on that (Citrix) server.
One other long-shot: If I remember correctly, the Firefox Windows installer asks for admin permissions because it wants to install for all users, but if you just "Cancel" or "No" the request it will install just for the current user. That may no longer be the case, and even installing just for your user might make your admins unhappy
The thing is: It’s not really for me. I design and develop a software that generates high-level API code for testing our product. The generated API code (in Typescript to have code completion) is to be used by (non tech) people who develop and run the actual tests (and have no PCs, just those Citrix clients). Usage example (if you’re interested):
it("enters informed consent", function () {
this.selectLastPatient()
.visitSE_SCREENING()
.visitFD_IC()
.selectID_DS_ADDRESSDSTERM_yes()
.selectID_DS_BIOMDSTERM_yes()
.selectID_DS_MEDDATDSTERM_yes()
.selectID_DS_PHONEDSTERM_yes()
.selectID_DS_QUESTDSTERM_yes()
.selectID_DS_STUDYPROPDSTERM_yes()
.clickSave()
.containsNo("Form could not be saved.");
});
Finally, I assume you're using Firefox because you have a hard requirement to do so? Cypress ships with a built-in Electron browser that can be used headed or headlessly if that's an option.
Sad story. I am unable to login to our product with Chromium-based browsers using Cypress. I suspect this has to do with our very outdated security infrastructure. I don't want to reveal any details for obvious reasons. An upgrade is planned, but probably several months away due to bureaucracy ...
@mb73 Oh, cool use case 👍. Sad trombone noises on the lack of Docker & Chrome support. I'll try to carve a little time off tomorrow to see if I can figure out a way to get Firefox Portable at least launching, but I can't guarantee further compatibility issues won't crop up even if I can find a way around the profile issue. In all honesty your best options at this point are probably:
- Convince someone to put a relatively modern Firefox instance (v86+) on that box for you. Call it an "urgent security upgrade" 😁
- You could reach out on Discord to see if anyone else from the Cypress community has tried this before. I personally haven't heard anyone doing so, but there's like 10,000 Cypress users on there so you might get lucky
@mike-plummer Thanks again! I have made some progress in convincing our people to update Firefox. I think there is a ~70% chance of getting this done in the next two months or so.
On Discord I already asked. (“Kissenschlachter” is my in-game handle.)
Great to here, always good to keep browsers up to date.
It sounds like there isn't any actionable work for us to pick up. It looks like we only commit to Firefox 86+ at this point, as documented, so I'll close this as wontfix. Let me know if I am closing this incorrectly - I looked over the replies, and it looks like the answer is "we need to update to firefox 86".
@lmiller1990 To update the installed Firefox is a workaround for us. The problem that Cypress does not work with portable Firefox, even the latest one (tested with 114.0.2), remains.
Right, I see. I'm going to flag this as a feature request - it's not entirely clear to me if Portable Firefox should work out of the box or not, but it'd sure be nice if it did. It looks like this isn't something provided by the Firefox team / MDN.
Do you have a particular use case in mind for using the portable version of standard firefox?
@lmiller1990 Thanks. Use case: Running Cypress with Firefox on machines where you don’t have the right to install anything.
Portable nodejs (to run Cypress) was no problem, by the way.
Gotcha, thanks. I am not sure we are going to be able to prioritize this right now. Let's leave this as a feature request for now and see if other users have a similar use case. If so, we can look into it.