Marionette needs support for inside application triggered restarts and shutdowns

RESOLVED WORKSFORME

Status

defect
P2
normal
RESOLVED WORKSFORME
5 years ago
3 years ago

People

(Reporter: whimboo, Unassigned)

Tracking

({pi-marionette-runner})

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Spun-off from bug 940954:

> > David, please be aware that in case for Mozmill tests we also need a restart
> > triggered by an action inside of Firefox, e.g. restart button after
> > installing an add-on. If you think that this should be moved out to a new
> > bug please let me know and I can file one with out specific needs.

So that means that marionette has to ensure to keep the test running if a restart has been triggered from within the application itself. That means it will restart by spawning a new process itself. 

From my experience with Mozmill this is a kinda tricky thing in case of data exchange. So you will have to ensure that the client part of Marionette got all the status bits from the server, and nothing gets lost. In Mozmill we are registering a 'quit-application-requested' observer, which only allows the restart once all data has been transferred.

Further Marionette could think that the application closed because it went down sporadically. So it may be necessary to set a flag that an restart is coming up.

All the above would also apply to a possible shutdown scenario triggered by the application.

For Mozmill I lately added handling for the exit code, which is kinda helpful in some situations, like bug 1057246. 

This blocks nearly all of our restart tests we have to transfer to Marionette.
This is going to be tricky since Marionette can handle this but we need to figure out how to get the details of the browser running back into MozRunner otherwise we will be left with a browser open.

The way that I am envisaging a test would look roughly is

```
element.click() # Causes the browser to restart
self.marionette.connect() # reconnect back to the browser. Connect would try reconnect for upto 30s and then error if it can't

# Now we need to get the MozRunner to be aware of the new PID and be able to stop it.
```
Not a P1; this isn't even working in mozmill right now.
Priority: P1 → P2
A way to handle this was implemented in https://bugzilla.mozilla.org/show_bug.cgi?id=940954#c1

If we need this for update tests we might be able to pursue something along those lines unless there's an issue with that approach that caused it to be dropped.
Henrik, if you can sign off on comment 4 being what we need for update tests I'll get started today.
Flags: needinfo?(hskupin)
Looks like I never updated the bug after one of the meetings we had. As said there this is not a blocker. As long as we can issue a restart via Marionette. And to get this working we would also have to get bug 1137388 fixed first, which is the real blocker for our restart tests atm.
Depends on: 1137388
Flags: needinfo?(hskupin)
The `in_app` argument for quit() and restart() is around for a while now and works like a charm. So this bug got fixed by that.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.