mirror of
https://github.com/humhub/humhub.git
synced 2025-01-29 12:28:06 +01:00
Fixed tour humhub:ready listener not removed
Added tour acceptance tests
This commit is contained in:
parent
9825a9a224
commit
7cd373f4fa
24
protected/humhub/modules/tour/tests/codeception.yml
Normal file
24
protected/humhub/modules/tour/tests/codeception.yml
Normal file
@ -0,0 +1,24 @@
|
||||
actor: Tester
|
||||
namespace: tour
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
suite_class: \PHPUnit_Framework_TestSuite
|
||||
colors: true
|
||||
shuffle: false
|
||||
memory_limit: 1024M
|
||||
log: true
|
||||
|
||||
# This value controls whether PHPUnit attempts to backup global variables
|
||||
# See https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.backupGlobals
|
||||
backup_globals: true
|
||||
paths:
|
||||
tests: codeception
|
||||
log: codeception/_output
|
||||
data: codeception/_data
|
||||
helpers: codeception/_support
|
||||
envs: ../../../tests/config/env
|
||||
config:
|
||||
# the entry script URL (with host info) for functional and acceptance tests
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||
test_entry_url: http://localhost:8080/index-test.php
|
||||
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* This is the initial test bootstrap, which will load the default test bootstrap from the humhub core
|
||||
*/
|
||||
// Parse the environment arguments (Note: only simple --env ENV is supported no comma sepration merge...)
|
||||
$env = isset($GLOBALS['env']) ? $GLOBALS['env'] : [];
|
||||
|
||||
// If environment was set try loading special environment config else load default
|
||||
if (count($env) > 0) {
|
||||
\Codeception\Configuration::append(['environment' => $env]);
|
||||
|
||||
|
||||
$envCfgFile = dirname(__DIR__) . '/config/env/test.' . $env[0][0] . '.php';
|
||||
|
||||
if (file_exists($envCfgFile)) {
|
||||
$cfg = array_merge(require_once(__DIR__ . '/../config/test.php'), require_once($envCfgFile));
|
||||
}
|
||||
}
|
||||
|
||||
// If no environment is set we have to load the default config
|
||||
if (!isset($cfg)) {
|
||||
$cfg = require_once(__DIR__ . '/../config/test.php');
|
||||
}
|
||||
|
||||
// If no humhub_root is given we assume our module is in the a root to be in /protected/humhub/modules/<module>/tests/codeception directory
|
||||
$cfg['humhub_root'] = isset($cfg['humhub_root']) ? $cfg['humhub_root'] : dirname(__DIR__) . '/../../../../..';
|
||||
|
||||
|
||||
// Load default test bootstrap
|
||||
require_once($cfg['humhub_root'] . '/protected/humhub/tests/codeception/_bootstrap.php');
|
||||
|
||||
// Overwrite the default test alias
|
||||
Yii::setAlias('@tests', dirname(__DIR__));
|
||||
Yii::setAlias('@env', '@tests/config/env');
|
||||
Yii::setAlias('@root', $cfg['humhub_root']);
|
||||
Yii::setAlias('@humhubTests', $cfg['humhub_root'] . '/protected/humhub/tests');
|
||||
|
||||
// Load all supporting test classes needed for test execution
|
||||
\Codeception\Util\Autoload::addNamespace('', Yii::getAlias('@humhubTests/codeception/_support'));
|
||||
\Codeception\Util\Autoload::addNamespace('tests\codeception\fixtures', Yii::getAlias('@humhubTests/codeception/fixtures'));
|
||||
\Codeception\Util\Autoload::addNamespace('', Yii::getAlias('@humhubTests/codeception/_pages'));
|
||||
if(isset($cfg['modules'])) {
|
||||
\Codeception\Configuration::append(['humhub_modules' => $cfg['modules']]);
|
||||
}
|
||||
|
||||
if(isset($cfg['fixtures'])) {
|
||||
\Codeception\Configuration::append(['fixtures' => $cfg['fixtures']]);
|
||||
}
|
||||
?>
|
4
protected/humhub/modules/tour/tests/codeception/_output/.gitignore
vendored
Normal file
4
protected/humhub/modules/tour/tests/codeception/_output/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace tour;
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class AcceptanceTester extends \AcceptanceTester
|
||||
{
|
||||
use _generated\AcceptanceTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace tour;
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class FunctionalTester extends \FunctionalTester
|
||||
{
|
||||
use _generated\FunctionalTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace tour;
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class UnitTester extends \UnitTester
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Codeception Test Suite Configuration
|
||||
|
||||
# suite for acceptance tests.
|
||||
# perform tests in browser using the Selenium-like tools.
|
||||
# powered by Mink (http://mink.behat.org).
|
||||
# (tip: that's what your customer will see).
|
||||
# (tip: test your ajax and javascript by one of Mink drivers).
|
||||
|
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
|
||||
|
||||
class_name: AcceptanceTester
|
||||
modules:
|
||||
enabled:
|
||||
- WebDriver
|
||||
- tests\codeception\_support\WebHelper
|
||||
- tests\codeception\_support\DynamicFixtureHelper
|
||||
config:
|
||||
WebDriver:
|
||||
url: 'http://localhost:8080/'
|
||||
browser: chrome
|
||||
port: 4444
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace tour\acceptance;
|
||||
|
||||
use tour\AcceptanceTester;
|
||||
|
||||
class TourCest
|
||||
{
|
||||
/**
|
||||
* @param AcceptanceTester $I
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testTour(AcceptanceTester $I)
|
||||
{
|
||||
$I->amAdmin();
|
||||
$I->amOnDashboard();
|
||||
|
||||
$I->dontSeeElement('#getting-started-panel');
|
||||
|
||||
$I->amOnRoute(['/admin/setting/basic']);
|
||||
|
||||
$I->see('Show introduction tour for new users');
|
||||
$I->click('.field-basicsettingsform-tour label');
|
||||
|
||||
$I->click('Save');
|
||||
$I->seeSuccess();
|
||||
|
||||
$I->amOnDashboard();
|
||||
$I->waitForText('You are the first user here', null, '#globalModal');
|
||||
$I->click('Save and close', '#globalModal');
|
||||
|
||||
$I->waitForElementVisible('#getting-started-panel');
|
||||
$I->see('Guide: Administration (Modules)', '#getting-started-panel');
|
||||
|
||||
$I->wait(1);
|
||||
$I->click('Guide: Overview');
|
||||
|
||||
$I->waitForElementVisible('.popover.tour');
|
||||
$I->see('Dashboard', '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Notifications', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Account Menu', null,'.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Space Menu', null, '.popover.tour');
|
||||
$I->click('Start space guide', '.popover.tour');
|
||||
|
||||
$I->wait(2);
|
||||
|
||||
$I->waitForText('Once you have joined or created a new space', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Space navigation menu', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Space preferences', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Writing posts', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Yours, and other users\' posts will appear here.', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Most recent activities', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Space members', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Yay! You\'re done.', null, '.popover.tour');
|
||||
$I->click('Profile Guide', '.popover.tour');
|
||||
|
||||
$I->waitForText('User profile', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Profile photo', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Edit account', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Profile menu', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Profile stream', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Hurray! You\'re done!', null, '.popover.tour');
|
||||
$I->click('Administration (Modules)', '.popover.tour');
|
||||
|
||||
$I->waitForText('As an admin, you can manage the whole platform from here', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Modules', null, '.popover.tour');
|
||||
$I->click('Next', '.popover.tour');
|
||||
|
||||
$I->waitForText('Hurray! That\'s all for now.', null, '.popover.tour');
|
||||
$I->click('End guide', '.popover.tour');
|
||||
|
||||
$I->amUser1(true);
|
||||
$I->amOnDashboard();
|
||||
$I->seeElement('#getting-started-panel');
|
||||
$I->dontSee('Guide: Administration (Modules)', '#getting-started-panel');
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
|
||||
* in @tests/config/functional.php
|
||||
*/
|
||||
require(Yii::getAlias('@humhubTests/codeception/acceptance/_bootstrap.php'));
|
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
return \tests\codeception\_support\HumHubTestConfiguration::getSuiteConfig('functional');
|
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
return \tests\codeception\_support\HumHubTestConfiguration::getSuiteConfig('unit');
|
@ -0,0 +1,18 @@
|
||||
# Codeception Test Suite Configuration
|
||||
|
||||
# suite for functional (integration) tests.
|
||||
# emulate web requests and make application process them.
|
||||
# (tip: better to use with frameworks).
|
||||
|
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
|
||||
class_name: FunctionalTester
|
||||
modules:
|
||||
enabled:
|
||||
- Filesystem
|
||||
- Yii2
|
||||
- tests\codeception\_support\TestHelper
|
||||
- tests\codeception\_support\DynamicFixtureHelper
|
||||
- tests\codeception\_support\HumHubHelper
|
||||
config:
|
||||
Yii2:
|
||||
configFile: 'codeception/config/functional.php'
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
|
||||
* in @tests/config/functional.php
|
||||
*/
|
||||
require(Yii::getAlias('@humhubTests/codeception/functional/_bootstrap.php'));
|
@ -0,0 +1,14 @@
|
||||
# Codeception Test Suite Configuration
|
||||
|
||||
# suite for unit (internal) tests.
|
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
|
||||
|
||||
class_name: UnitTester
|
||||
modules:
|
||||
enabled:
|
||||
- tests\codeception\_support\CodeHelper
|
||||
- Yii2
|
||||
config:
|
||||
Yii2:
|
||||
configFile: 'codeception/config/unit.php'
|
||||
transaction: false
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
|
||||
* in @tests/config/functional.php
|
||||
*/
|
||||
require(Yii::getAlias('@humhubTests/codeception/unit/_bootstrap.php'));
|
5
protected/humhub/modules/tour/tests/config/common.php
Normal file
5
protected/humhub/modules/tour/tests/config/common.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* This config is shared by all suites (unit/functional/acceptance) and can be overwritten by a suite config (e.g. functional.php)
|
||||
*/
|
||||
return [];
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Here you can overwrite the default config for the functional suite. The default config resides in @humhubTests/codeception/config/config.php
|
||||
*/
|
||||
return [];
|
5
protected/humhub/modules/tour/tests/config/test.php
Normal file
5
protected/humhub/modules/tour/tests/config/test.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'fixtures' => ['default']
|
||||
];
|
5
protected/humhub/modules/tour/tests/config/unit.php
Normal file
5
protected/humhub/modules/tour/tests/config/unit.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Here you can overwrite your functional humhub config. The default config resiedes in @humhubTests/codeception/config/config.php
|
||||
*/
|
||||
return [];
|
@ -6,7 +6,7 @@ $this->context->loadResources($this);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
$( document ).on('humhub:ready', function() {
|
||||
$( document ).one('humhub:ready', function() {
|
||||
// Create a new tour
|
||||
var administrationTour = new Tour({
|
||||
storage: false,
|
||||
|
@ -9,7 +9,7 @@ $this->context->loadResources($this);
|
||||
var gotoSpace = false;
|
||||
|
||||
|
||||
$(document).on('humhub:ready', function () {
|
||||
$(document).one('humhub:ready', function () {
|
||||
|
||||
// Create a new tour
|
||||
var interfaceTour = new Tour({
|
||||
|
@ -9,7 +9,7 @@ $this->context->loadResources($this);
|
||||
|
||||
var gotoAdministration = false;
|
||||
|
||||
$(document).on('humhub:ready', function () {
|
||||
$(document).one('humhub:ready', function () {
|
||||
// Create a new tour
|
||||
var profileTour = new Tour({
|
||||
storage: false,
|
||||
|
@ -7,7 +7,7 @@ $this->context->loadResources($this);
|
||||
<script type="text/javascript">
|
||||
|
||||
var gotoProfile = false;
|
||||
$(document).on('humhub:ready', function () {
|
||||
$(document).one('humhub:ready', function () {
|
||||
// Create a new tour
|
||||
var spacesTour = new Tour({
|
||||
storage: false,
|
||||
|
@ -39,7 +39,7 @@ return yii\helpers\ArrayHelper::merge(
|
||||
// Web Config
|
||||
require(YII_APP_BASE_PATH . '/humhub/config/web.php'),
|
||||
// Test Common Config
|
||||
require(dirname(__DIR__) . '/config/config.php'),
|
||||
require(__DIR__ . '/config.php'),
|
||||
// Functional Test Config
|
||||
$testConfig
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user