[TASK] The Scheduler should be tested with an acceptance test 20/47120/5
authorTimo Schmidt <timo.schmidt@dkd.de>
Sat, 5 Mar 2016 20:58:52 +0000 (21:58 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 6 Mar 2016 10:29:57 +0000 (11:29 +0100)
Introduces a new test for the scheduler that tests the creation
of a reports scheduler task.

In addition the existing login tests are moved into the "Login" package.

Resolves: #74334
Releases: master
Change-Id: Idce3a7a1f2a798963ad071e6bc0c754807b4959f
Reviewed-on: https://review.typo3.org/47120
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
12 files changed:
.travis.yml
typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/LoginAdminCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/LoginEditorCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/LoginMouseOverCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php [new file with mode: 0644]
typo3/sysext/core/Tests/AcceptanceCoreEnvironment.php

index 2fc1df7..c0fbc10 100644 (file)
@@ -68,6 +68,7 @@ script:
     fi
   - >
     if [[ "$ACCEPTANCE_TESTS" == "yes" ]]; then
+        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;
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/AdminCest.php
new file mode 100644 (file)
index 0000000..587d0a5
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class AdminCest
+{
+
+    /**
+     * Login a admin user and logout again
+     *
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantTo('login with admin');
+        $I->loginAsAdmin();
+
+        // user is redirected to 'about modules' after login, and must see the 'admin tools' section
+        $I->see('Admin tools');
+
+        $I->logout();
+        $I->waitForElement('#t3-username');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/BadCredentialsCest.php
new file mode 100644 (file)
index 0000000..dee226b
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class BadCredentialsCest
+{
+
+    /**
+     * Call backend login page and submit invalid login data.
+     * Verifies login is not accepted and an error message is rendered.
+     *
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantTo('check login functions');
+        $I->amOnPage('/typo3/index.php');
+        $I->waitForElement('#t3-username');
+
+        $I->wantTo('check empty credentials');
+        $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-username'))->getAttribute('required');
+        });
+        $I->assertEquals('true', $required, '#t3-username');
+
+        $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-password'))->getAttribute('required');
+        });
+        $I->assertEquals('true', $required, '#t3-password');
+
+        $I->wantTo('use bad credentials');
+        $I->fillField('#t3-username', 'testify');
+        $I->fillField('#t3-password', '123456');
+        $I->click('#t3-login-submit-section > button');
+        $I->see('Verifying Login Data');
+        $I->waitForElement('#t3-login-error');
+        $I->see('Your login attempt did not succeed');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php
new file mode 100644 (file)
index 0000000..54b36c9
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class EditorCest
+{
+
+    /**
+     * Login a non-admin user and logout again
+     *
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantTo('login with editor');
+        $I->loginAsEditor();
+
+        // user is redirected to 'about modules' after login, but must not see the 'admin tools' section
+        $I->cantSee('Admin tools');
+
+        $I->logout();
+        $I->waitForElement('#t3-username');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/MouseOverCest.php
new file mode 100644 (file)
index 0000000..1aeb17c
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class MouseOverCest
+{
+
+    /**
+     * Call backend login page and verify login button changes color on mouse over,
+     * verifies page is available and CSS is properly loaded.
+     *
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantTo('check login functions');
+        $I->amOnPage('/typo3/index.php');
+        $I->waitForElement('#t3-username', 10);
+        $I->wantTo('mouse over css change login button');
+
+        // Make sure mouse is not over submit button from a previous test
+        $I->moveMouseOver('#t3-username');
+        $bs = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow');
+        });
+
+        $I->moveMouseOver('#t3-login-submit');
+        $I->wait(1);
+        $bsmo = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow');
+        });
+        $I->assertFalse($bs === $bsmo);
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/LoginAdminCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/LoginAdminCest.php
deleted file mode 100644 (file)
index b1b5b7f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Acceptance test
- */
-class LoginAdminCest
-{
-
-    /**
-     * Login a admin user and logout again
-     *
-     * @param \AcceptanceTester $I
-     */
-    public function tryToTest(\AcceptanceTester $I)
-    {
-        $I->wantTo('login with admin');
-        $I->amOnPage('/typo3/index.php');
-        $I->waitForElement('#t3-username');
-        $I->fillField('#t3-username', 'admin');
-        $I->fillField('#t3-password', 'password');
-        $I->click('#t3-login-submit-section > button');
-        $I->waitForElement('.nav');
-        $I->seeCookie('be_lastLoginProvider');
-        $I->seeCookie('be_typo_user');
-        // user is redirected to 'about modules' after login, and must see the 'admin tools' section
-        $I->see('Admin tools');
-        $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a');
-        $I->click('Logout');
-        $I->waitForElement('#t3-username');
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php
deleted file mode 100644 (file)
index 7a6081a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Acceptance test
- */
-class LoginBadCredentialsCest
-{
-
-    /**
-     * Call backend login page and submit invalid login data.
-     * Verifies login is not accepted and an error message is rendered.
-     *
-     * @param \AcceptanceTester $I
-     */
-    public function tryToTest(\AcceptanceTester $I)
-    {
-        $I->wantTo('check login functions');
-        $I->amOnPage('/typo3/index.php');
-        $I->waitForElement('#t3-username');
-
-        $I->wantTo('check empty credentials');
-        $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
-            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-username'))->getAttribute('required');
-        });
-        $I->assertEquals('true', $required, '#t3-username');
-
-        $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
-            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-password'))->getAttribute('required');
-        });
-        $I->assertEquals('true', $required, '#t3-password');
-
-        $I->wantTo('use bad credentials');
-        $I->fillField('#t3-username', 'testify');
-        $I->fillField('#t3-password', '123456');
-        $I->click('#t3-login-submit-section > button');
-        $I->see('Verifying Login Data');
-        $I->waitForElement('#t3-login-error');
-        $I->see('Your login attempt did not succeed');
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/LoginEditorCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/LoginEditorCest.php
deleted file mode 100644 (file)
index 8dd3d04..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Acceptance test
- */
-class LoginEditorCest
-{
-
-    /**
-     * Login a non-admin user and logout again
-     *
-     * @param \AcceptanceTester $I
-     */
-    public function tryToTest(\AcceptanceTester $I)
-    {
-        $I->wantTo('login with admin');
-        $I->amOnPage('/typo3/index.php');
-        $I->waitForElement('#t3-username');
-        $I->fillField('#t3-username', 'editor');
-        $I->fillField('#t3-password', 'password');
-        $I->click('#t3-login-submit-section > button');
-        $I->waitForElement('.nav');
-        $I->seeCookie('be_lastLoginProvider');
-        $I->seeCookie('be_typo_user');
-        // user is redirected to 'about modules' after login, but must not see the 'admin tools' section
-        $I->cantSee('Admin tools');
-        $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a');
-        $I->click('Logout');
-        $I->waitForElement('#t3-username');
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/LoginMouseOverCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/LoginMouseOverCest.php
deleted file mode 100644 (file)
index cea7cd6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Acceptance test
- */
-class LoginMouseOverCest
-{
-
-    /**
-     * Call backend login page and verify login button changes color on mouse over,
-     * verifies page is available and CSS is properly loaded.
-     *
-     * @param \AcceptanceTester $I
-     */
-    public function tryToTest(\AcceptanceTester $I)
-    {
-        $I->wantTo('check login functions');
-        $I->amOnPage('/typo3/index.php');
-        $I->waitForElement('#t3-username', 10);
-        $I->wantTo('mouse over css change login button');
-
-        // Make sure mouse is not over submit button from a previous test
-        $I->moveMouseOver('#t3-username');
-        $bs = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
-            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow');
-        });
-
-        $I->moveMouseOver('#t3-login-submit');
-        $I->wait(1);
-        $bsmo = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
-            return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow');
-        });
-        $I->assertFalse($bs === $bsmo);
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Scheduler/CreateASchedulerTaskCest.php
new file mode 100644 (file)
index 0000000..c47ffbf
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Scheduler;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper;
+
+/**
+ * Acceptance test
+ */
+class CreateASchedulerTaskCest
+{
+    /**
+     * @param Kasper $I
+     */
+    public function _before(Kasper $I)
+    {
+        $I->loginAsAdmin();
+    }
+
+    /**
+     * @param Kasper $I
+     */
+    public function _after(Kasper $I)
+    {
+        $I->logout();
+    }
+
+    /**
+     * @param Kasper $I
+     */
+    public function tryToTest(Kasper $I)
+    {
+        $I->wantTo("To create a scheduler task");
+        $I->see('Scheduler', '#system_txschedulerM1');
+        $I->click('Scheduler', '#system_txschedulerM1');
+
+        // switch to content iframe
+        $I->switchToIFrame('content');
+
+        // create a new task
+        $I->see('No tasks defined yet');
+        $I->click("//a[contains(@title, 'Add task')]");
+        $I->selectOption("form select[id=task_class]", 'System Status Update');
+        $I->selectOption("form select[id=task_type]", 'Single');
+        $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.');
+
+        // run the task
+        $I->click("//a[contains(@title, 'Run task')]");
+        $I->see('Executed: System Status Update');
+
+        // leave the iframe
+        $I->switchToIFrame();
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Kasper.php
new file mode 100644 (file)
index 0000000..a244fb0
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+class Kasper extends \AcceptanceTester
+{
+    /**
+     * Login as user "admin" with password "password".
+     * This user was added as fixture during test bootstrap.
+     *
+     * @return void
+     */
+    public function loginAsAdmin()
+    {
+        $I = $this;
+        $I->login('admin', 'password');
+    }
+
+    /**
+     * Login as user "editor" with password "passowrd".
+     * This user was added as fixture during test bootsrap.
+     *
+     * @return void
+     */
+    public function loginAsEditor()
+    {
+        $I = $this;
+        $I->login('editor', 'password');
+    }
+
+    /**
+     * Logout user by clicking logout button in toolbar
+     *
+     * @return void
+     */
+    public function logout()
+    {
+        $I = $this;
+        $I->amGoingTo('step backend login');
+        $I->amGoingTo('logout');
+        $I->click('#typo3-cms-backend-backend-toolbaritems-usertoolbaritem > a');
+        $I->click('Logout');
+        $I->waitForElement('#t3-username');
+    }
+
+    /**
+     * Helper method for user login.
+     *
+     * @param string $username
+     * @param string $password
+     */
+    protected function login(string $username, string $password)
+    {
+        $I = $this;
+        $I->amGoingTo('Step\Backend\Login username: ' . $username);
+        $I->amOnPage('/typo3/index.php');
+        $I->waitForElement('#t3-username');
+        $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');
+        $I->seeCookie('be_lastLoginProvider');
+        $I->seeCookie('be_typo_user');
+    }
+}
index cd7e984..d516503 100644 (file)
@@ -210,7 +210,9 @@ class AcceptanceCoreEnvironment extends Extension
             't3skin',
             'frontend',
             'recordlist',
+            'reports',
             'sv',
+            'scheduler'
         ];
         $testbase->setUpPackageStates($instancePath, $defaultCoreExtensionsToLoad, $this->coreExtensionsToLoad, $this->testExtensionsToLoad);
         $testbase->setUpBasicTypo3Bootstrap($instancePath);