Closed Bug 784644 Opened 12 years ago Closed 12 years ago

Test failure 'The page title matches the underlined text - 'grants' should equal 'grant' ' in /testAwesomeBar/testSuggestBookmarks.js

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect, P2)

All
macOS
defect

Tracking

(firefox15 fixed, firefox16 fixed, firefox17 fixed, firefox18 fixed, firefox-esr10 fixed)

RESOLVED FIXED
Tracking Status
firefox15 --- fixed
firefox16 --- fixed
firefox17 --- fixed
firefox18 --- fixed
firefox-esr10 --- fixed

People

(Reporter: whimboo, Assigned: AndreeaMatei)

References

()

Details

(Whiteboard: [mozmill-test-failure])

Attachments

(2 files, 5 obsolete files)

Looks like the failure we already thought to have fixed on bug 742550 is back. Probably it could also be a new regression or a change in Firefox. So we have to investigate this problem.

It only happened on OS X 10.7 for now.
Assignee: nobody → vlad.mozbugs
Status: NEW → ASSIGNED
Looks like we need another check in this test. 
Seeing the failure message it seems we do not type the last character 's' from 'grants'
I suggest to wait for the string in the location bar to be the expected one. If there is a hang in the test, the timeout error will confirm that. 

Does any of this make sense?
Question: do we still need this? 

for each (var entry in entries) {
    expect.equal(LOCAL_TEST_PAGE.string, entry.toLowerCase(),
                 "The page title matches the underlined text");
  }

From what I have seen we are typing the whole string now and there is only one entry ever time in 'entries'. Just make some dumps in the console to see that
Also this 
https://bugzilla.mozilla.org/show_bug.cgi?id=742550#c6
was not addressed and we still have the flipped order of expect.equal arguments. 
Will have to land with a patch here then
locationBar_type() already checks if the text is contained. But it doesn't wait. So probably that's the cause here. We could remove the .contains() call and let the tests do the check whenever they have. That's more appropriate but it needs a check for all other tests which make use of .type().
testCheckItemHighlight fails in a similar manner:
http://mozmill-ci.blargon7.com/#/functional/report/d87d47fd1034f072b9bece6ee6840738

So probably worth fixing on a module level.
Attached patch fix patch v1.0 (obsolete) — Splinter Review
* proposed fix
* fix at the module level, meaning updating locationBar_type with a waitFor needed to wait for the url bar to really contain the typed strings 
* refactored test to make usage of the editBookmarksPanel UI map re 'doneButton' element
* fixed wrong expect call
Attachment #654579 - Flags: review?(hskupin)
Attachment #654579 - Flags: review?(dave.hunt)
If this does not fix our errors at least we are getting closer by having another error
Comment on attachment 654579 [details] [diff] [review]
fix patch v1.0

Review of attachment 654579 [details] [diff] [review]:
-----------------------------------------------------------------

