Closed Bug 680918 Opened 13 years ago Closed 13 years ago

Mozmill test for checking if restartless extension works after restart

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: remus.pop, Assigned: remus.pop)

References

Details

(Whiteboard: [mozmill-functional][mozmill-aom])

Attachments

(1 file, 5 obsolete files)

Tracking creation of new mozmill test that check if a restartless extension works after restart.

Litmus test: https://litmus.mozilla.org/show_test.cgi?id=17319
A Pivotal Tracker story has been created for this Bug: https://www.pivotaltracker.com/story/show/17301105
Assignee: nobody → remus.pop
Status: NEW → ASSIGNED
We can use the following test extension as example:
http://www.mozqa.com/data/firefox/addons/extensions/restartless.xpi

Probably we will have to add some more code to ensure the extension is really working, e.g. a menubar entry.
Whiteboard: [mozmill-aom]
We need the local extension.
Depends on: 685515
Attached patch initial patch (obsolete) — Splinter Review
In test1.js we install the extension and check if it has been installed.
In test2.js we right-click in a blank page to get to the context menu which holds an additional item created by our extension. Clicking the item takes us to the QMO page and then we check if the loaded page is the QMO one.
Attachment #562387 - Flags: review?(alex.lakatos)
Comment on attachment 562387 [details] [diff] [review]
initial patch

>+const LOCAL_INSTALL_SCRIPT = "addons/install.html?addon=";
It's not a script you're pointing to, it's a file. Please rename the const

>+const LOCAL_TEST_FOLDER = collector.addHttpResource('../../../../data/');
Can't we add data/addons directly here? Why are we adding the whole data directory? Do we need it further in the test?

>+const TIMEOUT_DOWNLOAD = 25000;
You don't need extended download time here, you're not using an internet connection when downloading the addon.

>+const ADDON = {
>+  name: "Restartless Addon",
Where are you using the name in the test? I can't see it.

>+  // Set category to 'Appearance'
>+  addonsManager.setCategory({
>+    category: addonsManager.getCategoryById({id: "extension"})
>+  });
You're not setting the category to appearance here. Modify the comment appropriately.

>+  expect.ok(addonIsInstalled, "The addon is successfully installed");
>+}
I feel this should be an assert, the test should fail immediatly if the addon did not install. Anthony, what's your opinion here?

>+  // Open content area context menu
>+  controller.rightClick(new elementslib.XPath(controller.tabs.activeTab,
>+                        "/html"));
Assign the new element here before using it.
Attachment #562387 - Flags: review?(alex.lakatos) → review-
Attached patch patch v2 (obsolete) — Splinter Review
Addressed all requested changes, including change of expect to assert.
Attachment #562387 - Attachment is obsolete: true
Attachment #563328 - Flags: review?(alex.lakatos)
Comment on attachment 563328 [details] [diff] [review]
patch v2

>+const TIMEOUT_DOWNLOAD = 5000;
you don't need this here. waitForDialog has a default timeout of 5000.

>+  md.waitForDialog(TIMEOUT_DOWNLOAD); 
Your specified timeout is equal to the default. Just use "md.waitForDialog();"

>+  // Click the item from the context menu to open QMO page and close the 
>+  // context menu
>+  controller.click(contextMenuItem);
>+  utils.closeContentAreaContextMenu(controller);
>+  controller.waitForPageLoad();
I think you should split this in two blocks like this:
>+  // Click the item from the context menu to open QMO page 
>+  controller.click(contextMenuItem);
>+
>+  // Close the context menu
>+  utils.closeContentAreaContextMenu(controller);
>+  controller.waitForPageLoad();

>+  // Verify that the loaded is contained within QMO url
>+  controller.waitFor(function () { 
>+    return EXPECTED_URL.indexOf(locationBar.getNode().value) !== -1;
>+  }, "Current URL should be contained within QMO url - got " +
>+     locationBar.getNode().value + ", expected " + EXPECTED_URL);
>+}
Why are you using here a waitFor and not an assert?
Attachment #563328 - Flags: review?(alex.lakatos) → review-
Attached patch patch v3 (obsolete) — Splinter Review
Addressed all issues and used expect instead of waitFor. Also used prefs to show the full url in the location bar.
Attachment #563328 - Attachment is obsolete: true
Attachment #563400 - Flags: review?(alex.lakatos)
Comment on attachment 563400 [details] [diff] [review]
patch v3

I'm going to r+ on this but hold off until the restartless addon lands in the repo before submitting for review further to Anthony.
Attachment #563400 - Flags: review?(alex.lakatos) → review+
Attachment #563400 - Flags: review?(anthony.s.hughes)
Comment on attachment 563400 [details] [diff] [review]
patch v3

