KrailOrg / krail-testApp

1 stars 0 forks source link

Added test for PushView #44

Closed mcollovati closed 6 years ago

davidsowerby commented 6 years ago

Ran this branch with

./gradlew containerTestTomcat8

and got an error (see below). I think that may be because you still have some workarounds in place because Krail core does not handle push correctly?

Failures (2): Spek:uk.q3c.krail.testapp.PushTest:given an application that should react to messages from other clients:on a client sends a message => Element not found {#PushView-messageLog} Expected: visible Screenshot: file:/home/david/git/krail-testapp/build/reports/tests/1524725544918.0.png Page source: file:/home/david/git/krail-testapp/build/reports/tests/1524725544918.0.html Timeout: 4 s. Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#PushView-messageLog"} Spek:uk.q3c.krail.testapp.PushTest:given an application that should react to messages from other clients:on a client sends a message while push is not enabled => Element not found {#PushView-messageLog} Expected: visible Screenshot: file:/home/david/git/krail-testapp/build/reports/tests/1524725549326.1.png Page source: file:/home/david/git/krail-testapp/build/reports/tests/1524725549326.1.html Timeout: 4 s. Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#PushView-messageLog"}

mcollovati commented 6 years ago

No, there are not workarounds on this branch. Tests completed successfully with the same task for me. Maybe some delay is needed after entering page? Will have a look at this later

davidsowerby commented 6 years ago

Good to know - it may just be timing then.

I'll try later with that in mind

davidsowerby commented 6 years ago

I added a line to navigateToPushView() and the test worked. I seem to remember having a similar issue before:

fun navigateToPushView(theBrowser: Browser) {
    theBrowser.navigateTo("notifications/push")
    theBrowser.fragmentShouldBe("notifications/push")
    theBrowser.viewShouldBe(PushView::class.java)
}
davidsowerby commented 6 years ago

Sadly this is not consistent. Just had a few more failures, but also successful runs.

It seems to be related to application start up --- the app appears, and the url changes to notifications/push - but the view does not change. I suspect this is not related to PushView - I'm wondering if a few seconds delay at the very start, to let the application settle, before running any tests at all, might solve the problem

davidsowerby commented 6 years ago

Ran this a few more times, and there does seem to be a pattern.

./gradlew clean containerTestTomcat8

Seems to fail consistently

./gradlew containerTestTomcat8

Will work on second or later attempt. It seems like something is being cached

mcollovati commented 6 years ago

I'm not able to reproduce the problem. Adding a delay before theBrowser.navigateTo("notifications/push") does not help? May adding a browser.viewShouldBe(TestAppPublicHomeView::class.java) in beforeGroup be useful?

        beforeGroup {
            executionMode = ExecutionMode.SELENIDE
            createBrowser()
            browser.viewShouldBe(TestAppPublicHomeView::class.java)
        }