I have an Electron app packaged as an app.asar file. It runs fine when opened with Electron, and I need to find a way to run tests on it through Robot Framework.
The problem is that while I can start the Electron app through Robot, I cannot find a way to pass it the app.asar file. And both the app and Electron are located in entirely different locations.
Based on the only very succinct source I could find mentioning both Electron and Robot Framework, I made the following:
vars.py :
binary_location = {"chromeOptions": {"binary": "C:/path/to/electron/electron.exe"}}
ElectronTest.txt
*** Settings ***
Library Selenium2Library
Library OperatingSystem
Variables vars.py
*** Variables ***
${Delay} 1s
${executor} http://localhost:9515
*** Test Cases ***
Foo
Set Selenium Speed ${Delay}
Create Webdriver Remote desired_capabilities=${binary_location} command_executor=${executor}
Wait Until Page Contains Element css=.workspace
[Teardown] Close All Browsers
*** Keywords ***
Set Environment Variable
webdriver.chrome.driver ./chromedriver.exe
This starts Electron but gives me the following error:
The app provided is not a valid electron app, please read the docs on how to write one: https://github.com/atom/electron/tree/master/docs
Error: Cannot find module 'C:\path\to\ElectronTest:data'
Which makes sense, considering I didn't actually pass the app, even though I don't know why it is looking for an app in the Robot Framework folder
I also tried replacing the executor with the path to my app, as such:
${executor} file://C:/path/to/my/app/dist/app.asar
In that case, I get the following error from Robot Framework:
URLError: urlopen error [Error 3] The system cannot find the path specified: u'path\to\my\app\dist\app.asar\session'
No idea why it would try to reach "app.asar\session".
I'm guessing I'm missing a parameter somewhere, but no matter how much I search and try, I cannot find any way to solve this.
Is there any way to pass a .asar file to Electron through Robot Framework?
chromeOptions
should begoog:chromeOptions
. Were you ever able to figure this problem out? – chasethesunnn