Closed
Bug 906712
Opened 11 years ago
Closed 10 years ago
implement tab modal dialog handling for desktop with Marionette (alert, confirm, prompt)
Categories
(Testing :: Marionette Client and Harness, defect, P1)
Testing
Marionette Client and Harness
Tracking
(firefox38 fixed)
RESOLVED
FIXED
mozilla38
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: automatedtester, Assigned: chmanchester)
References
(Blocks 1 open bug)
Details
(Keywords: pi-marionette-client, pi-marionette-server, pi-marionette-spec, Whiteboard: [marionette=1.0])
Attachments
(2 files, 1 obsolete file)
we need to support handling of desktop modals like prompt/alert and confirmation via Marionette
Comment 1•11 years ago
|
||
I plan to take it. Here's how I am going to implement.
Because there's no easy way to spoof alert or prompt function. I will rewrite some impelmentation of prompt service.
First, I'll add a promptService.js under <gecko>/testing/marionette/components which implements nsIprompt and nsIpromptService.
Second, there will be a marionette-alert.js under <gecko>/testing/marionette which implements the control of prompt/alert. For the automation, users only need to interact with the marionette-alert.js for prompt controlling.
Also, there will be unit tests for prompts as well.
Updated•11 years ago
|
Assignee: nobody → ato
Comment 2•11 years ago
|
||
Andreas is going to take this, and start by implementing the alert API's. Al, this bug is for desktop Firefox only; the B2G modal dialog handling is handled in bug 779284; let us know if that isn't sufficient for your needs.
Comment 3•11 years ago
|
||
Enhancing summary a bit to make this bug easier to find, hope you don't mind Andreas! ;-)
Summary: implement modal dialog handling for desktop with Marionette → implement modal dialog handling for desktop with Marionette (alert, confirm, prompt)
Comment 4•11 years ago
|
||
Will this work cover showModalDialog() as well? Hopefully on the way out though..
Reporter | ||
Updated•11 years ago
|
Whiteboard: [spec]
Reporter | ||
Updated•11 years ago
|
Priority: -- → P1
Reporter | ||
Updated•11 years ago
|
Keywords: ateam-marionette-spec
Reporter | ||
Updated•10 years ago
|
Keywords: ateam-marionette-client,
ateam-marionette-server
Comment 5•10 years ago
|
||
Not working on this anymore because of refactoring work.
Assignee: ato → administration
Comment 6•10 years ago
|
||
I suppose this bug doesn't cover HTTP auth dialogs - is there a bug for handling those?
Reporter | ||
Comment 7•10 years ago
|
||
(In reply to Hallvord R. M. Steen [:hallvors] from comment #6)
> I suppose this bug doesn't cover HTTP auth dialogs - is there a bug for
> handling those?
that is covered under bug 887274 since they have slightly different mechanisms
Comment 8•10 years ago
|
||
As we talked during the work week this bug is specifically for in-tab modal dialogs, like those which are raised with window.alert().
David, we might want to have a look at bug 887274 first, and maybe set the preference "prompts.tab_modal.enabled" to false for the time being until this bug has been fixed? With that we always get global modal dialogs.
Flags: needinfo?(dburns)
Summary: implement modal dialog handling for desktop with Marionette (alert, confirm, prompt) → implement tab modal dialog handling for desktop with Marionette (alert, confirm, prompt)
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Whiteboard: [spec] → [spec][marionette=1.0]
Reporter | ||
Updated•10 years ago
|
Whiteboard: [spec][marionette=1.0] → [marionette=1.0]
Assignee | ||
Comment 10•10 years ago
|
||
:ato, if you're not working on this do you see any reason I couldn't get it started (understanding that things might need significant updates once bug 1107706 lands)?
Flags: needinfo?(ato)
Comment 11•10 years ago
|
||
(In reply to Chris Manchester [:chmanchester] from comment #10)
> :ato, if you're not working on this do you see any reason I couldn't get it
> started (understanding that things might need significant updates once bug
> 1107706 lands)?
No, please go ahead. (-:
Flags: needinfo?(ato)
Assignee | ||
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
Chris, one question which comes into my mind when checking the try patch. What kind of tab modal dialogs do we have at all? In your patch I see a lot of code handling the default elements. But would Marionette also be able to handle a new type of dialog?
Assignee: administration → cmanchester
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Assignee | ||
Comment 14•10 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #13)
> Chris, one question which comes into my mind when checking the try patch.
> What kind of tab modal dialogs do we have at all? In your patch I see a lot
> of code handling the default elements. But would Marionette also be able to
> handle a new type of dialog?
If your concern is that I'm interacting with front-end ui classes directly and making those a dependency, I share that concern. But what do you mean by a new type of dialog? These are the default elements, but until they're changed for some reason (and while that's unfortunate, these tests will fail and we'll know we need to update when that happens) it seems like they're the only ones that will be shown as a result of alert/confirm/prompt.
The platform code shares some logic between global notifications and tab-modals, so I'm going to look at the http auth dialogs next to see if we can generalize a bit in marionette.
Comment 15•10 years ago
|
||
(In reply to Chris Manchester [:chmanchester] from comment #14)
> If your concern is that I'm interacting with front-end ui classes directly
> and making those a dependency, I share that concern. But what do you mean by
> a new type of dialog? These are the default elements, but until they're
> changed for some reason (and while that's unfortunate, these tests will fail
> and we'll know we need to update when that happens) it seems like they're
> the only ones that will be shown as a result of alert/confirm/prompt.
Those seem to be not the only ones. Please have a look at about:preferences and click on "Use Bookmark" for the home page setting. The sub dialog which comes up seem to be similar.
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #15)
> (In reply to Chris Manchester [:chmanchester] from comment #14)
> > If your concern is that I'm interacting with front-end ui classes directly
> > and making those a dependency, I share that concern. But what do you mean by
> > a new type of dialog? These are the default elements, but until they're
> > changed for some reason (and while that's unfortunate, these tests will fail
> > and we'll know we need to update when that happens) it seems like they're
> > the only ones that will be shown as a result of alert/confirm/prompt.
>
> Those seem to be not the only ones. Please have a look at about:preferences
> and click on "Use Bookmark" for the home page setting. The sub dialog which
> comes up seem to be similar.
That does have a similar role, but I don't see how it would be triggered by alert/confirm/prompt in a content script, and would require a different mechanism to interact with (it's a "groupbox" element, not a "tabmodalprompt" element). This seems like the sort of thing we'll need to add to the greenlight ui libraries.
Comment 17•10 years ago
|
||
Not sure where you get this information from, but its not a groupbox! I checked it myself now, and it is indeed a tab modal dialog:
http://dxr.mozilla.org/mozilla-central/source/browser/components/preferences/in-content/main.js#328
See `modal=yes` in the call to open(). So it fits in here perfectly.
With that I still think the logic as getting implemented here, should be able to cope with any kind of tabmodal dialog. But as you say, the core Marionette code might only have to handle the default dialog buttons which are in use by websites. On the other side the code has to give us (in the greenlight repository) the chance to handle everything else in it.
Assignee | ||
Comment 18•10 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #17)
> Not sure where you get this information from, but its not a groupbox! I
> checked it myself now, and it is indeed a tab modal dialog:
>
> http://dxr.mozilla.org/mozilla-central/source/browser/components/preferences/
> in-content/main.js#328
>
> See `modal=yes` in the call to open(). So it fits in here perfectly.
>
> With that I still think the logic as getting implemented here, should be
> able to cope with any kind of tabmodal dialog. But as you say, the core
> Marionette code might only have to handle the default dialog buttons which
> are in use by websites. On the other side the code has to give us (in the
> greenlight repository) the chance to handle everything else in it.
I got that from the browser toolbox inspector -- it looks like preferences/in-content/main.js puts a "dialog" element inside the "groupbox" element. What I'm saying is it doesn't share the ui structure of the tab modals produced by alert/confirm/prompt, so there isn't a "button0" to click on, for instance. However, the version you get with prompts.tab_modal.enabled turned off does, so that can share some of this code:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9ae875e1763d
Assignee | ||
Comment 19•10 years ago
|
||
Assignee | ||
Comment 20•10 years ago
|
||
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.
Pull down this commit:
hg pull review -r fe2ebaecea93115a93029dba67e4e3087a49ae05
Assignee | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: feedback?(ato)
Assignee | ||
Comment 21•10 years ago
|
||
https://reviewboard.mozilla.org/r/1993/#review1299
::: testing/marionette/marionette-server.js
(Diff revision 1)
> + this._dialogWindowRef = Cu.getWeakReference(null);
I don't think this is the right thing to do here, I will update.
Reporter | ||
Comment 22•10 years ago
|
||
https://reviewboard.mozilla.org/r/1993/#review1559
::: testing/marionette/marionette-server.js
(Diff revision 1)
> + "getDialogText": MarionetteServerConnection.prototype.getDialogText,
I wonder if getTextFromDialog would be better as that is more symmetrical with the sendKeysToDialog
::: testing/marionette/client/marionette/marionette.py
(Diff revision 1)
> + def dismiss_alert(self):
I would prefer if we were to emulate the API in http://selenium.googlecode.com/git/docs/api/py/webdriver/selenium.webdriver.common.alert.html#module-selenium.webdriver.common.alert
This forces the test writer to know that they are in an alert rather than blindly using alert API
::: testing/marionette/client/marionette/tests/unit/test_modal_dialogs.py
(Diff revision 1)
> +
It would be useful to see how this works with onBeforeUnload alerts
::: testing/marionette/client/marionette/tests/unit/test_modal_dialogs.py
(Diff revision 1)
> +
It would be useful to have tests that try do something like getAttribute/click/<something that is not alert related> when there is an alert
::: testing/marionette/marionette-server.js
(Diff revision 1)
> + if (appName != "B2G") {
this should probably be appName === 'Firefox' since we aren't sure that it works on fennec if we were to switch it on.
Assignee | ||
Comment 23•10 years ago
|
||
(In reply to David Burns :automatedtester from comment #22)
> It would be useful to see how this works with onBeforeUnload alerts
I've just added a test for this, and it handles these as it does alert/confirm/prompt, but I'm not sure that's right. Should we be automatically dismissing or accepting these as soon as they come up, or giving tests the opportunity to dismiss or accept themselves?
Flags: needinfo?(dburns)
Assignee | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: feedback?(ato)
Assignee | ||
Comment 24•10 years ago
|
||
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.
Pull down this commit:
hg pull review -r ab9066fa12e99cee6adec63ee389d04960216943
Assignee | ||
Comment 25•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
I pushed up the tests for onbeforeunload, didn't mean to unset the feedback flag!
Attachment #8544119 -
Flags: feedback?(ato)
Reporter | ||
Comment 26•10 years ago
|
||
(In reply to Chris Manchester [:chmanchester] from comment #23)
> (In reply to David Burns :automatedtester from comment #22)
> > It would be useful to see how this works with onBeforeUnload alerts
>
> I've just added a test for this, and it handles these as it does
> alert/confirm/prompt, but I'm not sure that's right. Should we be
> automatically dismissing or accepting these as soon as they come up, or
> giving tests the opportunity to dismiss or accept themselves?
We shouldn't automatically handle them, we might add a capability in the future to do that but for now we would expect the developer to handle that situation
Flags: needinfo?(dburns)
Assignee | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: feedback?(ato)
Assignee | ||
Comment 27•10 years ago
|
||
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.
Pull down this commit:
hg pull review -r 4bf6b087ff8c64210646ed07ae3c04fd4a402c45
Assignee | ||
Comment 28•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
I didn't mean to unset the feedback flag that time either. I'll just add to mozreview.
Assignee | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: review?(ato)
Assignee | ||
Comment 29•10 years ago
|
||
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.
Pull down this commit:
hg pull review -r 4bf6b087ff8c64210646ed07ae3c04fd4a402c45
Assignee | ||
Comment 30•10 years ago
|
||
Review ping
Comment 31•10 years ago
|
||
(In reply to Chris Manchester [:chmanchester] from comment #30)
> Review ping
People might miss who is meant here. So lets n-i Andreas.
Flags: needinfo?(ato)
Reporter | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: review+
Reporter | ||
Comment 33•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
https://reviewboard.mozilla.org/r/1993/#review2795
Ship It!
Reporter | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: review?(ato)
Assignee | ||
Comment 34•10 years ago
|
||
Thanks for the review. The tests I wrote for this seem racy with e10s enabled, I'm going to see if I can work that out before landing.
Assignee | ||
Comment 35•10 years ago
|
||
The issue that cropped up in comment 34 was a problem with timing, but also the tests weren't cleaning up after themselves (an onbeforeunload handler from a prior test was impeding progress).
I noticed running on a different OS for the case of global modal windows and with e10s enabled, the last test about the behavior when trying to process other commands when a modal is present isn't valid: .click() is processed by the underlying page when issued by marionette (although not when I try clicking it myself). I'm guessing marionette shouldn't process this click command when it doesn't correspond to something a user can do, so maybe this is something that needs to be dealt with in a follow up.
I'm planning to run this through try again Monday and land more or less in its current form if all goes well there.
Assignee | ||
Comment 36•10 years ago
|
||
Assignee | ||
Comment 37•10 years ago
|
||
I'm waiting on try results here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9a7fa6138bba&exclusion_profile=false&exclusion_state=all
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b579833f4ee8
I'll check back in the morning.
Assignee | ||
Comment 38•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.;r=automatedtester
Pull down this commit:
hg pull review -r 5562da9f13b7b83f915fcf4760dee98e12a6dae7
Attachment #8544119 -
Flags: review+
Assignee | ||
Comment 39•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
Try looks good. This needed somewhat substantial changes, an additional sanity check seems in order.
Attachment #8544119 -
Flags: review?(dburns)
Reporter | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: review?(dburns)
Reporter | ||
Comment 40•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
https://reviewboard.mozilla.org/r/1993/#review2901
::: testing/marionette/client/marionette/marionette.py
(Diff revision 4)
> +class Alert(object):
In webdriver we have switch_to_alert() call that is essentially something like
```
def switch_to_alert(self):
return Alert(self)
```
I noticed in tests we call this directly e.g.
```
Alert(self).<method>
```
the `switch_to_alert()` would be a lot more elegant from an API point of view. I am happy for this to be a follow up bug (even a good first bug) (sorry for not noticing this before)
Assignee | ||
Comment 41•10 years ago
|
||
(In reply to David Burns :automatedtester from comment #40)
> Comment on attachment 8544119 [details]
> MozReview Request: bz://906712/chmanchester
>
> https://reviewboard.mozilla.org/r/1993/#review2901
>
> ::: testing/marionette/client/marionette/marionette.py
> (Diff revision 4)
> > +class Alert(object):
>
> In webdriver we have switch_to_alert() call that is essentially something
> like
>
> ```
> def switch_to_alert(self):
> return Alert(self)
> ```
>
> I noticed in tests we call this directly e.g.
> ```
> Alert(self).<method>
> ```
>
> the `switch_to_alert()` would be a lot more elegant from an API point of
> view. I am happy for this to be a follow up bug (even a good first bug)
> (sorry for not noticing this before)
Oh, that's much better. I guess it would be cleaner to do it here so we don't get users of the other API creeping in.
Assignee | ||
Comment 42•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
/r/1995 - Bug 906712 - Tab modal dialog support for marionette.;r=automatedtester
/r/3697 - Bug 906712 - Add a switch_to_alert API to marionette for handling alerts;r=automatedtester
Pull down these commits:
hg pull review -r c371d195af2d4e5ca154ee5e1a06d5d8528bf319
Attachment #8544119 -
Flags: review?(dburns)
Reporter | ||
Comment 43•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Attachment #8544119 -
Flags: review?(dburns) → review+
Reporter | ||
Comment 44•10 years ago
|
||
Comment on attachment 8544119 [details]
MozReview Request: bz://906712/chmanchester
https://reviewboard.mozilla.org/r/1993/#review2921
Ship It!
Assignee | ||
Comment 45•10 years ago
|
||
Comment 46•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f81edee561a2
https://hg.mozilla.org/mozilla-central/rev/5a3852f540bb
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Assignee | ||
Comment 47•9 years ago
|
||
Attachment #8544119 -
Attachment is obsolete: true
Attachment #8618017 -
Flags: review+
Attachment #8618018 -
Flags: review+
Assignee | ||
Comment 48•9 years ago
|
||
Assignee | ||
Comment 49•9 years ago
|
||
Updated•2 years ago
|
Product: Testing → Remote Protocol
Comment 51•2 years ago
|
||
Moving bugs for Marionette client due to component changes.
Component: Marionette → Marionette Client and Harness
Product: Remote Protocol → Testing
You need to log in
before you can comment on or make changes to this bug.
Description
•