How to execute getPath with Spectron?

83 Views Asked by At

Inside my Electron application I use remote.app.getPath('documents' to get the path of the users current documents directory. I also use Spectron and would like to access this directory inside my test.

What is the best way to execute this function within my Spectron test?

Unfortunately remote.app is undefined, therefore not available, and also the Application itself doesn't have any function.

test.beforeEach(async (t) => {
  (t.context as any).app = new spectron.Application({
    path: electronPath,
    args: [appPath]
  });

  // how to call getPath here?

  return (t.context as any).app.start();
});
0

There are 0 best solutions below