Closed Bug 529421 Opened 15 years ago Closed 15 years ago

[mozmill] - Disable a Plugin

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aakashd, Assigned: whimboo)

References

Details

(Whiteboard: [mozmill-doc-complete])

Attachments

(1 file, 9 obsolete files)

Attached patch WIP patch (obsolete) — Splinter Review
The testcase will disable the plugin via the Add-ons Manager and then test whether the notification bar pops up. Afterwards, it will re-enable the plugin and check if its functionality is now working. Litmus Testcases Represented: * Litmus test #8511: Disabling a Plugin * Litmus test #6475: Disabling a Plugin
Attachment #412967 - Attachment is patch: true
Attachment #412967 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 412967 [details] [diff] [review] WIP patch Just some drive-by comments... >+ // 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); Use getAddonsController() here. >+ // Select the flash plugin and disable it >+ var flashPluginEntry = new elementslib.ID(controller.window.document, "urn:mozilla:item:Flash Player.plugin"); That has to be addonsController.window.document >+ var flashDisableButton = new elementslib.Lookup(addonsController.window.document, '/id("extensionsManager")/id("addonsMsg")/id("extensionsBox")/[1]/id("extensionsView")/id("urn:mozilla:item:Flash Player.plugin")/anon({"flex":"1"})/{"class":"addonTextBox"}/anon({"anonid":"selectedButtons"})/{"accesskey":"D"}'); The accesskey is odd. Do we have another id we can use here? Or how many childs exist here? If it's constant we can use an array identifier here too. >+ addonsController.waitThenClick(flashDisableButton, gTimeout); >+ addonsController.assertProperty(flashDisableButton, "disabled", "true"); How long can this transition take? On slower systems it will eventually fail. Can you please use waitForEval instead? >+ controller.open("http://www.adobe.com/shockwave/welcome/"); That's not a good example page. We should use a page which only embeds a Flash player object. This page should be better: http://www.adobe.com/se/products/flashplayer/ >+ // 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); See above. You can move it completely to setupModule and open the addons manager already there. So we don't have to do that twice. >+ var flashEnableButton = new elementslib.Lookup(addonsController.window.document, '/id("extensionsManager")/id("addonsMsg")/id("extensionsBox")/[1]/id("extensionsView")/id("urn:mozilla:item:Flash Player.plugin")/anon({"flex":"1"})/{"class":"addonTextBox"}/anon({"anonid":"selectedButtons"})/{"accesskey":"E"}'); Please check for the accesskey here too. >+ addonsController.waitThenClick(flashEnableButton, gTimeout); >+ addonsController.assertProperty(flashEnableButton, "disabled", "false"); See above. >+ // Visit youtube and verify the plugin notification bar pops up and the puzzle piece UI is shown >+ controller.open("http://www.adobe.com/shockwave/welcome/"); Comment and web page don't match. Please use the same url as above and declare it as constant. >+ var label = UtilsAPI.getProperty("chrome://browser/locale/browser.properties", "missingpluginsMessage.button.label"); >+ var installMissingPluginButton = UtilsAPI.createNotificationBarElement(controller, '/{"value":"missing-plugins"}/{"label":"' + label + >+ '"}'); You are using this twice. It can also be moved to setupModule. Can you please close the addons manager window inside the tearDownModule? We made a mistake in the last tests to place it at the end of the test function. If a test fails it will never be called and the window stays open.
Attached patch patch (obsolete) — Splinter Review
This testcase passes on via 1.3 IDE for OSX and XP. I'm not sure what's going on, but this fails via command line on the latest mozmill-trunk (1.3+) on osx. Please go ahead and review.
Assignee: nobody → adesai
Status: NEW → ASSIGNED
Attachment #414118 - Flags: review?(hskupin)
Comment on attachment 414118 [details] [diff] [review] patch Can you please attach it as a patch? > // Set the id of the flash player entry for each platform > if (mozmill.isWindows) > { > module.flashName = "urn:mozilla:item:NPSWF32.dll"; > } else if (mozmill.isMac) Just for the next time... if/else constructs the brackets are on the same line. > addonsController.waitThenClick(flashDisableButton, gTimeout); > addonsController.sleep(500); > addonsController.waitForEval("subject.getAttribute('isDisabled') == 'true'", gTimeout, 100, flashPluginEntry.getNode()); Do we really need a sleep call here? We are waiting for isDisabled and the node should be existent. > addonsController.waitThenClick(flashEnableButton, gTimeout); > addonsController.sleep(500); > addonsController.waitForEval("subject.getAttribute('isDisabled') == 'false'", gTimeout, 100, flashPluginEntry.getNode()); Same applies to this test. You should add a tearDownModule and make sure that the Flash plugin is definitely enabled after the test. I believe that there should be a backend function we can use to enable the plugin again.
Attachment #414118 - Flags: review?(hskupin) → review-
aakashd: whimboo: i can't click on disable/enable a plugin unless the plugin is viewable in the manager aakashd: whimboo: and scrolling until it is viewable isnt going to be fun whimboo: we have a bug for chrome elements already filed. Dependency added
Depends on: 524310
Attached patch real patch (made sure!) (obsolete) — Splinter Review
The patch includes things wanted from the last review except for the teardownModule. After looking into it, I could only find "enablePluginType" within application.js, but it didn't have a way to implement the method within mxr. If you know of a way, I'd be glad to hear it.
Attachment #414118 - Attachment is obsolete: true
Attachment #415513 - Flags: review?(hskupin)
Comment on attachment 415513 [details] [diff] [review] real patch (made sure!) We should have a new shared module for the Addons Manager which also implements a wrapper function for enabling/disabling plugins. It has to use this function: http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/content/extensions.js#1107 Will you be able to implement it or shall I do that? If you can't file a bug and I will prioritize the work.
Attachment #415513 - Flags: review?(hskupin)
I don't have the time to do it, bug 534724 has been created.
Also, can you please review this patch so to help me determine if I need to provide further work on this other than adding the helper function?
There shouldn't be any other work necessary afaics. Just wait for the helper module.
Depends on: 534724
Attached patch patch with addonsAPI changes (obsolete) — Splinter Review
I'm not sure if I am implementing this correctly, but I receive the following errors on run: ERROR - Test Failure: {u'exception': {u'message': u'Plugin is still enabled. It should be disabled.', u'lineNumber': 79, u'stack': u'Error("Plugin is still enabled. It should be disabled.")@:0\n()@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js -> file:///Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js:79\n((function () {addonsManager.open(controller);var addonsController = addonsManager.controller;addonsManager.setPane("plugins");addonsManager.setPluginState(pluginName, false);if (addonsManager.isPluginEnabled(pluginName) > -1) {throw new Error("Plugin is still enabled. It should be disabled.");}}))@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:460\n([object Object])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:512\n([object Object])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:554\n("/Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js")@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:412\n("/Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js")@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:565\n((function (filename) {var runner = new Runner(new Collector);runner.runTestFile(filename);runner.end();return true;}),[object Array])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:164\n("557fdd52-ef49-11de-b6b0-002332c8f090",(function (filename) {var runner = new Runner(new Collector);runner.runTestFile(filename);runner.end();return true;}),[object Array])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:168\n@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:244\n', u'fileName': u'file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js -> file:///Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js'}} Test Failed : testDisablePlugin in /Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js ERROR - Test Failure: {u'exception': {u'message': u'controller is not defined', u'lineNumber': 201, u'stack': u'addonsManager_setPluginState("Shockwave Flash",true)@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js -> file:///Users/adesai/mozmill-tests/shared-modules/testAddonsAPI.js:201\n()@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js -> file:///Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js:89\n((function () {addonsManager.setPluginState(pluginName, true);addonsManager.isPluginEnabled(pluginName);}))@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:460\n([object Object])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:512\n([object Object])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:554\n("/Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js")@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:412\n("/Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js")@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js:565\n((function (filename) {var runner = new Runner(new Collector);runner.runTestFile(filename);runner.end();return true;}),[object Array])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:164\n("557fdd52-ef49-11de-b6b0-002332c8f090",(function (filename) {var runner = new Runner(new Collector);runner.runTestFile(filename);runner.end();return true;}),[object Array])@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:168\n@file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/jsbridge@mozilla.com/resource/modules/server.js:244\n', u'fileName': u'file:///private/var/folders/V-/V-NHKNvMGNejCi16dhnw6U+++TI/-Tmp-/tmp51yUVd.mozrunner/extensions/mozmill@mozilla.com/resource/modules/frame.js -> file:///Users/adesai/mozmill-tests/shared-modules/testAddonsAPI.js'}} Test Failed : testEnablePlugin in /Users/adesai/mozmill-tests/firefox/testAddonsManager/testDisableEnablePlugin.js
Attachment #415513 - Attachment is obsolete: true
Attachment #418911 - Flags: review?(hskupin)
Comment on attachment 418911 [details] [diff] [review] patch with addonsAPI changes >+ // Visit adobe's flash test page and verify the flash video is NOT shown on the page >+ if (addonsManager.isPluginEnabled(pluginName) > -1 ) { >+ throw new Error("Plugin is still enabled. It should be disabled."); >+ } The function isPluginEnabled returns a boolean value as all of those functions which have a "is" prefix. So please handle it accordingly with assertJS. >+ // Verify the flash plugin is enabled >+ addonsManager.isPluginEnabled(pluginName); There is no verification yet. Same as above applies here too. >+testDisablePlugin.meta = {litmusids : [8511]}; >+testEnablePlugin.meta = {litmusids : [8511]}; Please don't add multiple functions per Litmus test case. Both tests have to be reside inside one test function.
Attachment #418911 - Flags: review?(hskupin) → review-
Attached patch patch with review changes (obsolete) — Splinter Review
assertJS added and the two test functions were consolidated into one test function. I'm still receiving the controller is not defined error.
Attachment #418911 - Attachment is obsolete: true
Attachment #419015 - Flags: review?(hskupin)
Attachment #412967 - Attachment is obsolete: true
Comment on attachment 419015 [details] [diff] [review] patch with review changes Aakash, please update the patch with the following changes: * Use the testcase I will attach shortly (via the local httpd server) to check if the plugin has been disabled. Switch to the default plugin instead of Flash. * Add a check for about:plugins like the Litmus test pretends I will do the fine-tuning afterward. Thanks.
Attachment #419015 - Flags: review?(hskupin) → review-
Comment on attachment 419015 [details] [diff] [review] patch with review changes Not clearly a r- we just have to flip some parts.
Attachment #419015 - Flags: review-
Attached file Testcase for default plugin (obsolete) —
(In reply to comment #12) > I'm still receiving the controller is not defined error. That was a failure inside the API. I have fixed it and pushed a follow-up to the repository.
Assignee: adesai → mozbugs.retornam
Attached file default plugin testcase (obsolete) —
Attachment #430352 - Flags: review?
Attachment #419015 - Attachment is obsolete: true
Attachment #430352 - Flags: review? → review?(hskupin)
Comment on attachment 430352 [details] default plugin testcase Thanks Raymond for the updated test. I hope you will have time to implement the remaining tests. >//var url = 'http://www.adobe.com/se/products/flashplayer/'; Please remove that line. >var url="./files/default_plugin.html"; This snippet should look like the following: http://hg.mozilla.org/qa/mozmill-tests/file/default/firefox/testTabbedBrowsing/testBackgroundTabScrolling.js#l41 >/* > * Tests disabling the Flash plugin > * Note: This testcase requires the platform to have flash already enabled > */ Please update the comment here. > // Visit adobe's flash test page and verify the flash video is NOT shown on the page This one needs a verification too. You will have to load the html testcase and check for the correct result. You can load it that way: http://hg.mozilla.org/qa/mozmill-tests/file/default/firefox/testTabbedBrowsing/testBackgroundTabScrolling.js#l73 Again, thanks for helping us! Just grab me if something is unclear.
Attachment #430352 - Attachment is patch: false
Whiteboard: [MozMillAddonTestday]
Whiteboard: [MozMillAddonTestday]
Raymond, will you have time to fix the remaining issues?
yes i will
Attached file DisableEnablePlugin.js (obsolete) —
Attachment #430352 - Attachment is obsolete: true
Attachment #434627 - Flags: review?
Attachment #430352 - Flags: review?(hskupin)
Comment on attachment 434627 [details] DisableEnablePlugin.js As talked on IRC yesterday I will fix the remaining stuff.
Attachment #434627 - Flags: review? → review-
Attached patch Patch v1 (default) (obsolete) — Splinter Review
Attachment #434833 - Flags: review?
Ok, to make this test work I had to fix 2 additional failures inside the AddonsAPI. Now it seems to work fine.
Assignee: mozbugs.retornam → hskupin
Attachment #420074 - Attachment is obsolete: true
Attachment #434627 - Attachment is obsolete: true
Attachment #434833 - Attachment is obsolete: true
Attachment #434834 - Flags: review?(anthony.s.hughes)
Attachment #434833 - Flags: review?
Whiteboard: [mozmill-doc-needed]
Attachment #434834 - Flags: review?(anthony.s.hughes) → review+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [mozmill-doc-needed] → [mozmill-doc-complete]
I had to land a bustage fix because Linux and Windows handle it differently. No-one tested it there. :/ http://hg.mozilla.org/qa/mozmill-tests/rev/534880c5ce69 http://hg.mozilla.org/qa/mozmill-tests/rev/a20cc5c1021b
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.

Attachment

General

Created:
Updated:
Size: