Is there a way to see in cypress electron browser some logging? - electron

I am using cypress to test my web site. Everything works great but there is one page that opens fine when I am running the test using chrome but if I try to run that against headless or regular electron the lhes simply don’t open.
I am assuming that there must be something on my code that is not working on the chromium version that electron uses (61) that do works the version that chromes uses (75).
Is there a way to debug or check some logging on what is not being able to execute? The console for electron does not display anything.
Any ideas?

You can show console.log messages from Electron by enabling a subset of DEBUG logs.
Like so:
Windows:
npm i -g cross-env
cross-env DEBUG=cypress:server:browsers:electron cypress run...
macOS or Linux:
DEBUG=cypress:server:browsers:electron cypress run...

After adding these two env variables Cypress started showing console.log output on the terminal:
ELECTRON_ENABLE_LOGGING=true DEBUG=cypress:electron $(npm bin)/cypress run ...

Related

Quasar does not run on localhost:8080

I run a quasar project "quasar dev" and it run without any error (see the log), but in the browser "http://localhost:8080" shows an empty screen. No calls, no result.
If I open "0.0.0.0:8080" it tries to start but without success.
Why does it happen? How to run the project on "localhost:8080"?

Electron package no window

I run electron-packager to make a distributable from my app, but when I start the App.app, no window is shown, only the top menu.
Question: How do I best debug / troubleshoot this?
The app starts a web server and makes a tcp connection to another server. The html for the electron app is served from the local web server.
This is the output when building:
$ npx electron-packager ./ App --overwrite
Packaging app for platform darwin x64 using electron v1.8.4
Wrote new app to /Users/user/www/app/App-darwin-x64
I tried to run the node app manually in package, but got this:
$ cd App-darwin-x64/App.app/Contents/Resources/app/
$ npm start
electron not found
From package.json:
"devDependencies": {
"electron": "^1.8.4",
"electron-packager": "^12.0.1"
},
$ node -v
v8.11.1
You can't run the app like that, you need to run it without the Content/Resources/app, as thats not where its stored. You need to run it from App-darwin-x64/App.app. You also don't call npm-start, as that's only called for running in dev.
Maybe try having a look at some example electron apps with build processes, try electron-vue as that has some good examples

how to place and use headless chrome binary on jenkins (linux) instance

actually i am struggling with absence of bigger picture on how to proceed , here is the case :
I have protractor test suite running headless using Chrome 60 (beta) binary by giving binary location in chrome options in windows environment.
I want to port this to available CI CD Jenkins instance (linux) and run headless there. I can think of two approaches :
Approach 1 :
Install chrome plugin in jenkins , so chrome becomes available to be driven by chrome driver < webdriver modules .so that i can use jenkins job as shown below :
npm install
npm run start (from script , runs webdriver-manager start )
npm run update (from script , runs webdriver-manager update )
npm run test (from script , runs protractor protactor.conf.js )
Approach 2 : install chrome as module like other npm modules .then
npm install
npm run start (from script , runs webdriver-manager start )
npm run update (from script , runs webdriver-manager update )
npm run test (from script , runs protractor protactor.conf.js )
I have looked into simple-headless-chrome , headless-chromium , chrome-runner npm modules , but not able to understand how these will work .
My understanding is to somehow have chrome binaries in node_modules and give path for chrome binaries in chrome options so that chrome driver can find it .
Can anyone enlighten me a little bit about bigger picture and how things will workout for Second approach .As i want dont have access to get chrome plugin installed on jenkins server and want to keep my setup independent.(nodejs and npm , java etc are available in jenkins)
About "using Chrome 60 (beta) binary by giving binary location in chrome options in windows environment.", you don't really need to, protractor gives you a way to specify tags to run the chrome binary:
https://github.com/angular/protractor/blob/master/docs/browser-setup.md#using-headless-chrome
I don't think you have a node module to install chrome, or at least something reliable as the google chrome itself, so what I've done was installing google chrome on my ubuntu server that runs the jenkins slave, and you now have a google-chrome binary you can run with --headless.
Previously my jenkins slave was running on a CentOS but I had a really hard time setting up chrome on it so changed to ubuntu.

Jenkins unable to run Calabash-iOS in the simulator

I am trying to run some test in the emulator using Jenkins, but whenever I start Cucumber, the script stop trying to launch UIAutomation.
Here are some facts:
I am using the last version of Cucumber, Calabash-ios and Run Loop
Jenkins is running as local LaunchAgent (~jenkins/Library/LaunchAgents/org.jenkins-ci.plist)
I already added jenkins user to _developer group, turn it in an admin
I set DevToolsSecurity -enable
I am not able to set security authorizationdb write system.privilege.taskport is-developer as it always return an error
Running the same test from the console over SSH works fine
Running the same test from Jenkins on a real device, works fine
I am running Jenkins into a VirtualBox machine
I have already tried to increase the timeout for Calabash (#calabash_launcher.relaunch({timout: 120, :uia_timeout => 30})
I have run out of idea about what to try to fix the issue.
Any suggestion is more than welcome.
UPDATE
I have been able to run the simulator by removing the SessionCreate property from org.jenkins-ci.plist, but now, I have to enter my password to unlock the keychain everytime I run a test.
I had a similar problem. To solve this I only need to export language:
export LC_ALL=en_US.UTF-8

Unable to get chrome driver working through jenkins

I am unable to get chrome driver working via Jenkins. My tests run fine from a terminal window but I wish to run them from Jenkins in headless mode.
I have the latest recommended version of chrome driver installed and Chrome version 28.0.1500.71. Chromedriver has been placed on my path at /Usr/bin.
However when I attempt to run the tests from Jenkins I get an error message:
"Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using chrome binary at: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome (Selenium::WebDriver::Error::UnknownError)"
I have also tried installing previous version of chrome and chromedriver but I get the same error message.
So after some investigation I found that in order to run headless tests via Jenkins you may need to have installed xvfb. (i say may because I am not 100% sure if this is correct) So I installed xvfb via Xquartz and the xvfb file is also on my path at /Usr/bin.
However even after doing the above with Xvfs I still get the error. Xvfs appears to start successfully as I get the message: Xvfb starting$ /Usr/bin/Xvfb :1 -screen 0 1024x768x24 -fbdir /Users/Shared/Jenkins/Home/2013-07-15_16-24-193595155347701391882xvfb in the console output in Jenkins.
Anybody have any idea what I am doing wrong? I am new to the world of Macs so there may be something I am missing.
Any help would be greatly appreciated!!
Managed to get this sorted. Instead of enabling Xvfb in the job configuration build environment section, I ran it using a terminal command and it now works. So my terminal command is now: xvfb-run cucumber --tags #automated - So this issue can be closed

Resources