Skip to content

Commit

Permalink
E2Eテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Jun 23, 2022
1 parent 0bad08f commit 84105e2
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@ on:
jobs:
codeception:
name: Codeception
runs-on: ${{ matrix.operating-system }}
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ 7.4 ]
db: [ pgsql ]
group: [ admin01, admin02, admin03, front, installer ]
group: [ 'admin01', 'admin02', 'admin03', 'front', 'restrict-file-upload', 'installer' ]
include:
- db: pgsql
database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db
database_server_version: 14
- group: admin01
- group: 'admin01'
app_env: 'codeception'
- group: admin02
- group: 'admin02'
app_env: 'codeception'
- group: admin03
- group: 'admin03'
app_env: 'codeception'
- group: front
- group: 'front'
app_env: 'codeception'
- group: installer
- group: 'restrict-file-upload'
app_env: 'codeception'
- group: 'installer'
app_env: 'install'
services:
postgres:
Expand Down Expand Up @@ -115,6 +116,7 @@ jobs:
run: php -S 127.0.0.1:8000 codeception/router.php &

- name: Codeception
if: ${{ matrix.group != 'restrict-file-upload' }}
env:
APP_ENV: ${{ matrix.app_env }}
DATABASE_URL: ${{ matrix.database_url }}
Expand All @@ -123,7 +125,21 @@ jobs:
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
GROUP: ${{ matrix.group }}
SYMFONY_DEPRECATIONS_HELPER: weak
run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --skip-group restrict-file-upload --html report.html

- name: Codeception with Restrict file upload
if: ${{ matrix.group == 'restrict-file-upload' }}
env:
APP_ENV: ${{ matrix.app_env }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_DSN: 'smtp://127.0.0.1:1025'
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
GROUP: ${{ matrix.group }}
SYMFONY_DEPRECATIONS_HELPER: weak
ECCUBE_RESTRICT_FILE_UPLOAD: '1'
run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --html report.html

- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v2
Expand Down
96 changes: 96 additions & 0 deletions codeception/acceptance/EA06ContentsManagementCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,24 @@ public function contentsmanagement_ファイル管理_php(AcceptanceTester $I)
$I->see('phpファイルはアップロードできません', '#form1 .errormsg');
}

/**
* @group restrict-fileupload
*/
public function contentsmanagement_ファイル管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->wantTo('EA0602-UC01-T10 ファイル管理 (ファイルアップロード制限)');
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');

if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/file_manager');
$I->see('この機能は管理者によって制限されています。');
}

/**
* @group vaddy
*/
Expand Down Expand Up @@ -244,6 +262,27 @@ public function contentsmanagement_ページ管理(AcceptanceTester $I)
$I->seeInTitle('ページがみつかりません');
}

/**
* @group restrict-fileupload
*/
public function contentsmanagement_ページ管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->wantTo('EA0603-UC01-T04 ページ管理 (ファイルアップロード制限)');
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');
if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/page/new');
$I->see('この機能は管理者によって制限されています。');

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/page/1/edit');
$I->see('この機能は管理者によって制限されています。');
}


public function contentsmanagement_レイアウト管理(AcceptanceTester $I)
{
$I->wantTo('EA0605-UC01-T01 (& UC01-T02 / UC01-T03) レイアウト管理(新規作成・編集・削除)');
Expand Down Expand Up @@ -372,6 +411,28 @@ public function contentsmanagement_ブロック管理(AcceptanceTester $I)
$I->dontSeeElement(['id' => $block]);
}

/**
* @group restrict-fileupload
*/
public function contentsmanagement_ブロック管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->wantTo('EA0604-UC01-T04 ブロック管理 (ファイルアップロード制限)');
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');
if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/block/new');
$I->see('この機能は管理者によって制限されています。');

$config = Fixtures::get('config');
$I->amOnPage('/'.$config['eccube_admin_route'].'/content/block/1/edit');
$I->see('この機能は管理者によって制限されています。');
}


public function contentsmanagement_CSS管理(AcceptanceTester $I)
{
$I->wantTo('EA0606-UC01-T01_CSS管理');
Expand All @@ -389,6 +450,23 @@ public function contentsmanagement_CSS管理(AcceptanceTester $I)
$I->see('お気に入り', '.ec-headerNaviRole');
}

/**
* @group restrict-fileupload
*/
public function contentsmanagement_CSS管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->wantTo('EA0606-UC01-T02_CSS管理(ファイルアップロード制限)');
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');
if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/css');
$I->see('この機能は管理者によって制限されています。');
}

public function contentsmanagement_JavaScript管理(AcceptanceTester $I)
{
$I->wantTo('EA0607-UC01-T01_JavaScript管理');
Expand All @@ -408,6 +486,24 @@ public function contentsmanagement_JavaScript管理(AcceptanceTester $I)
$I->dontSee($test_text, '.ec-headerNaviRole');
}

/**
* @group restrict-fileupload
*/
public function contentsmanagement_JavaScript管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->wantTo('EA0607-UC01-T02_JavaScript管理(ファイルアップロード制限)');
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');
if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/content/js');
$I->see('この機能は管理者によって制限されています。');
}


public function contentsmanagement_メンテナンス管理(AcceptanceTester $I)
{
$I->wantTo('EA0607-UC08-T01_メンテナンス管理');
Expand Down
16 changes: 16 additions & 0 deletions codeception/acceptance/EA08SysteminfoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,22 @@ public function systeminfo_ログイン履歴検索(AcceptanceTester $I)
$I->dontSee('成功', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody');
}

/**
* @group restrict-fileupload
*/
public function systeminfo_テンプレート管理_ファイルアップロード制限(AcceptanceTester $I)
{
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');
if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/store/template/install');
$I->see('この機能は管理者によって制限されています。');
}

/**
* ATTENTION 後続のテストが失敗するため、最後に実行する必要がある
*/
Expand Down
14 changes: 14 additions & 0 deletions codeception/acceptance/EA10PluginCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ public function test_install_enable_disable_enable_disable_remove_local(Acceptan
->削除();
}

public function test_install_enable_disable_enable_disable_remove_local_ファイルアップロード制限(AcceptanceTester $I)
{
$I->expect('環境変数 ECCUBE_RESTRICT_FILE_UPLOAD=1 の場合のテストをします');

$config = Fixtures::get('config');

if ($config['eccube_restrict_file_upload'] === '0') {
$I->getScenario()->skip('ECCUBE_RESTRICT_FILE_UPLOAD=0 のためスキップします');
}

$I->amOnPage('/'.$config['eccube_admin_route'].'/store/plugin/install');
$I->see('この機能は管理者によって制限されています。');
}

public function test_install_remove_local(AcceptanceTester $I)
{
Horizon_Local::start($I)
Expand Down

0 comments on commit 84105e2

Please sign in to comment.