Closed Bug 671059 Opened 13 years ago Closed 13 years ago

Add helper method to handle modal install dialog to Addons.js

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: u279076, Assigned: vladmaniac)

References

Details

Attachments

(2 files, 1 obsolete file)

All of the discovery pane tests for the Add-ons Manager are reusing the same code over and over again: >+/** >+ * Handle the modal dialog to install an addon >+ */ >+function handleInstallAddonDialog(controller) { >+ // Wait for the install button is enabled before clicking on it >+ var installButton = new elementslib.Lookup(controller.window.document, >+ '/id("xpinstallConfirm")' + >+ '/anon({"anonid":"buttons"})' + >+ '/{"dlgtype":"accept"}'); >+ controller.waitFor(function(){ >+ return !installButton.getNode().disabled; >+ }, "Install button is enabled: got '" + !installButton.getNode().disabled >+ + "', expected 'true'"); >+ >+ controller.click(installButton); >+} It would be useful if we could get this in the Addons shared module.
Blocks: 657492
Blocks: 658365
Blocks: 658369
Blocks: 664018
Assignee: nobody → vlad.maniac
Status: NEW → ASSIGNED
Attached patch Patch v1.0Splinter Review
Initial patch -- basically moves the handleAddonInstallDialog() function, which is in use in many discovery pane tests already, into the Addons API. I've tested this patch with some of the Discovery Pane tests and it works great. Vlad, if Henrik r- this patch, feel free to take over and make the revisions as necessary. Thanks.
Attachment #545523 - Flags: review?(hskupin)
Comment on attachment 545523 [details] [diff] [review] Patch v1.0 >+// XPath for modal dialog install button >+const MODAL_INSTALL_BUTTON = '/id("xpinstallConfirm")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}'; We don't use lookups anymore in this module. This should be moved to a selector or nodeCollector calls. >+ /** >+ * Handles the modal dialog to install an add-on >+ * >+ * @param {MozMillController} MozMill Controller >+ */ >+ handleInstallAddonDialog : function AddonsManager_handleInstallAddonDialog(aController) { This method cannot be part of the add-ons manager. It has to be global in this module. >+ // Wait for the install button to be enabled >+ mozmill.utils.waitFor(function() { nit: please add a space after function.
Attachment #545523 - Flags: review?(hskupin) → review-
Depends on: 671322
Attached patch patch v1.1 (obsolete) — Splinter Review
Added patch with requested changes
Attachment #545695 - Flags: review?(hskupin)
Comment on attachment 545695 [details] [diff] [review] patch v1.1 >+ var nodeCollector = new domUtils.nodeCollector(aController.window.document.documentElement); >+ >+ nodeCollector.queryNodes("#xpinstallConfirm"); >+ nodeCollector.root = nodeCollector.nodes[0]; >+ >+ var installButton = nodeCollector.queryAnonymousNodes("dlgtype", "accept").elements[0]; Can you please separate the last line into two? Means call nodeCollector.elements[0] in the next line. Also remove the empty line after the nodeCollector declaration. Everything is one single block here. > // Export of functions > exports.addToWhiteList = addToWhiteList; > exports.getInstalledAddons = getInstalledAddons; > exports.removeFromWhiteList = removeFromWhiteList; > exports.resetAmoPreviewUrls = resetAmoPreviewUrls; > exports.useAmoPreviewUrls = useAmoPreviewUrls; >+exports.handleInstallAddonDialog = handleInstallAddonDialog; Please keep the alphabetical order of the export statements.
Attachment #545695 - Flags: review?(hskupin) → review-
Attached patch patch v1.2Splinter Review
Patch with requested changes
Attachment #545695 - Attachment is obsolete: true
Attachment #545865 - Flags: review?(hskupin)
Attachment #545865 - Flags: review?(hskupin) → review+
Vlad, can you please file a new bug so we can get the workaround removed?
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: