question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Examples of tests written to leverage electron-mocha

See original GitHub issue

Hello

It would be great if this project had an examples folder containing 2 tests (one for the main process, one for a renderer process) for testing a fictional Electron demo app.

At the moment I’m a bit stuck in my tests, not knowing how to go further than just testing pure CommonJS modules, that is all what is not specific to Electron. Some things I would like to do:

  • Test a renderer process HTML view
  • Test a renderer process JavaScript
  • Show a menu and activate a menu item

Thanks a lot

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
madarchecommented, Dec 30, 2015

I have already read those https://github.com/jprichardson/electron-mocha/tree/master/test files, but they don’t answer to the questions:

  • How to test a renderer process HTML view (what HTML elements there are in the DOM document of the view)
  • How to test a renderer process JavaScript
  • How to show a menu and activate a menu item

Wouldn’t it better to leave this issue open until there are more meaningful examples?

I’m willing to provide (through a PR) the very simple Electron demo app and the 2 tests (for main and renderer) mentioned at the top if someone then provide me with guidance to craft meaningful tests. Are you interested?

0reactions
madarchecommented, Apr 12, 2016

As explained in details in #38 by @inukshuk, electron-mocha is just to run Mocha tests in Electron, not to test Electron apps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use Mocha to test my custom module that requires ...
js (this is the spectron example code from their github page). I run it with the "mocha" command through a package.json script (npm...
Read more >
Testing in Django (Part 1) – Best Practices and Examples
Examples. Setup; Testing Models; Testing Views; Testing Forms; Testing the API ... Testing helps you structure good code, find bugs, and write documentation ......
Read more >
How to Test React Components in TypeScript | Pluralsight
There are several benefits to leveraging TypeScript when testing: Enables better refactoring of tests, improving long-term maintenance. Ensures ...
Read more >
Node.js Unit Testing: Get Started Quickly With Examples
It's important to write unit tests in a way that tries all possible ... Fortunately, unit testing can be leveraged in this scenario....
Read more >
Testing Python Applications with Pytest - Semaphore Tutorial
This tutorial will demonstrate how to write tests for Python code with pytest, and how to utilize it to cater for a wide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found