[mozmill] - Main Menu of Options (Preferences)

RESOLVED FIXED

Status

Mozilla QA
Mozmill Tests
RESOLVED FIXED
9 years ago
7 years ago

People

(Reporter: aakashd, Assigned: aakashd)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 5 obsolete attachments)

(Assignee)

Description

9 years ago
Created attachment 376325 [details]
AakashDesai_Options_testRestoreHomeToDefault.js

The following test Open the options dialog and verifies each pane opens and displays the correct pane associated with the button.

This test case won't work on Windows until the Bug listed in the "Depends On"
section is fixed.

It references litmus testcases:

 *  Testcase ID #5970 - Main Menu of Options (Preferences)
Attachment #376325 - Flags: review?(hskupin)
Comment on attachment 376325 [details]
AakashDesai_Options_testRestoreHomeToDefault.js

>var setupModule = function(module) {
>  controller = mozmill.getBrowserController();
>  prefController = mozmill.getPreferencesController();

No need for controller here. Remove it. Further add the module prefix too.

> *  Testcase ID #5970 - Main Menu of Options (Preferences)
> */
>var testOptionsPanes = function(){
>    
>  // Click on the Main Pane and verify its the correct pane and OS after UI catches up
>  prefController.click(new elementslib.Lookup(prefController.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"paneMain"}'));
>  prefController.sleep(150);
>  prefController.assertNode(new elementslib.ID(prefController.window.document, "browserHomePage"));

You don't have to check for the correct pane. Just click on all the selectors. Further you can do that in a loop. See attachment 376482 [details] [diff] [review] as an example. You can use the pane member for the identification. Also use a global delay.

>  // Close the Preferences Dialog Box

nit: it's a window

>  prefController.keypress(new elementslib.Lookup(prefController.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})'),27,false,false,false,false);
>}

Can you fire this event against the window itself please?
Attachment #376325 - Attachment is patch: false
Attachment #376325 - Flags: review?(hskupin) → review-
(Assignee)

Comment 2

9 years ago
Created attachment 376799 [details] [diff] [review]
AakashDesai_Options_testOptionsPanes.js

Crap, cancel that last attachment, Henrik. That was the wrong testscript.

Here's the real one. Sorry about that!
Attachment #376325 - Attachment is obsolete: true
Attachment #376799 - Flags: review?
Attachment #376799 - Flags: review? → review-
Comment on attachment 376799 [details] [diff] [review]
AakashDesai_Options_testOptionsPanes.js

>  // Click on the Main Pane and verify its the correct pane and OS after UI catches up
>  prefController.click(new elementslib.Lookup(prefController.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"paneMain"}'));
>  prefController.sleep(150);
>  prefController.assertNode(new elementslib.ID(prefController.window.document, "browserHomePage"));

Please don't use sleep here. Take a look at the utilsAPI and use its delayedAssertNode function for all your checks in this test. I get a lot of failed tests because of the delayed loading of the preference panes.

Further build an array of the panes so you can cycle through:
http://hg.mozilla.org/qa/mozmill-tests/rev/8460e0729f29

As an example for this test something like the following would be great;

var panes = [{pane: 'paneMain', id: 'browserStartupPage'},
             ...
             {pane: 'paneAdvanced', id: 'checkDefaultBox'}
            ];

Then you can operate on panes[ii].pane to click on the button and panes[ii].id to check for the element.

I'll update my page info test to do the same there.
Ok, the page info window test has been updated. Aakash, please use the same way for the preferences window. Don't check elements in the panels but the panel itself. All of them have an id.

see http://hg.mozilla.org/qa/mozmill-tests/rev/232eb68682bb
(Assignee)

Comment 5

9 years ago
Created attachment 377483 [details]
testOptionsPanes.js

Test case has been updated to be more in-line with the PageInfo test case. Also, the testscript name has been updated as well to work with the annotations of the codebase.
Attachment #376799 - Attachment is obsolete: true
Attachment #377483 - Flags: review?(hskupin)
Attachment #377483 - Attachment mime type: application/x-javascript → text/plain
Attachment #377483 - Flags: review?(hskupin) → review-
Comment on attachment 377483 [details]
testOptionsPanes.js

>const paneTemplate = '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/';

Move this down into the test please.

>const gDelay = 150;

Still wanna have a delay of 0 here.

>  var panes = [
>               {button: '{"pane":"paneMain"}', panel: 'paneMain'},
>               {button: '{"pane":"paneTabs","label":"Tabs"}', panel: 'paneTabs'},
>               {button: '{"pane":"paneContent","label":"Content"}', panel: 'paneContent'},
>               {button: '{"pane":"paneApplications","label":"Applications"}', panel: 'paneApplications'},
>               {button: '{"pane":"panePrivacy","label":"Privacy"}', panel: 'panePrivacy'},
>               {button: '{"pane":"paneSecurity","label":"Security"}', panel: 'paneSecurity'},
>               {button: '{"pane":"paneAdvanced","label":"Advanced"}', panel: 'paneAdvanced'}
>              ];

Please remove all the additional label attributes. They are not needed and will break the test for other locales.

>  for each (pane in panes) {
>	  var prefPane = paneTemplate + pane.button
>	  
>	  prefController.click(new elementslib.Lookup(prefController.window.document, prefPane));
> 	  prefController.sleep(gDelay);
>	  
>	  // Check if the panel has been shown
>      var node = new elementslib.ID(prefController.window.document, pane.panel);
>      utils.delayedAssertNode(prefController, node);

Please use 2 space indentation overall.

Otherwise it looks good.
(Assignee)

Comment 7

9 years ago
Created attachment 377503 [details]
testOptionsPanes.js

Here's the new version after that last set of comment #6
Attachment #377483 - Attachment is obsolete: true
Attachment #377503 - Flags: review?
Comment on attachment 377503 [details]
testOptionsPanes.js

Aakash, please set the correct mime type and requestee the next time. Thanks.
Attachment #377503 - Attachment mime type: application/x-javascript → text/plain
Attachment #377503 - Flags: review? → review?(hskupin)
Attachment #377503 - Flags: review?(hskupin) → review-
Comment on attachment 377503 [details]
testOptionsPanes.js

I made some improvements to your test and will upload it in a second.
Created attachment 377691 [details]
updated test

Aakash, accordingly to the litmus test we should at least check if the buttons have an image and label assigned. The label you can get with getAttribute() called on the node itself. The image is assigned via CSS and you can get it by querying the list-style-image CSS attribute.
(Assignee)

Comment 11

9 years ago
Dunno if this is really possible as the CSS files choose a certain OS  (files shown below) and iwdths and heights to cut off the png image.

http://mxr.mozilla.org/mozilla1.9.1/source/browser/themes/winstripe/browser/preferences/preferences.css

http://mxr.mozilla.org/mozilla1.9.1/source/browser/themes/pinstripe/browser/preferences/preferences.css

http://mxr.mozilla.org/mozilla1.9.1/source/browser/themes/gnomestripe/browser/preferences/preferences.css

If you know how to do that, please tell me as I have no idea!
Meanwhile I'm not sure anymore if we should compare the button images. Mikeal what do you think? Mozmill isn't designed for image comparisons. Shall we leave those things out?
The preferences dialog API has been implemented. See bug 486407 for an example how to implement it.

Aakash, please leave the image alone. It doesn't look like something we can easily check with Mozmill. Tracy, are the images in the tabstrip of the preference dialog covered by Eggplant?
Assignee: nobody → adesai
Status: NEW → ASSIGNED
Created attachment 383382 [details] [diff] [review]
Working patch after API implementation

This patch contains all the changes which are needed to run tests against the preferences dialog. Please use the same way in all the other tests.
Attachment #377503 - Attachment is obsolete: true
Attachment #377691 - Attachment is obsolete: true
Checked in as: http://hg.mozilla.org/qa/mozmill-tests/rev/b0eaf9e85a67
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Mass move of Mozmill Test related project bugs to newly created components. You can filter out those emails by using "Mozmill-Tests-to-MozillaQA" as criteria.
Component: Preferences → Mozmill Tests
Product: Firefox → Mozilla QA
QA Contact: preferences → mozmill-tests
You need to log in before you can comment on or make changes to this bug.