Closed Bug 493084 Opened 15 years ago Closed 15 years ago

Mozmill test for verifying pop-ups are allowed

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: u279076, Assigned: u279076)

References

()

Details

(Whiteboard: [mozmill-smoketest][mozmill-popups])

Attachments

(2 files, 4 obsolete files)

This test goes hand in hand with the "Pop-up Allowed" smoketest in litmus (see URL).
Attached file TESTCASE: Rev2 (obsolete) —
Test case for checking that pop-ups are allowed, display, and that no warning appears.
Attachment #377714 - Flags: review?(hskupin)
Attached file TESTCASE: Rev3 (obsolete) —
Added clean up code to restore the pref.
Attachment #377714 - Attachment is obsolete: true
Attachment #377717 - Flags: review?(hskupin)
Attachment #377714 - Flags: review?(hskupin)
Attachment #377717 - Flags: review?(hskupin) → review-
Comment on attachment 377717 [details]
TESTCASE: Rev3

Some of the comments I gave to the popups blocking test also applies here.


>var teardownModule = function(module) {
>  // Restore the Block Pop-ups pref to checked
>  prefcontroller.click(new elementslib.Elem( prefcontroller.tabs.Content.button));
>  var pref = new elementslib.ID(prefcontroller.window.document, "popupPolicy");
>  if (!pref.getNode().checked) {
>    prefcontroller.click(pref);
>  }
>}

Please also waitForElement here and please close the preferences dialog and all the created popups so we are in the initial state. Otherwise we will run into problems with following tests.

>var testPopUpBlocked = function(){
>  // Ensure the pref is not checked
>  prefcontroller.click(new elementslib.Elem( prefcontroller.tabs.Content.button));
>  var pref = new elementslib.ID(prefcontroller.window.document, "popupPolicy");
>  if (pref.getNode().checked) {
>    prefcontroller.click(pref);
>  }

waitForElement is missing here too.

>  // Check that the Window count has not changed since the pop-up test
>  // (i.e. no new windows appeared)
>  if (preWindowCount >= postWindowCount) {
>    throw "Error: Pop-ups were blocked";
>  }     

Mmh I wonder if we should check for the exact number of opened pop-ups. I don't think they will change the amount. 

>  var panel = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("browser")/id("appcontent")/id("content")/anon({"anonid":"tabbox"})/anon({"anonid":"panelcontainer"})');  
>  if (panel.hasChildNodes) {
>    if (panel.firstChild.nodeName == "xul:notificationbox") {
>      throw "Error: Warning displayed";
>    }
>  }

Even with the notification box open I get no failure here.
Bug 493671 prevents me from solving this bug.
Depends on: 493671
Depends on: 499691
Attached file Test Case (obsolete) —
This test case works with a couple of caveats:

1. The test blocks pop-ups sometimes.  Run the test using CMD+R and the test will display all pop-ups sometimes and block some of the pop-ups other times.  This should always allow pop-ups to display.

2. There is an assertNodeNotExist() for the status bar icon.  This test fails saying the icon exists when in fact it doesn't.
Attachment #377717 - Attachment is obsolete: true
Attached patch Patch: testPopupsAllowed.js (obsolete) — Splinter Review
This patch includes the test case for allowing pop-ups to appear.  The problems I specified earlier appear to be rectified.  I've run the test 20 times without problems.
Attachment #385029 - Attachment is obsolete: true
Attachment #385032 - Flags: review?(hskupin)
Comment on attachment 385032 [details] [diff] [review]
Patch: testPopupsAllowed.js

>+  for each (window in mozmill.utils.getWindows()) {
>+    if (window.content && window.content.location == "http://www.mozilla.org") {

Please add an enclosing '/' to the URL.

>+/**
>+ * Test to make sure pop-ups are not blocked
>+ *
>+ * @throws Pop-ups were blocked
>+ * @throws Status bar icon is visible
>+ */

For the test function itself we don't need the throws param description.

>+  // Check for the warning bar by looking for the X button
>+  var panel = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("browser")/id("appcontent")/id("content")/anon({"anonid":"tabbox"})/anon({"anonid":"panelcontainer"})');
>+  UtilsAPI.delayedAssertNode(controller, panel);
>+  var childNodes = panel.getNode().childNodes;
>+  var xButton = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("browser")/id("appcontent")/id("content")/anon({"anonid":"tabbox"})/anon({"anonid":"panelcontainer"})/{"flex":"1","id":"' + childNodes[0].id + '"}/{"value":"popup-blocked","image":"chrome://browser/skin/Info.png","priority":"5","type":"warning"}/anon({"class":"notification-inner outset","flex":"1","xbl:inherits":"type","type":"warning"})/{"ondblclick":"event.stopPropagation();","class":"messageCloseButton tabbable","xbl:inherits":"hidden=hideclose","oncommand":"document.getBindingParent(this).close();"}');
>+  controller.assertNodeNotExist(xButton);

Can you please separate the different steps with an empty row? This block is really hard to read.

>+  // Check for the status bar icon
>+  var icon = new elementslib.ID(controller.window.document, "page-report-button");
>+  // This icon is very poorly designed.  It always exists
>+  // and it is always visible.  When the icon is supposed
>+  // to be hidden it is given a size of 0,0.
>+  if (icon.getNode().clientHeight > 0) {
>+    throw "Status bar icon is visible";
>+  }

Ok, this is probably not the best way. As what I have seen is that you can use the CSS display property. Same like in the pop-up blocker test.

>+  // Make sure the pref is unchecked
>+  var pref = new elementslib.ID(controller.window.document, "popupPolicy");
>+  var checked = pref.getNode().checked;

Please add waitForElement before accessing the pref element.
Attachment #385032 - Flags: review?(hskupin) → review-
Suggested revisions made.
Attachment #385032 - Attachment is obsolete: true
Attachment #385173 - Flags: review?(hskupin)
Comment on attachment 385173 [details] [diff] [review]
Patch: testPopupsAllowed.js

Looks good! I have only made the same small tweaks like I did for the pop-ups blocking test.
Attachment #385173 - Flags: review?(hskupin) → review+
Checked-in: http://hg.mozilla.org/qa/mozmill-tests/rev/b9a1121397a8
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: Firefox 3.5 → ---
Verified.
Status: RESOLVED → VERIFIED
Depends on: 509031
We need this fix to make sure to close all popups on Windows and Linux. I haven't an idea why that is working on OS X but now we have a much cleaner way in identifying popups. Using the URL was kinda flaky.
Attachment #397112 - Flags: review?(ashughes)
Comment on attachment 397112 [details] [diff] [review]
Follow-up patch to fix not closing popup windows

Code looks fine.  Both tests work.  r+
Attachment #397112 - Flags: review?(ashughes) → 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: Security → Mozmill Tests
Product: Firefox → Mozilla QA
QA Contact: firefox → mozmill-tests
Summary: [mozmill] Test for verifying pop-ups are allowed → Mozmill test for verifying pop-ups are allowed
Whiteboard: [mozmill-smoketest][mozmill-popups]
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: