Test alignments

This commit is contained in:
buddha87 2016-09-19 11:39:23 +02:00
parent 99203d02bf
commit ae73029fc5
16 changed files with 149 additions and 38 deletions

View File

@ -24,4 +24,5 @@ return [
['id' => 4, 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34a', 'class' => 'humhub\modules\space\models\Space', 'pk' => '1', 'owner_user_id' => 1],
['id' => 5, 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34b', 'class' => 'humhub\modules\space\models\Space', 'pk' => '2', 'owner_user_id' => 2],
['id' => 6, 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34c', 'class' => 'humhub\modules\space\models\Space', 'pk' => '3', 'owner_user_id' => 3],
['id' => 7, 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34d', 'class' => 'humhub\modules\space\models\Space', 'pk' => '4', 'owner_user_id' => 3],
];

View File

@ -0,0 +1,9 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
return [];

View File

@ -1,4 +1,4 @@
<?php //[STAMP] 890a71cd7f21af7a261c0d3eceef09fb
<?php //[STAMP] c20a7faea2c1c711fd2f9ce4e9fd6e65
namespace user\_generated;
// This class was automatically generated by build task

View File

@ -55,8 +55,16 @@ class AccountCest
$I->expectTo('see the notification settings form');
$I->see('Send notifications?');
$I->see('Send activities?');
$I->selectOption('AccountEmailing[receive_email_notifications]', 'Never');
$I->selectOption('AccountEmailing[receive_email_activities]', 'Never');
$I->click('.regular-checkbox-box');
$I->click('Save');
$I->waitForElementVisible('.data-saved', 5);
// Refresh page
$I->amOnPage('index-test.php?r=user%2Faccount%2Femailing');
$I->click('Notifications'); //Notification tab
$I->seeOptionIsSelected('AccountEmailing[receive_email_notifications]', 'Never');
$I->seeOptionIsSelected('AccountEmailing[receive_email_activities]', 'Never');
}
}

View File

@ -24,9 +24,9 @@ paths:
log: codeception/_output
data: codeception/_data
helpers: codeception/_support
#include:
include:
- ../modules/*/tests
#- ../../../../modules/*/tests
#- ../modules/*/tests
settings:
bootstrap: _bootstrap.php

View File

@ -19,13 +19,11 @@ $_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config
// Set alias
$config = \Codeception\Configuration::config();
$testRoot = $config['test_root'];
if($testRoot == null) {
$testRoot = dirname(__DIR__);
}
$config['test_root'] = isset($config['test_root']) ? $config['test_root'] : dirname(__DIR__);
$config['humhub_root'] = isset($config['humhub_root']) ? $config['humhub_root'] : realpath(dirname(__DIR__ ). '/../../../');
Yii::setAlias('@tests', $testRoot);
Yii::setAlias('@tests', $config['test_root']);
Yii::setAlias('@env', '@tests/config/env');
Yii::setAlias('@modules', dirname(dirname(__DIR__)).'/modules');
Yii::setAlias('@root', $config['humhub_root']);

View File

@ -1,7 +1,5 @@
<?php
use tests\codeception\_pages\LoginPage;
/**
@ -18,85 +16,143 @@ use tests\codeception\_pages\LoginPage;
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;
public function amAdmin($logout = false)
{
$this->amUser('Admin', 'test', $logout);
}
public function amUser1($logout = false)
{
$this->amUser('User1', '123qwe', $logout);
}
public function amUser2($logout = false)
{
$this->amUser('User2', '123qwe', $logout);
}
public function amUser3($logout = false)
{
$this->amUser('User3', '123qwe', $logout);
}
public function amOnSpace1()
{
$this->amOnPage('index-test.php?r=space/space&sguid=5396d499-20d6-4233-800b-c6c86e5fa34a');
}
public function amOnSpace2()
{
$this->amOnPage('index-test.php?r=space/space&sguid=5396d499-20d6-4233-800b-c6c86e5fa34b');
}
public function amOnSpace3()
{
$this->amOnPage('index-test.php?r=space/space&sguid=5396d499-20d6-4233-800b-c6c86e5fa34c');
}
public function amOnSpace4()
{
$this->amOnPage('index-test.php?r=space/space&sguid=5396d499-20d6-4233-800b-c6c86e5fa34d');
}
public function amUser($user = null, $password = null, $logout = false)
{
if($logout) {
if ($logout) {
$this->logout();
}
$user = ($user != null) ? $user : 'User1';
$password = ($password != null) ? $password : '123qwe';
$this->login($user, $password);
$this->wait(10);
$this->wait(5);
$this->seeElement('#wallStream');
}
public function login($user, $password)
{
LoginPage::openBy($this)->login($user, $password);
}
public function logout()
{
$this->clickAccountDropDown();
$this->click('Logout');
$this->wait(10);
$this->wait(5);
}
public function clickAccountDropDown()
{
$this->click('#account-dropdown-link');
$this->wait(2);
}
public function amOnProfile()
{
$this->clickAccountDropDown();
$this->click('My profile');
}
public function amOnUser1Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839d');
}
public function amOnUser2Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839e');
}
public function amOnUser3Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839a');
}
public function seeInNotifications($text)
{
$this->click('.notifications');
$this->wait(1);
$this->see($text);
$this->click('.notifications');
}
public function dontSeeInNotifications($text)
{
$this->click('.notifications');
$this->wait(1);
$this->dontSee($text);
$this->click('.notifications');
}
public function jsClick($selector)
{
$this->executeJS('$("'.$selector.'").click();');
$this->executeJS('$("' . $selector . '").click();');
}
public function jsFillField($selector, $value)
{
$this->executeJS('$("'.$selector.'").val("'.$value.'");');
$this->executeJS('$("' . $selector . '").val("' . $value . '");');
}
public function jsShow($selector)
{
$this->executeJS('$("'.$selector.'").show();');
$this->executeJS('$("' . $selector . '").show();');
}
public function jsAttr($selector, $attr, $val)
{
$this->executeJS('$("'.$selector.'").attr("'.$attr.'", "'.$val.'");');
$this->executeJS('$("' . $selector . '").attr("' . $attr . '", "' . $val . '");');
}
public function scrollToTop()
{
$this->executeJS('window.scrollTo(0,0);');
}
}

View File

@ -111,6 +111,7 @@ class DynamicFixtureHelper extends Module
'space' => [ 'class' => \tests\codeception\fixtures\SpaceFixture::className()],
'space_membership' => [ 'class' => \tests\codeception\fixtures\SpaceMembershipFixture::className()],
'contentcontainer' => [ 'class' => \tests\codeception\fixtures\ContentContainerFixture::className()],
'notification' => [ 'class' => \tests\codeception\fixtures\NotificationFixture::className()],
];
}

View File

@ -72,6 +72,7 @@ class HumHubDbTestCase extends \yii\codeception\DbTestCase
'space' => [ 'class' => \tests\codeception\fixtures\SpaceFixture::className()],
'space_membership' => [ 'class' => \tests\codeception\fixtures\SpaceMembershipFixture::className()],
'contentcontainer' => [ 'class' => \tests\codeception\fixtures\ContentContainerFixture::className()],
'notification' => [ 'class' => \tests\codeception\fixtures\NotificationFixture::className()],
];
}
}

View File

@ -32,6 +32,9 @@ $default = [
'scriptUrl' => 'index-test.php',
],
],
'params' => [
'allowedLanguages' => ['en']
]
];
return yii\helpers\ArrayHelper::merge(

View File

@ -14,7 +14,7 @@ class ContentFixture extends ActiveFixture
{
public $modelClass = 'humhub\modules\content\models\Content';
public $dataFile = '@tests/../modules/content/tests/codeception/_data/content.php';
public $dataFile = '@modules/content/tests/codeception/_data/content.php';
public $depends = [
'tests\codeception\fixtures\ContentContainerFixture'

View File

@ -0,0 +1,23 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace tests\codeception\fixtures;
use yii\test\ActiveFixture;
class NotificationFixture extends ActiveFixture
{
public $modelClass = 'humhub\modules\notification\models\Notification';
public $dataFile = '@modules/notification/tests/codeception/fixtures/data/notification.php';
public $depends = [
'tests\codeception\fixtures\GroupUserFixture'
];
}

View File

@ -20,5 +20,5 @@ return array(
array('name' => 'cache.expireTime', 'value' => '3600', 'module_id' => 'base'),
array('name' => 'installationId', 'value' => '99846c45e9b9b0962238986a6fed519a', 'module_id' => 'admin'),
array('name' => 'theme', 'value' => 'HumHub', 'module_id' => 'base'),
array('name' => 'tour', 'value' => '1', 'module_id' => 'base')
array('name' => 'tour', 'value' => '1', 'module_id' => 'base'),
);

View File

@ -18,8 +18,9 @@
* GNU Affero General Public License for more details.
*/
return array(
array('id' => '1', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34a', 'name' => 'Space 1', 'description' => 'Space by Admin', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '1', 'ldap_dn' => NULL, 'auto_add_new_members' => '0'),
array('id' => '2', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34b', 'name' => 'Space 2', 'description' => 'User 1 Space', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '2', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '2', 'ldap_dn' => NULL, 'auto_add_new_members' => '0'),
array('id' => '3', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34c', 'name' => 'Space 3', 'description' => 'Another User 1 Space', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '2', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '2', 'ldap_dn' => NULL, 'auto_add_new_members' => '1')
array('id' => '1', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34a', 'name' => 'Space 1', 'contentcontainer_id' => '4', 'description' => 'Space by Admin', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '1', 'ldap_dn' => NULL, 'auto_add_new_members' => '0'),
array('id' => '2', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34b', 'name' => 'Space 2', 'contentcontainer_id' => '5', 'description' => 'User 1 Space', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '2', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '2', 'ldap_dn' => NULL, 'auto_add_new_members' => '0'),
array('id' => '3', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34c', 'name' => 'Space 3', 'contentcontainer_id' => '6', 'description' => 'Another User 1 Space', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '2', 'ldap_dn' => NULL, 'auto_add_new_members' => '1'),
array('id' => '4', 'guid' => '5396d499-20d6-4233-800b-c6c86e5fa34d', 'name' => 'Space 4', 'contentcontainer_id' => '7', 'description' => 'User 1/2 Space', 'join_policy' => '2', 'visibility' => '2', 'status' => '1', 'tags' => NULL, 'created_at' => '2014-08-08 05:36:04', 'created_by' => '2', 'updated_at' => '2014-08-08 05:36:04', 'updated_by' => '2', 'ldap_dn' => NULL, 'auto_add_new_members' => '1')
);

View File

@ -23,7 +23,17 @@ return array(
array('space_id' => '1', 'user_id' => '1', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'admin', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
array('space_id' => '1', 'user_id' => '3', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => NULL, 'group_id' => 'member', 'created_at' => '2014-08-10 16:55:41', 'created_by' => NULL, 'updated_at' => NULL, 'updated_by' => NULL),
// User 2 is Member/Admin of Space 2 & 3
// User 2 is Member/Admin of Space 2
array('space_id' => '2', 'user_id' => '2', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'admin', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
array('space_id' => '3', 'user_id' => '2', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'admin', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
// User 1 is admin of space 3 and user 2 & 3 are members
array('space_id' => '3', 'user_id' => '1', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'admin', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
array('space_id' => '3', 'user_id' => '2', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => NULL, 'group_id' => 'member', 'created_at' => '2014-08-10 16:55:41', 'created_by' => NULL, 'updated_at' => NULL, 'updated_by' => NULL),
array('space_id' => '3', 'user_id' => '3', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'member', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
// User 1/2 is admin of space 3 and user 3 is members
array('space_id' => '4', 'user_id' => '1', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'admin', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
array('space_id' => '4', 'user_id' => '2', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => NULL, 'group_id' => 'admin', 'created_at' => '2014-08-10 16:55:41', 'created_by' => NULL, 'updated_at' => NULL, 'updated_by' => NULL),
array('space_id' => '4', 'user_id' => '3', 'originator_user_id' => NULL, 'status' => '3', 'request_message' => NULL, 'last_visit' => '2014-08-08 06:49:57', 'group_id' => 'member', 'created_at' => '2014-08-08 05:36:05', 'created_by' => '1', 'updated_at' => '2014-08-08 05:36:05', 'updated_by' => '1'),
);

View File

@ -70,7 +70,7 @@ if ($confirmJS != "") {
],
'htmlOptions' => [
'return' => 'true',
'class' => 'btn btn-primary',
'class' => 'btn btn-primary modalConfirm',
'data-dismiss' => 'modal'
]
]);