I am having issues with cy.visit hanging in electron only, but chrome is fine. There are no errors in the console with cypress run, so would like to run cypress open with electron, but not sure how. cypress open --browser electron or node_modules/cypress/bin/cypress open --browser node_modules/electron/dist/Electron.app/Contents/MacOS/Electron doesn't work.
I have tried cypress run --headed but cypress run doesn't allow you to stop the test mid way through and investigate what is wrong. Pausing the test closes the window.
As stated in the docs about the open command, the browser flag is used only to specify a path to a custom browser to be added to the list of available browsers in Cypress. Electron being the default browser bundled with Cypress, you don't have to specify it when launching the UI. You can choose any browser you need on the UI before launching a test suite (see screenshoot).
Related
I'm working on electron-react-boilerplate and I'm stuck on how to debug its main process (such as the src/main/main.ts file.
To reproduce my situation, simply follow the below steps, as documented in the above link:
git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git electron-react-boilerplate
cd electron-react-boilerplate
npm i
npm start
Now, I learnt how to debug the client side (browser side) js/ts script, as it is as simple as opening the dev tools and open the sourcemap-ed files, I can place a breakpoint.
But how is the main process, the electron process? I quickly googled it and found a github issue and the Debugging the Main Process guide page, it says:
Connect Chrome by visiting chrome://inspect and selecting to inspect the launched Electron app present there
So do I need to modify the package.json file in order to be able to debug the electron process files? (I tried to test with adding --inspect=5858 --remote-debugging-port=9223, opening a chrome with --remote-debugging-port=9223, opening "localhost:5858", or "chrome://inspect", but nothing happens. The devices tabs does not show the electron instance either.)
What am I missing with my setup? Thanks for your help.
If you are still facing the same issue it seems that they have released a fix for this,
the commit that fixed the issue.
I was able to debug both main and renderer after this.
I want to start using Microsoft Playwright for my web application. When running npx folio to start my tests its targeting this folder by default C:\Users\john\AppData\Local\ms-playwright\firefox-1225\firefox\firefox.exe but that is not where I want it to target.
It results in an error when running npx folio because firefox.exe does not exist in that directory
C:\Users\john\AppData\Local\ms-playwright\firefox-1225\firefox\firefox.exe does not exist...
How do I get pass this?
I'd love to start working with electron.net but the thing that keeps me from doing so is the way you have to start and debug your app. On the GitHub page it says you always have to run "dotnet electronize start" in the console (https://github.com/ElectronNET/Electron.NET#start-the-application) just to start the app and if you want to debug it you have to manually attach the process to visual studios debugger (https://github.com/ElectronNET/Electron.NET#debug ). Is there a way where I can run and debug the app just like any other asp.net app?
I don't know about the '.NET' part but for Electron development, I love electron reload (github source) It reloads an electron app on source file changes.
Perhaps you can add in a console cmd to do what you need to get 'NET working.
browser tests need to be run from command line like pub run test -pdartium. Is there a way to debug such tests.
The Dart team is working hard to make tests with the new test package debuggable. Until the related issues are fixed you can use this workaround:
To run browser tests with the new test package, for example from WebStrom, including debugging, just replace the <x-test-dart ...> tag with a normal Dart script tag pointing to your test file and run it like any Dart browser application from WebStorm.
This also works for Polymer tests. Ensure you run await initPolymer(); or the appropriate initialization necessary for the used Polymer version.
I usually create a copy of the test entry page file where I can keep the replaced script tag.
pub run test -pdartium --pause-after-load
starts the test only after I click a "play" button on the test page. This gives me time to open up Dev Tools in Dartium and set breakpoints. I can also open up the Observatory and do stuff there.
We are currently working on getting better code coverage for one of our JS libraries. I have the The Intern up and running, and can run tests in the browser. However, our libraries create DOM elements in some of their functions, making it so we can't run JUnit from the terminal because Node.js doesn't allow for DOM construction in tests. Is there a way we can get JUnit code coverage on the html and console output we get when we run The Intern in the browser?
I found the answer. From this link: https://theintern.github.io/intern/#local-selenium
Using ChromeDriver (Chrome-only)
If you’re just looking to have a local environment for developing functional tests, a stand-alone ChromeDriver installation works great.
1. Download the latest version of ChromeDriver
2. Set tunnel to 'NullTunnel'
3. Run chromedriver --port=4444 --url-base=wd/hub
4. Set your environments capabilities to [ { browserName: 'chrome' } ]
5. Run the test runner
Once you have that setup and running, you can run
node_modules/intern/bin/intern-runner.js config=tests/intern reporters=JUnit filename=junit.xml
This will allow the tests to run in a chrome instance, and then output the results to a report that can then be upload somewhere.