[TESTS] Fixup Security controller tests to match new UI

This commit is contained in:
Hugo Sales 2021-08-03 19:37:11 +00:00
parent 960675b459
commit f760de43b0
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 53 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class SecurityTest extends GNUsocialTestCase
$this->assertResponseIsSuccessful();
$this->assertSelectorNotExists('.alert');
$this->assertRouteSame('main_all');
$this->assertSelectorTextContains('.info b', $nickname);
$this->assertSelectorTextContains('#user-nick', $nickname);
}
public function testLoginAttemptAlreadyLoggedIn()
@ -74,7 +74,7 @@ class SecurityTest extends GNUsocialTestCase
$this->assertResponseIsSuccessful();
$this->assertSelectorNotExists('.alert');
$this->assertRouteSame('main_all');
$this->assertSelectorTextContains('.info b', 'taken_user');
$this->assertSelectorTextContains('#user-nick', 'taken_user');
}
// --------- Register --------------
@ -101,7 +101,7 @@ class SecurityTest extends GNUsocialTestCase
$this->assertResponseIsSuccessful();
$this->assertSelectorNotExists('.alert');
$this->assertRouteSame('main_all');
$this->assertSelectorTextContains('.info b', 'new_nickname');
$this->assertSelectorTextContains('#user-nick', 'new_nickname');
}
public function testRegisterDifferentPassword()
@ -124,11 +124,11 @@ class SecurityTest extends GNUsocialTestCase
{
self::testRegister('new_nickname', 'email@provider', $password);
$this->assertResponseIsSuccessful();
$this->assertSelectorTextContains('#register > div:nth-child(3) > ul > li', $error);
$this->assertSelectorTextContains('ul > li', $error);
$this->assertRouteSame('register');
}
public function testRegisterPassowrdEmpty()
public function testRegisterPasswordEmpty()
{
self::testRegisterPasswordLength('', error: 'Please enter a password');
}
@ -147,7 +147,7 @@ class SecurityTest extends GNUsocialTestCase
{
self::testRegister('new_nickname', '', 'foobar');
$this->assertResponseIsSuccessful();
$this->assertSelectorTextContains('#register > div:nth-child(2) > ul > li', 'Please enter an email');
$this->assertSelectorTextContains('ul > li', 'Please enter an email');
$this->assertRouteSame('register');
}
@ -155,7 +155,7 @@ class SecurityTest extends GNUsocialTestCase
{
self::testRegister($nickname, 'email@provider', 'foobar');
$this->assertResponseIsSuccessful();
$this->assertSelectorTextContains('#register > div:nth-child(1) > ul > li', $error);
$this->assertSelectorTextContains('ul > li', $error);
$this->assertRouteSame('register');
}

View File

@ -0,0 +1,46 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Tests\Core;
use App\Core\DB\DB;
use App\Util\GNUsocialTestCase;
use Symfony\Component\HttpFoundation\Request;
class UserPanelTest extends GNUsocialTestCase
{
// public function testPersonalInfo()
// {
// $client = static::createClient();
// $user = DB::findOneBy('local_user', ['nickname' => 'form_test_user']);
// $client->loginUser($user);
// $client->request('GET', '/settings');
// $client->followRedirect();
// $this->assertResponseIsSuccessful();
// $this->assertRouteSame('settings_personal_info');
// $crawler = $client->submitForm('Save', [
// 'nickname' => 'form_test_user_new_nickname',
// 'full_name' => 'Form User',
// 'homepage' => '',
// ]);
// }
}