::: lib/toolbars.js
@@ +566,5 @@
>    type : function locationBar_type(text) {
>      this._controller.type(this.urlbar, text);
> +    this._controller.waitFor(function () {
> +      return this.contains(text);
> +    }, "Location bar contains the typed data", undefined, undefined, this);

No, that's not what I wanted. As I have said we should remove any kind of check from the module and do that on the test level.

::: tests/functional/testAwesomeBar/testSuggestBookmarks.js
@@ +71,5 @@
>    // Define the path to the first auto-complete result
>    var richlistItem = locationBar.autoCompleteResults.getResult(0);
>  
>    var entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
>    for each (var entry in entries) {

Change this to forEach because 'for each' can cause failures.

@@ +72,5 @@
>    var richlistItem = locationBar.autoCompleteResults.getResult(0);
>  
>    var entries = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
>    for each (var entry in entries) {
> +    expect.equal(entry.toLowerCase(), LOCAL_TEST_PAGE.string,

Good catch.
Attachment #654579 - Flags: review?(hskupin)
Attachment #654579 - Flags: review?(dave.hunt)
Attachment #654579 - Flags: review-
Attached patch fix patch v2 (obsolete) — Splinter Review
* Moved .contains calls in all tests which make usage of locationBar.type
* Updated tests to remove unnecessary sleep calls which were replaced by waitFors
* Updated tests to remove for each with forEach, where applicable. 
* Tested the patch on default branch
Attachment #654579 - Attachment is obsolete: true
Attachment #654951 - Flags: review?(hskupin)
Attachment #654951 - Flags: review?(dave.hunt)
Comment on attachment 654951 [details] [diff] [review]
fix patch v2

Review of attachment 654951 [details] [diff] [review]:
-----------------------------------------------------------------

::: tests/functional/testAwesomeBar/testCheckItemHighlight.js
@@ +50,5 @@
>    locationBar.clear();
>  
>    // Type the page name into the location bar
>    locationBar.type(LOCAL_TEST_PAGES[0].name);
> +  controller.waitFor(function () {

This looks unnecessary to me. We next wait for the strings to match, so why first wait for one string to contain the other?

::: tests/functional/testAwesomeBar/testEscapeAutocomplete.js
@@ +47,3 @@
>    for (var i = 0; i < TEST_STRING.length; i++) {
>      locationBar.type(TEST_STRING[i]);
> +    controller.waitFor(function () {

We type one character at a time, so this is invalid as soon as we type the same character twice. If the full string was 'foo' then the final character would not wait for the final 'o' because the location bar already contains one.

::: tests/functional/testAwesomeBar/testFaviconInAutocomplete.js
@@ +52,5 @@
>  
>    // Type in each letter of the test string to allow the autocomplete to populate with results
>    for each (var letter in LOCAL_TEST_PAGE.string) {
>      locationBar.type(letter);
> +    controller.waitFor(function () {

As mentioned, this would be invalid for any string containing the same character more than once.

::: tests/functional/testAwesomeBar/testVisibleItemsMax.js
@@ +59,3 @@
>    for each (var letter in testString) {
>      locationBar.type(letter);
> +    controller.waitFor(function () {

Same comment here as above.

@@ +64,4 @@
>    }
>  
> +  // Wait for the autocomplete list to be opened
> +  controller.waitFor(function () {

We recently removed this waitFor. Why are we reintroducing it?
Attachment #654951 - Flags: review?(hskupin)
Attachment #654951 - Flags: review?(dave.hunt)
Attachment #654951 - Flags: review-
Andreea, would you mind to continue here? Would be appreciated.
Assignee: vlad.mozbugs → andreea.matei
Blocks: 786183
Attached patch patch v3 (obsolete) — Splinter Review
Regarding the last concerns:
Because of the autocomplete in the locationBar, while typing, we can't compare the length of the text typed with urlbar length.
I've found an attribute (selectionStart) which returns the index where the autocomplete text starts. If we type "m" we have highlighted "ozilla" as autocomplete.
In the waitFor we now compare the length of the text typed so far, increased with each step, against the index. On some cases is index - 1 because we start with i=0. 

Testrun on Mac OS X 10.7.4 since on Mac was reported the failure:
http://mozmill-crowd.blargon7.com/#/functional/report/d87d47fd1034f072b9bece6ee6de81ae
Attachment #654951 - Attachment is obsolete: true
Attachment #656400 - Flags: review?(hskupin)
Attachment #656400 - Flags: review?(dave.hunt)
Why do we have to type in each character on its own? We have changed that lately to the whole string in another fixed bug. Why do we revert this too?
Attached patch patch v4 (obsolete) — Splinter Review
Sorry, I misunderstood the comments.

Have now a waitFor the locationBar value to be equal to the typed string.

Results:
* http://mozmill-crowd.blargon7.com/#/functional/report/d87d47fd1034f072b9bece6ee6e29b22
* http://mozmill-crowd.blargon7.com/#/functional/report/d87d47fd1034f072b9bece6ee6e31159
Attachment #656400 - Attachment is obsolete: true
Attachment #656400 - Flags: review?(hskupin)
Attachment #656400 - Flags: review?(dave.hunt)
Attachment #656445 - Flags: review?(hskupin)
Attachment #656445 - Flags: review?(dave.hunt)
Comment on attachment 656445 [details] [diff] [review]
patch v4

Review of attachment 656445 [details] [diff] [review]:
-----------------------------------------------------------------

This bug is about a failure in testSuggestBookmarks.js so I would like to see that we limit our changes to that single file or if necessary the lib modules. Please update the patch accordingly and file a follow-up bug if you want to see the other tests modified.

::: tests/functional/testAwesomeBar/testSuggestBookmarks.js
@@ +46,5 @@
>    // editBookmarksPanel is loaded lazily. Wait until overlay for StarUI has been loaded, then close the dialog
>    controller.waitFor(function () {
>      return controller.window.top.StarUI._overlayLoaded;
>    }, "Edit This Bookmark doorhanger has been loaded");
> +  var doneButton = locationBar.editBookmarksPanel.getElement({type: "doneButton"});

This change doesn't affect the fix for the failure and should be moved out to the follow-up bug.

@@ +80,2 @@
>                   "The page title matches the underlined text");
> +  });

Similar to this change. Otherwise this file looks good.
Attachment #656445 - Flags: review?(hskupin)
Attachment #656445 - Flags: review?(dave.hunt)
Attachment #656445 - Flags: review-
Attached patch patch v5 (obsolete) — Splinter Review
Left only the waitFor in testSuggestBookmarks.js for this patch.
Attachment #656445 - Attachment is obsolete: true
Attachment #656818 - Flags: review?(hskupin)
Attachment #656818 - Flags: review?(dave.hunt)
Comment on attachment 656818 [details] [diff] [review]
patch v5

Review of attachment 656818 [details] [diff] [review]:
-----------------------------------------------------------------

So this will not work because you left out the removal of 'this.contains(text);' from the toolbars.js module. That way the test will still fail. Please test if this change will affect other tests for the locationbar.
Attachment #656818 - Flags: review?(hskupin)
Attachment #656818 - Flags: review?(dave.hunt)
Attachment #656818 - Flags: review-
Attached patch patch v5.1Splinter Review
Runned functional testruns on Mac and Ubuntu and no tests are affected by removing .contains from toolbars.js
Attachment #656818 - Attachment is obsolete: true
Attachment #656834 - Flags: review?(hskupin)
Attachment #656834 - Flags: review?(dave.hunt)
Blocks: 787924
Comment on attachment 656834 [details] [diff] [review]
patch v5.1

Review of attachment 656834 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine then. Lets see how it sticks before backporting to older branches.
Attachment #656834 - Flags: review?(hskupin)
Attachment #656834 - Flags: review?(dave.hunt)
Attachment #656834 - Flags: review+
http://hg.mozilla.org/qa/mozmill-tests/rev/905a5486cf64 (default)
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Attached patch [ESR10] patch v1Splinter Review
This patch applies to Esr10. 
The weird thing here is that by just removing this line in lib/toolbars.js
 this.contains(text);

the patch is created with the next function removed and then added back. 
We don't change anything there, tried several times, also in Alex's machine. On default didn't had this issue.
Attachment #658451 - Flags: review?(hskupin)
Attachment #658451 - Flags: review?(dave.hunt)
Comment on attachment 658451 [details] [diff] [review]
[ESR10] patch v1

Review of attachment 658451 [details] [diff] [review]:
-----------------------------------------------------------------

Landed as:
http://hg.mozilla.org/qa/mozmill-tests/rev/ac03c289d07d (esr10)

Looks like a line endings issue that caused the need for a ESR10 patch.
Attachment #658451 - Flags: review?(hskupin)
Attachment #658451 - Flags: review?(dave.hunt)
Attachment #658451 - Flags: review+
No longer blocks: 786183
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: