Download not going to configured folder in Cypress test - cypress

I'm testing file download in multiple browsers. In Chrome it downloads as expected, but in Firefox the folder used is not the default cypress/downloads folder.
DOM
<a data-cy="download-png" href="logo.png" download>logo.png</a>
Test
cy.get('[data-cy="download-png"]').click()
Chrome:
(download) C:\ ... \cypress\downloads\logo.png
Firefox:
(download) C:\downloads\logo.png
Do I need special configuration or plugin for Firefox?

This is a known issue, see Cypress is not downloading files in the cypress/downloads folder on Firefox.
If you upgrade to Cypress v10.6.0, it should be resolved.

Related

Protractor 7 does not go beyond 'Using FirefoxDriver directly...'

I am unable to run e2e tests with protractor 7 with the following configuration
...
directConnect: true,
capabilities: {
browserName: 'firefox'
}
...
on my MacOS Catalina. I noticed the
webdriver-manager update
command from the project's package.json downloads the geckodriver-v0.29.1.
As mentioned in the title the logs do not go beyond Using FirefoxDriver directly... when I run the tests. How can I check logs in more details (is there a verbose option in protractor?), and how can I fix the issue ?
With Splaktars answer I was able to get Firefox to launch using the typical directConnect: true setting.
I had to download the geckodriver-v0.29.1-macos.tar.gz package from the Github Releases and extract the binary. Then I replaced the geckodriver-v0.29.1 binary previously downloaded through webdriver-manager with that copy from the package.
After that I launched my tests to make sure everything was still partially working and finally saw the MacOS security popup. I ran the command to remove the quarantine flag:
xattr -r -d com.apple.quarantine /path/to/geckodriver-v0.29.1
Relaunched the tests and finally Firefox popped up...
Thanks again to Splaktar, just made an account so I can't comment or upvote for help
It looks like there is a known issue in the v0.29.1 release notes:
https://github.com/mozilla/geckodriver/releases/tag/v0.29.1
Those point to some GeckoDriver macOS Notarization docs:
https://firefox-source-docs.mozilla.org/testing/geckodriver/Notarization.html
However that page say
Arbitrary software downloaded through other means, such as curl(1) is not affected by this change.
I don't get any security pop ups or warnings, just the hang that you see.
Running
xattr -r -d com.apple.quarantine /Users/splaktar/Git/app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.29.1
Doesn't help.
In https://github.com/angular/protractor/issues/4253, there are a lot of old issues mentioned with Firefox and directConnect support. I tried using directConnect: false with a suggestion from that issue:
config.capabilities = {
'browserName': 'firefox',
'marionette': true,
'elementScrollBehavior': 1
};
config.directConnect = false;
config.seleniumAddress = 'http://localhost:4444';
config.localSeleniumStandaloneOpts = {
jvmArgs: ['-Dwebdriver.gecko.driver=node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.29.1']
};
I ran webdriver-manager start and then ran my tests, but that failed quickly with an error page's HTML in the console and From: Task: WebDriver.createSession() Process exited with error code 199.
I also tried setting
config.firefoxPath = '/usr/local/bin/firefox-bin';
after creating a symbolic link there to /Applications/Firefox.app/Contents/MacOS/firefox-bin. But that didn't help at all. Firefox never gets started. I tried with Firefox Developer Edition as well.
Still investigating...

Fitnesse is opening Firefox startpage

Fitnesse is opening the startpage of Firefox but not the specified URL in the script.
https://www.mozilla.org/nl/firefox/42.0/firstrun/learnmore/
what can i do to solve this problem?
The solution is:
go to this URL and install.
(install a Crome webdriver)
https://code.google.com/p/selenium/wiki/ChromeDriver

PHPUnit + Selenium: How to set Firefox about:config options?

