Closed Bug 525236 Opened 12 years ago Closed 11 years ago

[mozmill] - Uninstall Extension

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aakashd, Assigned: aakashd)

Details

(Whiteboard: [MozMill1.3Testday])

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
This test case is an add-on to the testExtensionInstallUninstall folder in restartTests. It opens the addons manager and checks to see if Adblock Plus is installed (shown in the extensions pane). It then clicks on in the uninstall button. After restart, the testcase checks the extensions pane for Adblock Plus and verifies it does not exist there. Note, this testscript will assume that adblock plus is highlighted as its the first extension in the list.


Litmus Test Cases Represented:
 * Litmus test #8164: Uninstall extension
 * Litmus test #6122: Uninstall extension
Attachment #409092 - Flags: review?(hskupin)
Whiteboard: [MozMill1.3Testday]
Comment on attachment 409092 [details] [diff] [review]
patch

>diff -r 526ef2748891 firefox/restartTests/testExtensionInstallUninstall/test3.js

What is the purpose of test3.js? Please put your test function into test2.js

>+// Shared variable
>+var gExtensionName = 'Adblock Plus';
>+var gExtensionId = '{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}';

We have to change that too. We already have a persisted object under mozmill which can store session data for tests after a restart. It's not documented right now because the v1.3 hasn't been released yet. Please see my update test how to use it. We should assign the above two items to it and re-use it in each following test. 

>+  // Open the addons manager and verify the extensions pane is selected
>+  controller.click(new elementslib.Elem(controller.menus["tools-menu"].menu_openAddons));
>+  controller.sleep(500);
>+  
>+  var window = mozmill.wm.getMostRecentWindow('Extension:Manager');
>+  var addonsController = new mozmill.controller.MozMillController(window);

Please always use getAddonsController to get the controller. That given way we needed only once to check if the menu item is working.

>+  // Wait for the Find Updates button to become visible
>+  var findUpdatesButton = new elementslib.ID(addonsController.window.document, "checkUpdatesAllButton");
>+  addonsController.waitForElement(findUpdatesButton, gTimeout);

Why do we need this check? We don't use it anymore and we should better wait for the element below:

>+  // Confirm the installed extension and assert its in the extensions box
>+  var extension = new elementslib.Lookup(addonsController.window.document, '/id("extensionsManager")/id("addonsMsg")/id("extensionsBox")/[1]/id("extensionsView")/id("urn:mozilla:item:' + gExtensionId + '")/anon({"flex":"1"})/{"class":"addonTextBox"}/anon({"anonid":"addonNameVersion"})/anon({"value":"' + gExtensionName + '"})');
>+  addonsController.assertNode(extension);

I feel we should write a helper function which can handle all this stuff over different tests. We have to use it a couple of times. Do you mind doing that, Aakash? Or shall I step in?

>+  // Verify gExtensionName is highlighted and then start uninstallation

The extension entry will be highlighted and not the gExtensionName.

>+  // Create a modal dialog instance to handle the Software Installation dialog

This should be the uninstallation dialog.

>+  // Wait for the restart button and click on it
>+  var restartButton = new elementslib.XPath(addonsController.window.document, "/*[name()='window']/*[name()='notificationbox'][1]/*[name()='notification'][1]/*[name()='button'][1]");
>+  addonsController.waitForElement(restartButton, gTimeout);  

We don't click on that button! Please update the comment.

>+  var extensionsPane = new elementslib.ID(addonsController.window.document, "extensions-view");
>+  var extensionsBox = new elementslib.Lookup(addonsController.window.document, '/id("extensionsManager")/id("addonsMsg")/id("extensionsBox")/[1]/id("extensionsView")/anon({"anonid":"main-box"})/anon({"class":"box-inherit scrollbox-innerbox"})');
>+
>+  addonsController.waitForElement(extensionsBox, gTimeout);
>+  addonsController.assertProperty(extensionsPane, "selected", "true");

That's the retention test? Please switch both lines and use waitForEval instead of assertProperty.
Attachment #409092 - Flags: review?(hskupin) → review-
Attached patch new patch (obsolete) — Splinter Review
Changes made after Henrik's nits in test2 and test functionality changes in test3.
Assignee: nobody → adesai
Attachment #409092 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #411516 - Flags: review?(hskupin)
Comment on attachment 411516 [details] [diff] [review]
new patch

This is r-. Only half of my comments have been addressed from the last review. Please check each of those comments before re-asking for review on a new patch. Please remind that for the next reviews. That way you load more work than necessary at me. Thanks! I will come up with a version which will fix those items. 

>diff -r 52451228aaf3 .hgignore
>--- a/.hgignore	Tue Sep 15 10:00:44 2009 +0200
>+++ b/.hgignore	Tue Nov 10 14:05:06 2009 -0800
>@@ -1,4 +1,4 @@
> # Filenames that should be ignored wherever they appear
> ~$
> \.DS_Store$
>-
>+.pyc$

That's not part of this patch.

> // Shared variable
> var gExtensionName = "Adblock Plus";
>+var gExtensionId = "{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}";

No usage of module.persited.

>+  addonsController = mozmill.getAddonsController();

It's already open so moving it to setupModule is better.

>+var testCheckUninstalledExtension = function() 
>+{
>+  // Open the addons manager and verify the extensions pane is selected
>+  controller.click(new elementslib.Elem(controller.menus["tools-menu"].menu_openAddons));
>+  controller.sleep(500);

I have already told at least 4 times not to use this way to open the Addons manager.

addonsController.waitForEval(addonsController.assertProperty(extensionsPane, "selected", "true") == 1);

I still wonder why you mix waitForEval and assertProperty calls.
Attachment #411516 - Flags: review?(hskupin) → review-
One more check had to be implemented to make sure the installation was successful in test1. If other extensions will be updated in the same step (like the MS framework) the test failed. That version should work on all platforms now. Windows sometimes still shows the cancel button during the installation but I don't have time to check that.
Attachment #411516 - Attachment is obsolete: true
Attachment #412643 - Flags: review?(adesai)
Comment on attachment 412643 [details] [diff] [review]
Patch (corrected)

Thanks Henrik. I'll use this coding style form now on.
Attachment #412643 - Flags: review?(adesai) → review+
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: Add-ons Manager → Mozmill Tests
Product: Toolkit → Mozilla QA
QA Contact: add-ons.manager → mozmill-tests
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.