[TASK] Acceptance login test with bad credentials 24/46624/12
authorRoland Golla <rolandgolla@gmail.com>
Fri, 12 Feb 2016 16:28:06 +0000 (17:28 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 24 Feb 2016 14:06:51 +0000 (15:06 +0100)
Test backend login with bad credentials and verify an
error message is rendered.

Resolves: #73213
Releases: master
Change-Id: Ic97b9a95d5d8060e2f05b89a9fc2a273ad713c05
Reviewed-on: https://review.typo3.org/46624
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/LoginMouseOverCest.php

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/LoginBadCredentialsCest.php
new file mode 100644 (file)
index 0000000..cbbf436
--- /dev/null
@@ -0,0 +1,54 @@
+<?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');
+    }
+}
index 5bd6849..7004b02 100644 (file)
@@ -33,6 +33,8 @@ class LoginMouseOverCest
         $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');
         });
@@ -42,6 +44,6 @@ class LoginMouseOverCest
         $bsmo = $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
             return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow');
         });
-        $I->assertFalse($bs == $bsmo);
+        $I->assertFalse($bs === $bsmo);
     }
 }