When running Selenium tests remotely with PHPUnit and Firefox, onChange events are not fired as they are when a user is operating the browser.
The solution to this seems to be to set the focusmanager.testmode option to true in Firefox's preferences (i.e. about:config), as suggested in a Selenium bug report.
However all the examples are using Selenium directly, while I am using PHPUnit which has its own API hiding the Selenium internals. I can't figure out how to set this Firefox option using PHPUnit, so I'm hoping someone else can tell me how this can be done!
(No, I can't go into about:config and set it myself manually because the tests create a new clean browser profile each time the tests are run, so any manual config changes are lost.)
Thanks to the Selenium developers I have a solution!
Short version
Put this in your test so that it gets called in the setUp() function:
// Firefox mini-profile that sets focusmanager.testmode=true in about:config
define('FIREFOX_PROFILE',
'UEsDBAoAAAAAADqAxkSBK46tKgAAACoAAAAIABwAcHJlZnMuanNVVAkAA1BZkVM6WZFTdXgLAAEE
6AMAAARkAAAAdXNlcl9wcmVmKCJmb2N1c21hbmFnZXIudGVzdG1vZGUiLCB0cnVlKTsKUEsBAh4D
CgAAAAAAOoDGRIErjq0qAAAAKgAAAAgAGAAAAAAAAQAAAKSBAAAAAHByZWZzLmpzVVQFAANQWZFT
dXgLAAEE6AMAAARkAAAAUEsFBgAAAAABAAEATgAAAGwAAAAAAA==');
protected function setUp()
{
$this->setDesiredCapabilities(Array('firefox_profile' => FIREFOX_PROFILE));
}
This sets focusmanager.testmode to true.
Long version
You need to create your own mini Firefox profile with the preferences you want set, and pass it along at the start of your tests. Here's how to do it:
Create a new folder and put the files you want in the Firefox profile in there. This can be anything (bookmarks, extensions, a copy of your own profile, etc.) but all we need here is a file called prefs.js which stores our about:config settings.
Create prefs.js in this folder with the following content:
user_pref("focusmanager.testmode", true);
Zip up the folder (prefs.js should be in the root of the archive), and base64 encode it.
If you're using Linux, you can do it all like this:
mkdir firefox-profile
cd firefox-profile
echo 'user_pref("focusmanager.testmode", true);' >> prefs.js
zip -r ../firefox-profile.zip *
base64 < ../firefox-profile.zip
Then take the base64 value and set it as the "firefox_profile" capability as per the short version above.

Using venkman in my xul application

I've tried to follow these steps to get venkman in my xul application:
Get Venkman from addons.mozilla.org To download the package, right-click the install link and save the package locally. (got the newest version).
Create a directory /distribution/bundles/venkman. Unzip the package into that directory.
Add <script src="chrome://venkman/content/venkman-overlay.js" /> to one of your XUL windows.
Add UI to open Venkman to your window (it could be a menu item or a toolbar button). Make it call start_venkman() when activated.
Not sure where to create the distribution directory, I've tried in the same directory as my application.ini in chrome and in chrome/content but when I try to include the script as in step 3 I get:
No chrome package registered for chrome://venkman/content/venkman-overlay.js
And step 4 gives me:
Error: ReferenceError: start_venkman is not defined
I start my application using the following command:
firefox.exe --app application.ini -jsconsole
Changed the BuildID in my application.ini a couple of times but that didn't change anything.
Created the directory: C:\Program Files (x86)\Mozilla Firefox\distribution\bundles and copied the venkman directory in there.
In my xul window I added:
<script src="test.js" />
<button label="Press Me"
oncommand="start_venkman();"/>
The content of test.js is:
function toOpenWindowByType(inType, uri) {
var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar";
window.open(uri, "_blank", winopts);
}
When I click the button the Venkman window opens.

Firefox 19.0.2 deletes proxy extension file

Working on Windows 8 64bit, Firefox 19.0.2.
I went to .../Firefox/Profiles/.../extensions and put my ekons#www.solver.ws file containing
a string
h:\myextensions\ekons\
The directory h:\myextensions\ekons\ contains install.rdf file of my extension.
Every time I restart Firefox, it deletes .../Firefox/Profiles/.../extensions/ekons#www.solver.ws file. Of course, without trying to install the extension.
Any suggestions?
Addition
I attach an image FF extensions directory.
Well, it was my mistake: extension file name was not the same as ID inside install.rdf.
Such files are silently deleted by FireFox from profile directory.
I had the same isue, the problem was an extra tag </em:description> in the install.rdf file.
When it was a valid XML all goes ok.

Resources