Closed Bug 604832 Opened 14 years ago Closed 14 years ago

Fix element declarations and usage in tests to avoid bad document references

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [mozmill-test-failure][needs-mozmill-1.5.1])

Attachments

(4 files, 5 obsolete files)

The testStartStopPBMode.js test module fails on slower boxes like the buildbot ones. The reason is that we do not wait for page load but for the elements on the page. The timeout in such a case is only 5s instead of 30s for waitForPageLoad. The following patch will change that and always wait for the page loaded. Also I have removed the unnecessary elements check right after the page load. We test those elements later in the test.
Attached patch Patch v1 (obsolete) — Splinter Review
Attachment #483684 - Flags: review?(gmealer)
Comment on attachment 483684 [details] [diff] [review] Patch v1 > for (var i = 0; i < LOCAL_TEST_PAGES.length; i++) { >+ controller.waitForPageLoad(controller.tabs.getTab(i)); >+ > var elem = new elementslib.ID(controller.tabs.getTab(i), LOCAL_TEST_PAGES[i].id); > controller.waitForElement(elem, TIMEOUT); Looks fine, but if we wait for page load, there's no reason to wait for elements if the page is done loading. If you want to adjust that before you land that's fine, or do it later. r+ anyways
Attachment #483684 - Flags: review?(gmealer) → review+
Depends on: 604878
Attachment #483684 - Attachment is obsolete: true
The problem here is much broader as I have thought. One issue was that we weren't able to detect the page load in a background tab correctly. This will be fixed by my patch on bug 604878. But the other problem we have and why a lot of our tests are failing is the fact that elements are getting declared and reused at a later time. Especially if a page load is in between, which even loads the same page again, we fail because the underlying document has been changed and function calls like the following will fail: var elem = elementslib.ID(controller.tab.activeTab, "id"); controller.open("xyz"); controller.waitForPageLoad(); controller.click(elem); The solution for now is to move the element declaration right before its usage. With that change I was able to fix more than 15 failing tests (one fix sometimes brought up another failure). The big question here is, which should be discussed on another bug: Is our handling of XULDocuments and HTMLDocuments correct. Personally I see a big flaw which breaks us in several areas. I will file that bug in the next minutes.
Summary: Make testStartStopPBMode.js more resistant against timeouts on slower machines → Fix element declarations and usage in tests to avoid bad document references
Attached patch Patch v1 (obsolete) — Splinter Review
Attachment #483764 - Flags: review?(gmealer)
Blocks: 554889
Blocks: 604096
Blocks: 554883
Blocks: 554896
Blocks: 572503
Blocks: 582618
Blocks: 574709
Whiteboard: [mozmill-test-failure] → [mozmill-test-failure][needs-mozmill-1.5.1]
Attached patch Patch v1.1 (obsolete) — Splinter Review
I forgot about the Back and Forward test. All the tests which are affected by the waitForPageLoad change should be fixed with those changes.
Attachment #483764 - Attachment is obsolete: true
Attachment #483794 - Flags: review?(gmealer)
Attachment #483764 - Flags: review?(gmealer)
(In reply to comment #3) > The big question here is, which should be discussed on another bug: Is our > handling of XULDocuments and HTMLDocuments correct. Personally I see a big flaw > which breaks us in several areas. I will file that bug in the next minutes. Thinking more about, yes it is correct. When elements are created from a content document and the page gets reloaded, the element will have to be recreated. The reason is that the document gets replaced and old references are not valid anymore. We should always take this into account.
Attached patch Patch v1.2 (obsolete) — Splinter Review
Ok, we need one more revision here. As I got the information we can also use waitForPageLoad for bf-cache served pages. We would simply have to listen to "pageshow" events.
Attachment #483794 - Attachment is obsolete: true
Attachment #483796 - Flags: review?
Attachment #483794 - Flags: review?(gmealer)
Attachment #483796 - Flags: review? → review?(gmealer)
Attached patch Patch v1.3Splinter Review
The pageshow listener had to be removed because it caused a regression. It needs further investigation for an upcoming release. That means for pages served from the cache we have to wait for the element. I also had to fix testDisabledPermissions.js which wasn't using the tabBrowser.openTab function and failed with Minefield due to the tab animation.
Attachment #483796 - Attachment is obsolete: true
Attachment #483924 - Flags: review?(gmealer)
Attachment #483796 - Flags: review?(gmealer)
Re: recreating elements, the move to widget classes may make this easy. I'd like to see what the speed is if we always lookup every time, for one, which eliminates this problem entirely. Failing that, we can put in an "invalidate" type method that tips off the class to relookup after a page load.
Comment on attachment 483924 [details] [diff] [review] Patch v1.3 Patch looks fine. r+
Attachment #483924 - Flags: review?(gmealer) → review+
I will land that patch after checking that we do not regress anything for the last release
Keywords: checkin-needed
We can't check in this patch as given by the whiteboard. We really have to wait for the first builds of Mozmill 1.5.1.
(In reply to comment #12) > We can't check in this patch as given by the whiteboard. We really have to wait > for the first builds of Mozmill 1.5.1. Sorry my fault. Lets keep the checkin-needed keyword this time. We will have to find a better solution for the future.
Keywords: checkin-needed
Blocks: 573582
It looks like one was missing which is failing on 1.5.1RC with a timeout exceed as a result. This patch fixes that timeout.
Attachment #485159 - Flags: review?(gmealer)
Also, seeing a number of element not found and waitForElement timeout failures on branches after going to 1.5.1. I assume that reflects a need to backport these changes?
Yes, we have to backport all of them.
Comment on attachment 485159 [details] [diff] [review] testPasswordSavedAndDeleted (default) [missing] Please don't redeclare the variables. A simple assignment will be perfect. I will include this patch for the backport. Thanks for spotting it.
Attachment #485159 - Flags: review?(gmealer) → review-
This is the backport patch for 1.9.2. I will now check the one for 1.9.1.
Attachment #485283 - Flags: review?(aaron.train)
Attachment #485159 - Attachment is obsolete: true
Attachment #485284 - Flags: review?(hskupin)
Comment on attachment 485283 [details] [diff] [review] Backport v1 (1.9.2) Patch looks great, thanks. r+
Attachment #485283 - Flags: review?(aaron.train) → review+
Attachment #485288 - Flags: review?(aaron.train)
Comment on attachment 485284 [details] [diff] [review] Follow-up fixes for default branch [checked-in] Looks good. thanks.
Attachment #485284 - Flags: review?(hskupin) → review+
Comment on attachment 485284 [details] [diff] [review] Follow-up fixes for default branch [checked-in] Landed on default as: http://hg.mozilla.org/qa/mozmill-tests/rev/16ea43ce9241
Attachment #485284 - Attachment description: testPasswordSavedAndDeleted & testTabsDismissedOnStop (default) → Follow-up fixes for default branch [checked-in]
Comment on attachment 485288 [details] [diff] [review] Backport v1 (1.9.1) Great, r+
Attachment #485288 - Flags: review?(aaron.train) → review+
Landed backport patches: http://hg.mozilla.org/qa/mozmill-tests/rev/77963e6b0d86 (1.9.2) http://hg.mozilla.org/qa/mozmill-tests/rev/7fe53b44325f (1.9.1) I don't think that we will have to revert to 1.5. I will mark this bug as fixed.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
This bug has been fixed mostly all of those instances. Lets file new bugs for remaining issues.
Status: RESOLVED → VERIFIED
No longer blocks: 554883
No longer blocks: 572503
Blocks: 572503
No longer blocks: 572503
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.
Product: Testing → Mozilla QA
Version: Trunk → unspecified
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: