I thought about the test some more and looked at what happens when a missing file is loaded. Normally CordovaActivity shows a dialog that exits when the user presses ok button. I think this test should check that displayError is being called with an appropriate message. To test this, I overrode displayError in the test activity (showing dialog is not very useful in tests).
I submitted a PR with this change. Joe and Carlos, please let me know if you think it's a reasonable approach. On 1/29/16, 7:19 PM, "Carlos Santana" <[email protected]> wrote: >you are correct Homer and Joe, I figured it out the test needs some love > >I added the <preference name="ErrorUrl" value="htmlnotfound/error.html"/> > > >On Fri, Jan 29, 2016 at 6:58 PM Joe Bowser <[email protected]> wrote: > >> Yeah, it looks like the behaviour has changed since this was run. I have a >> feeling that someone "refactored" and "cleaned up" the tests and the >> original intent of this test was lost. >> >> So, yeah, this should have an intent provided to it, and this test should >> fail. The tests definitely need to be looked at again and their usefulness >> re-evaluated. >> >> On Fri, Jan 29, 2016 at 4:35 PM, Homer, Tony <[email protected]> wrote: >> >> > HtmlNotFoundTest fails for me too. >> > >> > Is it a problem that the CordovaActivity displays an error dialog? >> > If it is, we could override displayError in MainTestActivity. >> > >> > Maybe it's simpler than that - should the test be setting an errorUrl and >> > then asserting that the errorUrl has been loaded? >> > If no errorUrl is set, testActivity.getCordovaWebView().getUrl() would >> > still be equal to START_URL, wouldn't it? >> > >> > >> > In that case the current assertion should fail (and the test would fail). >> > >> > On 1/29/16, 5:16 PM, "Joe Bowser" <[email protected]> wrote: >> > >> > >Run it a few times to be sure it's failing. This test shouldn't fail, >> but >> > >isn't as stable as it should be. >> > > >> > >On Fri, Jan 29, 2016, 2:41 PM Carlos Santana <[email protected]> >> > wrote: >> > > >> > >> I working on getting my environment and all test pass except for one >> > >> >> > >> junit.framework.AssertionFailedError >> > >> at >> > org.apache.cordova.test.HtmlNotFoundTest$1.run(HtmlNotFoundTest.java:36) >> > >> at >> > >> >> > >> >> > >> android.test.InstrumentationTestCase$1.run(InstrumentationTestCase.java:138) >> > >> at >> > android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1871) >> > >> at android.os.Handler.handleCallback(Handler.java:739) >> > >> at android.os.Handler.dispatchMessage(Handler.java:95) >> > >> at android.os.Looper.loop(Looper.java:135) >> > >> at android.app.ActivityThread.main(ActivityThread.java:5254) >> > >> at >> > >> >> > >> >> > >> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) >> > >> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) >> > >> >> > >> Are the tests wrong, or my setup missing something I followed the >> > >> instructions in the README.md in the test folder >> > >> >> > >> >> > >> [1]: >> > https://github.com/apache/cordova-android/blob/master/test/README.md >> > >> >> > >>
