-
Notifications
You must be signed in to change notification settings - Fork 341
Add ability to test app using selenium #90
Comments
@vidmed I'm not familiar with Selenium therefore I can't say what's the best approach to test an astilectron app with it. However if what you're saying is true, this is totally feasible, the only downside being you won't be able to captur stdout/stderr in GO anymore but I guess you'll be able to capture both of them in Selenium so this should be fine. My first instinct would be to do the following:
type Executer func(a *astilectron.Astilectron, cmd *exec.Cmd)
func(a *astilectron.Astilectron, cmd *exec.Cmd) {
// Start command
astilog.Debugf("Starting cmd %s", strings.Join(cmd.Args, " "))
if err = cmd.Start(); err != nil {
err = errors.Wrapf(err, "starting cmd %s failed", strings.Join(cmd.Args, " "))
return
}
// Watch command
go a.watchCmd(cmd)
}
func (a *Astilectron) executeCmd(cmd *exec.Cmd) (err error) {
var e = synchronousFunc(a.canceller, a, func() {
a.executer(a, cmd)
}, EventNameAppEventReady)
// Update display pool
if e.Displays != nil {
a.displayPool.update(e.Displays)
}
return
} What do you think? Did you have something else in mind? If this sounds fine, would you be willing to do a PR? Cheers |
Yeah, that is really cool. |
sure, you can add it in the Options. Don't forget to add a default value in the |
@vidmed - this PR appears to have added support for testing astilectron applications via Selenium but I'm not clear what needs to be done to actually use Selenium. Do you have an example project or short README that explains what needs to be configured on the astillectron side and how you have configured Selenium on the test harness side? Thanks! |
In the current implementation of go-astilectron there is no way to test application via selenium.
What is happening now:
The idea is add some test flag and when it is set the logic will be:
electron /path/to/astilectron/main.js 127.0.0.1:1111 flags
After that we will have ability to start selenium web driver using this bash file. When the driver starts and bash file executes TCP connection accepts and the app starts in normal way.
Actually in this way we are testing our app which uses astilectron.
What do you think about that?
The text was updated successfully, but these errors were encountered: