2

I'm trying to implement cypress in my electron app, but on first line of code which is cy.visit('index.html') it throws require is not defined

My index.html contains this inside <script> tag. Webpack preprocessing didn't make sense.

window.addEventListener("keydown", e => {
    if (e.ctrlKey && e.shiftKey && e.key === "I") { // для возможности открытия в релизных версиях
        let remote = require("electron").remote;
        remote.getCurrentWindow().toggleDevTools();
    }
});
// You can also require other files to run in this process
let render = require('./out/App').render;
render('id1');
set0gut1
  • 1,652
  • 1
  • 8
  • 21
zaebalo
  • 147
  • 2
  • 12
  • I can't comment ! [Take a look at this](https://stackoverflow.com/questions/44391448/electron-require-is-not-defined) – Mabrouki Fakhri May 05 '18 at 20:18
  • Don't know much about `cypress`, but yeah, make sure your node integration is turned on. See [here](https://stackoverflow.com/questions/36859984/require-not-defined-in-electron-html-page). – pushkin May 05 '18 at 23:33
  • @MabroukiFakhri didnt do a thing. Where should I add it? On index.html? If yes, it will still (and it does, actually) throw about require. – zaebalo May 06 '18 at 17:41

0 Answers0