>+++ b/tests/functional/restartTests/testAddons_RestartlessExtensionWorksAfterRestart/test1.js
>+/**
>+ * Test installing a restartless addon
>+ */
>+function testInstallAddon() {

testInstallRestartlessExtension()

>+  assert.ok(addonIsInstalled, "The addon is successfully installed");

Please include the add-on ID in the assertion.

>+++ b/tests/functional/restartTests/testAddons_RestartlessExtensionWorksAfterRestart/test2.js

>+var EXPECTED_URL = "http://quality.mozilla.org/";

>+/**
>+ * Test that verifies the addon works after browser restart
>+ */
>+function testThemeIsInstalled() {

testRestartlessExtensionWorksAfterRestart()

>+  // Context menu item that is provided by the restartless extension
>+  var contextMenuItem = new elementslib.ID(controller.window.document,
>+                                       "restartless-addon@quality.mozilla.org" +
>+                                       "-context-menu-item-0");

Use the addon ID instead of a hard-coded string.

>+  // Verify that the loaded url matches QMO url
>+  expect.equal(locationBar.getNode().value, EXPECTED_URL,
>+               "Current URL should match QMO url");

Use the EXPECTED_URL in the message so we know the value we expect.
Also, since it's our final check, this should be an assert.
Attachment #563400 - Flags: review?(anthony.s.hughes) → review-
Depends on: 684867
Attached patch patch v4 (obsolete) — Splinter Review
Addressed all requests except the last one. The message already includes EXPECTED_URL: "Current URL should match QMO url - '\"https://quality.mozilla.org/\" should equal '\"https://quality.mozilla.org/\"
Attachment #563400 - Attachment is obsolete: true
Attachment #574593 - Flags: review?(anthony.s.hughes)
Comment on attachment 574593 [details] [diff] [review]
patch v4

Canceling review of this patch due to bug 684867 comment 36
Attachment #574593 - Flags: review?(anthony.s.hughes)
Whiteboard: [mozmill-aom] → [mozmill-functional][mozmill-aom]
Depends on: 704831
Attached patch patch v5 (obsolete) — Splinter Review
All dependencies were resolved so I updated the patch.
Attachment #574593 - Attachment is obsolete: true
Attachment #577260 - Flags: review?(anthony.s.hughes)
Comment on attachment 577260 [details] [diff] [review]
patch v5

>+  // Verify the addon is installed
>+  var anAddon = addonsManager.getAddons({attribute: "value", value: ADDON.id})[0];
>+  var addonIsInstalled = addonsManager.isAddonInstalled({addon: anAddon});

We've used "addon" in the past (instead of "anAddon") -- let's not change that.
Attachment #577260 - Flags: review?(anthony.s.hughes) → review-
We're now using addon instead of anAddon variable.
Attachment #577260 - Attachment is obsolete: true
Attachment #579007 - Flags: review?(anthony.s.hughes)
Comment on attachment 579007 [details] [diff] [review]
patch v6:all [checked-in]

Landed:
http://hg.mozilla.org/qa/mozmill-tests/rev/d63e3d87117a (default)

Please check tomorrow's testrun to verify if this can be ported to other branches.
Attachment #579007 - Attachment description: patch v6 → patch v6 [checked-in:default]
Attachment #579007 - Flags: review?(anthony.s.hughes) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Can be landed on all branches because it hasn't failed.
Comment on attachment 579007 [details] [diff] [review]
patch v6:all [checked-in]

Landed:
http://hg.mozilla.org/qa/mozmill-tests/rev/17dad272c91f (mozilla-aurora)
http://hg.mozilla.org/qa/mozmill-tests/rev/d251fde20f08 (mozilla-beta)
http://hg.mozilla.org/qa/mozmill-tests/rev/9fff7143f494 (mozilla-release)
Attachment #579007 - Attachment description: patch v6 [checked-in:default] → patch v6:all [checked-in]
Patch has been landed across all branches -- please verify with tomorrow's testruns.
Keywords: checkin-needed
I assume this will also fail regarding all the other test failures we currently have for add-ons tests.
(In reply to Henrik Skupin (:whimboo) from comment #20)
> I assume this will also fail regarding all the other test failures we
> currently have for add-ons tests.

Potentially. Remus keep an eye on it and block this on bug 710143 if it does.
Hasn't failed since 17th of Decemeber so marking this as VERIFIED.
Status: RESOLVED → VERIFIED
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: