Intermittent testShareLink | Exception caught - junit.framework.AssertionFailedError: View is null and can therefore not be clicked!

RESOLVED FIXED in Firefox 26

Status

()

Firefox for Android
General
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: RyanVM, Assigned: liuche)

Tracking

({assertion, intermittent-failure})

Trunk
Firefox 27
ARM
Android
assertion, intermittent-failure
Points:
---

Firefox Tracking Flags

(firefox25 unaffected, firefox26 fixed, firefox27 fixed, firefox-esr24 unaffected)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

4 years ago
https://tbpl.mozilla.org/php/getParsedLog.php?id=27593112&tree=Fx-Team

Android Tegra 250 fx-team opt test robocop-2 on 2013-09-09 12:47:15 PDT for push bbddba8cc6e6
slave: tegra-097

INFO | automation.py | Application pid: 0
0 INFO SimpleTest START
1 INFO TEST-START | testShareLink
EventExpecter: no longer listening for Gecko:Ready
2 INFO TEST-PASS | testShareLink | waiting for urlbar text to gain focus - urlbar text gained focus
3 INFO TEST-PASS | testShareLink | URL typed properly - http://mochi.test:8888/tests/robocop/robocop_big_link.html should equal http://mochi.test:8888/tests/robocop/robocop_big_link.html
EventExpecter: no longer listening for DOMContentLoaded
4 INFO TEST-PASS | testShareLink | Page title is correct - Big Link should equal Big Link
waitForText timeout on ^Share$
5 INFO TEST-PASS | testShareLink | Got the displayed share options? - Got the share options view
6 INFO TEST-PASS | testShareLink | Share option found - Messaging
7 INFO TEST-PASS | testShareLink | Share option found - Bluetooth
8 INFO TEST-PASS | testShareLink | Share option found - Firefox Sync
9 INFO TEST-PASS | testShareLink | Got the displayed share options? - Got the share options view
10 INFO TEST-PASS | testShareLink | Share option for urlbar found - Messaging
11 INFO TEST-PASS | testShareLink | Share option for urlbar found - Bluetooth
12 INFO TEST-PASS | testShareLink | Share option for urlbar found - Firefox Sync
13 INFO TEST-PASS | testShareLink | Got the displayed share options? - Got the share options view
14 INFO TEST-PASS | testShareLink | Share option for Link item found - Messaging
15 INFO TEST-PASS | testShareLink | Share option for Link item found - Bluetooth
16 INFO TEST-PASS | testShareLink | Share option for Link item found - Firefox Sync
17 INFO TEST-PASS | testShareLink | waiting for urlbar text to gain focus - urlbar text gained focus
18 INFO TEST-PASS | testShareLink | Checking that the correct tab is displayed - The BOOKMARKS tab is displayed
19 INFO TEST-PASS | testShareLink | list is properly loaded - true should equal true
Exception caught during test!
junit.framework.AssertionFailedError: View is null and can therefore not be clicked!
	at junit.framework.Assert.fail(Assert.java:47)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:167)
	at com.jayway.android.robotium.solo.Solo.clickLongOnView(Solo.java:974)
	at org.mozilla.fennec.tests.testShareLink.testShareLink(testShareLink.java:86)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:521)
	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186)
	at org.mozilla.fennec.tests.BaseTest.runTest(BaseTest.java:161)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
20 INFO TEST-UNEXPECTED-FAIL | testShareLink | Exception caught - junit.framework.AssertionFailedError: View is null and can therefore not be clicked!
21 INFO TEST-END | testShareLink | finished in 75115ms
22 INFO TEST-START | Shutdown
23 INFO Passed: 18
24 INFO Failed: 1
25 INFO Todo: 0
26 INFO SimpleTest FINISHED
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)

Comment 23

4 years ago
It looks like the failure is happening here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/testShareLink.java.in#77

Maybe we need to do something to wait for the bookmarks list to load? I would suggest this problem has to do with the fact that we got rid of thumbnails on the bookmarks page, but it looks like this failure popped up before we landed the new-new-about-home.
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Created attachment 810698 [details] [diff] [review]
Patch: check for non-empty ListView

The intermittents are happening because for bookmarks on tablets, we have an extra header that gets loaded before the list items are loaded, so both the Adapter and ListView are non-null, and we try to get items from the Bookmarks list.
Assignee: nobody → liuche
Status: NEW → ASSIGNED
Attachment #810698 - Flags: review?(gbrown)
try build: https://tbpl.mozilla.org/?tree=Try&rev=a25dcfb7e553
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Created attachment 811517 [details]
p0.jpg

Bookmarks listitem(0) appears to be empty (?) 

|mSolo.clickLongOnView(bookmarksItem);| may fail ...

if |bookmarksList.getHeaderViewsCount() = 0| then
   View bookmarksItem = bookmarksList.getChildAt(0) may here == null ?
      and |mSolo.clickLongOnView(bookmarksItem);| may fail ... ?

Maybe some timing thing in BookmarksListAdapter.java displaying the unusual bookmarksList ...
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment on attachment 810698 [details] [diff] [review]
Patch: check for non-empty ListView

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

I like this change and see nothing wrong with it. There is still one instance of this failure in the try run as noted in Comment 59. Maybe testShareLink should waitForListToLoad(listView, 3) instead of waitForNonEmptyListToLoad()? Or maybe a try run with more logging would tell us more about what is happening, like what does getHeaderViewsCount() return just before the failure?
Attachment #810698 - Flags: review?(gbrown) → review+
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
:liuche -- This test is failing frequently. Do you think your patch will reduce the failures? If so, please land it soon, even if it is not perfect (does not eliminate all the failures).
Flags: needinfo?(liuche)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
I'm sure this patch would help, so let me land it. It's bit-rotted a little, so let me get a green try run and then will land.
Flags: needinfo?(liuche)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
https://hg.mozilla.org/integration/fx-team/rev/ae48a373ea5c

