Run acceptance tests with pretty URLs (#5159)

* Run acceptance tests with pretty URLs

* Fix URLs in tests of user module

* Activate URL rewriting

* Change config to run acceptance tests with pretty URLs
This commit is contained in:
Yuriy Bakhtin 2021-07-08 19:56:19 +03:00 committed by GitHub
parent e2319b3aab
commit 700646e3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 6 deletions

View File

@ -108,7 +108,7 @@ jobs:
run: php protected/humhub/tests/codeception/bin/yii search/rebuild
- name: Run test server
run: php --server 127.0.0.1:8080 &>/tmp/phpserver.log &
run: php --server 127.0.0.1:8080 index-test.php &>/tmp/phpserver.log &
- name: Setup chromedriver
run: chromedriver --url-base=/wd/hub &

View File

@ -10,6 +10,10 @@ if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
die('You are not allowed to access this file.');
}
if (isset($_SERVER['REQUEST_URI']) && preg_match('/\.(?:css|json|js|png|jpg|jpeg|gif|ttf|woff|woff2)(\?.+)?$/i', $_SERVER['REQUEST_URI'])) {
return false; // serve the requested resource as-is.
}
/*defined('YII_DEBUG') or define('YII_DEBUG', true);*/
defined('YII_ENV') or define('YII_ENV', 'test');
defined('YII_ENV_TEST') or define('YII_ENV_TEST', true);

View File

@ -70,7 +70,7 @@ class ProfileCest
$I->wantTo('ensure that my profile works as expected.');
$I->amUser2();
$I->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839d');
$I->amOnPage('/u/user1/user/profile/home');
$I->expectTo('see the profile of User2');
$I->see('Follow');
@ -87,7 +87,7 @@ class ProfileCest
$I->selectOption('select[data-attribute0*=ViewAboutPage]', 'Deny');
$I->amUser1(true);
$I->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839e');
$I->amOnPage('/u/user2/user/profile/home');
$I->dontSee('About');
}
}

View File

@ -278,17 +278,17 @@ class AcceptanceTester extends BaseTester
public function amOnUser1Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839d');
$this->amOnPage('/u/user1/user/profile/home');
}
public function amOnUser2Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839e');
$this->amOnPage('/u/user2/user/profile/home');
}
public function amOnUser3Profile()
{
$this->amOnPage('index-test.php?r=user/profile&uguid=01e50e0d-82cd-41fc-8b0c-552392f5839a');
$this->amOnPage('/u/user3/user/profile/home');
}
public function seeInNotifications($text, $click = false)

View File

@ -8,6 +8,10 @@ $testConfig = [
'request' => [
'cookieValidationKey' => 'test'
],
'urlManager' => [
'showScriptName' => false,
'enablePrettyUrl' => true,
],
],
'params' => [
'dynamicConfigFile' => '@humhub/tests/codeception/config/dynamic.php',