Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
6.4
-
None
-
Unknown
-
Description
Several tests are wrongly using findElements() when they're looking for some element that don't exist (thus incurring the timeout). I'd like to flush out those tests so that they can be fixed (I've fixed a lot of them in the past but there are still a lot remaining).
A first step would be to generate a WARNING on the logs when they execute. For example, I ran the Administration functional tests and got:
11:18:34.685 [main] INFO org.xwiki.test.ui.TestDebugger - AdministrationTest-verifyGlobalAndSpaceSections started 11:18:38.618 [main] INFO org.xwiki.test.ui.TestDebugger - AdministrationTest-verifyGlobalAndSpaceSections passed 11:18:38.621 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageNestedDocumentsTest-createNestedDocumentsFromURL started 11:20:55.046 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageNestedDocumentsTest-createNestedDocumentsFromURL passed 11:20:55.047 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageNestedDocumentsTest-createNestedDocumentsFromUI started 11:22:15.261 [main] WARN org.xwiki.test.ui.XWikiWebDriver - The currently running test should be modified since it's wrongly waiting for a timeout! 11:23:25.045 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageNestedDocumentsTest-createNestedDocumentsFromUI passed 11:23:25.046 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPageWithSaveAndEditTemplate started 11:23:29.825 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPageWithSaveAndEditTemplate passed 11:23:29.826 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createExistingPageAndSpace started 11:23:37.606 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createExistingPageAndSpace passed 11:23:37.607 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPageWhenNoTemplateAvailable started 11:24:40.930 [main] WARN org.xwiki.test.ui.XWikiWebDriver - The currently running test should be modified since it's wrongly waiting for a timeout! 11:25:38.588 [main] WARN org.xwiki.test.ui.XWikiWebDriver - The currently running test should be modified since it's wrongly waiting for a timeout! 11:28:04.317 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPageWhenNoTemplateAvailable passed 11:28:04.318 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPagesFromTemplate started 11:30:32.854 [main] WARN org.xwiki.test.ui.XWikiWebDriver - The currently running test should be modified since it's wrongly waiting for a timeout! 11:31:08.523 [main] INFO org.xwiki.test.ui.TestDebugger - CreatePageTest-createPagesFromTemplate passed 11:31:08.525 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWhenImportAsBackupIsNotSelected started 11:31:14.075 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWhenImportAsBackupIsNotSelected passed 11:31:14.076 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportHasNoPackageByDefault started 11:31:16.525 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportHasNoPackageByDefault passed 11:31:16.525 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWithNewHistoryVersion started 11:31:21.236 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWithNewHistoryVersion passed 11:31:21.237 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWithHistory started 11:31:26.931 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportWithHistory passed 11:31:26.932 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportAsBackup started 11:31:32.317 [main] INFO org.xwiki.test.ui.TestDebugger - ImportTest-testImportAsBackup passed 11:31:32.318 [main] INFO org.xwiki.test.ui.TestDebugger - ResetPasswordTest-resetForgottenPassword started 11:31:34.229 [Thread-5] ERROR o.x.t.i.XWikiLogOutputStream - 2015-09-14 11:31:34,228 [http://localhost:8080/xwiki/bin/register/XWiki/Register?register=1&form_token=RVIqGczXqXQjW8sHO62HiQ®ister_password=password®ister2_password=password&xredirect&xwikiname=testUserKGn2D5®ister_email=&] WARN o.x.c.i.DefaultCSRFToken - CSRFToken: Secret token verification failed, token: "RVIqGczXqXQjW8sHO62HiQ", stored token: "5sMRixKnmzTqun5Xj7AGyw" 11:31:43.106 [main] INFO org.xwiki.test.ui.TestDebugger - ResetPasswordTest-resetForgottenPassword passed
As you can see 4 tests have to be fixed. Note that this means that overall the administration tests take 4*10= 40 seconds more than what they should take.
Note that even for tests that wait for an element to not be there, they can be rewritten to use waitUntilElementDisappears() for example.