Updated

4 years ago
status-firefox24: --- → fixed
status-firefox25: --- → fixed
https://hg.mozilla.org/mozilla-central/rev/ae48a373ea5c
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
reopen - seems its still happening see https://tbpl.mozilla.org/php/getParsedLog.php?id=29082131&tree=Mozilla-Inbound
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment hidden (Treeherder Robot)
(Reporter)

Comment 186

4 years ago
Yes, that was expected based on comment 157. Liuche, in the future, you can put [leave open] on the whiteboard to avoid the bug being closed when it lands m-c. :-)
Comment hidden (Treeherder Robot)
Thanks Ryan, will do!
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Trying to diagnose this here: https://tbpl.mozilla.org/?tree=Try&rev=c8ec2ef7c844

If this doesn't point to a solution, let's disable this test.
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
We hit this failure and successfully recovered at least a couple of times:

https://tbpl.mozilla.org/php/getParsedLog.php?id=29521719&tree=Try&full=1
https://tbpl.mozilla.org/php/getParsedLog.php?id=29521740&tree=Try&full=1

17:53:15     INFO -  17 INFO TEST-PASS | testShareLink | Share option for Link item found - Firefox Sync
17:53:15     INFO -  18 INFO TEST-PASS | testShareLink | waiting for urlbar text to gain focus - urlbar text gained focus
17:53:15     INFO -  19 INFO TEST-PASS | testShareLink | list is properly loaded - true should equal true
17:53:15     INFO -  got null child at index 1
17:53:15     INFO -  after pause, got index 1 and item org.mozilla.gecko.home.TwoLinePageRow@413690b0
17:53:15     INFO -  20 INFO TEST-PASS | testShareLink | Got the displayed share options? - Got the share options view
17:53:15     INFO -  21 INFO TEST-PASS | testShareLink | Share option for bookmarks item found - Messaging
New patch: https://tbpl.mozilla.org/?tree=Try&rev=4334d23f32eb
Created attachment 820760 [details] [diff] [review]
if bookmark list child is null, retry to avoid failure
Attachment #820760 - Flags: review?(liuche)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment on attachment 820760 [details] [diff] [review]
if bookmark list child is null, retry to avoid failure

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

Looks good to me, but there seem to be failures on r4. Is that related?

::: mobile/android/base/tests/testShareLink.java.in
@@ +13,5 @@
>  import android.widget.AbsListView;
>  import android.widget.GridView;
>  import android.widget.ListView;
>  import android.widget.TextView;
> +import com.jayway.android.robotium.solo.Condition;

In AboutHomeTest and BaseTest, we have these imports in a separate section - consider moving this for consistency.

@@ +77,5 @@
>  
> +        int headerViewsCount = bookmarksList.getHeaderViewsCount();
> +        View bookmarksItem = bookmarksList.getChildAt(headerViewsCount);
> +        if (bookmarksItem == null) {
> +            mAsserter.dumpLog("got null child at index "+headerViewsCount);

Nit: spaces around "+" operator.
Attachment #820760 - Flags: review?(liuche) → review-
Created attachment 821338 [details] [diff] [review]
if bookmark list child is null, retry to avoid failure

Nits addressed. 

The rc4 failure is unrelated: My try push included a modification -- not in this patch -- to robocop.ini, to run this test repeatedly. Unfortunately, the test harness has a bug when "chunking" a set of tests that have duplicates...that caused the rc4 failure.
Attachment #820760 - Attachment is obsolete: true
Attachment #821338 - Flags: review?(liuche)
Comment on attachment 821338 [details] [diff] [review]
if bookmark list child is null, retry to avoid failure

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

Great, glad that's not related!

::: mobile/android/base/tests/testShareLink.java.in
@@ +77,5 @@
>  
> +        int headerViewsCount = bookmarksList.getHeaderViewsCount();
> +        View bookmarksItem = bookmarksList.getChildAt(headerViewsCount);
> +        if (bookmarksItem == null) {
> +            mAsserter.dumpLog("got null child at index " + headerViewsCount);

One last thing - do you think it would be useful to add a log statement here saying that we're going to wait for MAX_WAIT_MS for the view?
Attachment #821338 - Flags: review?(liuche) → review+
With last suggestion:

https://hg.mozilla.org/integration/mozilla-inbound/rev/3b601d64426b
Comment hidden (Treeherder Robot)
https://hg.mozilla.org/mozilla-central/rev/3b601d64426b
Status: REOPENED → RESOLVED
Last Resolved: 4 years ago4 years ago
Resolution: --- → FIXED
Comment hidden (Treeherder Robot)
fyi - I've a related patch waiting review - affects all consumers of AboutHomeTest.java.in methods getDisplayedBookmark() and findListViewWithTag() ... see bug 925264 ... root cause and graceful correction to "View is null" problem ... 

pardon me jumping in if this is actually ot related
Thanks. 

It looks like the same problem: testShareLink was failing when it retrieved the bookmarks list with findListViewWithTag() and then tried to click on an item without checking/waiting to see if the item view was non-null. Now it uses waitForCondition to wait for a non-null view if necessary.
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
Comment hidden (Treeherder Robot)
(Reporter)

Comment 284

4 years ago
https://hg.mozilla.org/releases/mozilla-aurora/rev/a1325abdf5eb
status-firefox24: fixed → ---
status-firefox25: fixed → unaffected
status-firefox26: --- → fixed
status-firefox27: --- → fixed
status-firefox-esr24: --- → unaffected
You need to log in before you can comment on or make changes to this bug.