[TASK] Acceptance tests should be more stable on travis 42/47142/4
authorTimo Schmidt <timo.schmidt@dkd.de>
Sun, 6 Mar 2016 19:38:41 +0000 (20:38 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 9 Mar 2016 15:58:22 +0000 (16:58 +0100)
Increase the stability of the acceptance tests on travis-ci by:

* Use waitFor* instead of see* when possible
* Wait after login for the main navigation and the content iframe
* Setting an implicite wait of 1 second to recude general timing issues

In general from time to time phantomjs stucks with:

SessionManagerReqHand - _cleanupWindowlessSessions -
Asynchronous Sessions clean-up phase starting NOW

This needs further investigation:

https://github.com/ariya/phantomjs/issues/11526

Resolves: #74379
Releases: master
Change-Id: I3465e61a1a8c1c5c2bd5a83e928599606ba28c93
Reviewed-on: https://review.typo3.org/47142
Reviewed-by: Roland Golla <rolandgolla@gmail.com>
Tested-by: Roland Golla <rolandgolla@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
.travis.yml
typo3/sysext/core/Build/Configuration/Acceptance/acceptance.suite.yml
typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php
typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php
typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php
typo3/sysext/core/Tests/Acceptance/Backend/Page/InfoOnModuleCest.php
typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php
typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php

index c0fbc10..a361265 100644 (file)
@@ -68,15 +68,15 @@ script:
     fi
   - >
     if [[ "$ACCEPTANCE_TESTS" == "yes" ]]; then
-        export _JAVA_OPTIONS="-Xms1024m -Xmx1024m"
+        export _JAVA_OPTIONS="-Xms1024m -Xmx1024m";
         ./bin/selenium-server-standalone >/dev/null 2>&1 &
         php -S 0.0.0.0:8000 >/dev/null 2>&1 &
-        sleep 3;
+        sleep 5;
         export typo3DatabaseName="typo3";
         export typo3DatabaseHost="localhost";
         export typo3DatabaseUsername="root";
         export typo3DatabasePassword="";
-        ./bin/codecept run acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml typo3/sysext/core/Tests/Acceptance
+        ./bin/codecept run acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml typo3/sysext/core/Tests/Acceptance --debug
     fi
   - >
     if [[ "$PHP_LINT" == "yes" ]]; then
index 36d8933..ec28aba 100644 (file)
@@ -9,6 +9,8 @@ modules:
       url: http://localhost:8000/typo3temp/var/tests/acceptance
       browser: phantomjs
       window_size: 1440x570
+      wait: 1
+      restart: true
 env:
   firefox:
     modules:
index dee226b..4afe49c 100644 (file)
@@ -49,7 +49,7 @@ class BadCredentialsCest
         $I->fillField('#t3-username', 'testify');
         $I->fillField('#t3-password', '123456');
         $I->click('#t3-login-submit-section > button');
-        $I->see('Verifying Login Data');
+        $I->waitForText('Verifying Login Data');
         $I->waitForElement('#t3-login-error');
         $I->see('Your login attempt did not succeed');
     }
index d8fe146..8d42d50 100644 (file)
@@ -36,14 +36,22 @@ class ModuleMenuSliderCest
     {
         $ids = ['#web', '#tools', '#system'];
         $sees = ['Page', 'Extensions'];
-        $typo3Menu = '#typo3-menu';
+
+        $menuItems = [
+            ["mainId" => "#web", "menuItem" => "Page"],
+            ["mainId" => "#tools", "menuItem" => "Extensions"],
+            ["mainId" => "#system", "menuItem" => "Log"]
+        ];
 
         $I->wantTo('check the slider in the module menu');
 
-        foreach ($ids as $id) {
+        foreach ($menuItems as $menuItem) {
+            $id = $menuItem['mainId'];
+            $menuItem = $menuItem['menuItem'];
+
             $I->waitForElement($id);
 
-            // we close all
+            // close the item
             $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($id) {
                 return $webdriver->findElement(\WebDriverBy::cssSelector($id))->getAttribute('class');
             });
@@ -52,20 +60,14 @@ class ModuleMenuSliderCest
                 $I->click($id . ' > div');
                 $I->wait(2); // the animation is so fast
             }
-        }
 
-        foreach ($sees as $see) {
-            $I->cantSee($see);
-        }
+            $I->dontSee($menuItem);
 
-        // we open all
-        foreach ($ids as $id) {
+            // now we expand it
             $I->click($id . ' > div');
-            $I->wait(2);
-        }
 
-        foreach ($sees as $see) {
-            $I->see($see);
+            // and wait a short moment
+            $I->waitForText($menuItem);
         }
     }
-}
\ No newline at end of file
+}
index 5baa56e..b3ead39 100644 (file)
@@ -62,5 +62,4 @@ class AddPageInPageModuleCest
         $I->assertNotEquals(false, strpos($classString, 'has-validation-error'));
         $I->switchToIFrame();
     }
-
-}
\ No newline at end of file
+}
index e661860..d427d56 100644 (file)
@@ -41,7 +41,7 @@ class InfoOnModuleCest
         $I->click('Page');
         $I->switchToIFrame('content');
         $I->waitForElement('h4');
-        $I->see('Web>Page module');
+        $I->waitForText('Web>Page module');
         $I->switchToIFrame();
     }
-}
\ No newline at end of file
+}
index c47ffbf..9eb2f20 100644 (file)
@@ -57,11 +57,11 @@ class CreateASchedulerTaskCest
         $I->fillField('#task_SystemStatusUpdateNotificationEmail', 'test@local.typo3.org');
         $I->click("div.module button.dropdown-toggle");
         $I->click("//a[contains(@data-value,'saveclose')]");
-        $I->see('The task was added successfully.');
+        $I->waitForText('The task was added successfully.');
 
         // run the task
         $I->click("//a[contains(@title, 'Run task')]");
-        $I->see('Executed: System Status Update');
+        $I->waitForText('Executed: System Status Update');
 
         // leave the iframe
         $I->switchToIFrame();
index a244fb0..d794baa 100644 (file)
@@ -70,8 +70,9 @@ class Kasper extends \AcceptanceTester
         $I->fillField('#t3-username', $username);
         $I->fillField('#t3-password', $password);
         $I->click('#t3-login-submit-section > button');
-        $I->see('Verifying Login Data');
-        $I->waitForElement('.nav');
+        // wait for the next to element to indicate if the backend was loaded successful
+        $I->waitForElement('.nav', 30);
+        $I->waitForElement('#typo3-contentContainer iframe', 30);
         $I->seeCookie('be_lastLoginProvider');
         $I->seeCookie('be_typo_user');
     }