Skip to content

[ブラウザテスト] .envからDUSK_NO_MANUAL_ALL/DUSK_NO_API_TEST_ALLを設定できるように対応 #2196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ FACE_AI_API_KEY="${COMMON_API_KEY}"

#DUSK_DRIVER_URL=

# Do not create manuals in Dusk.
#DUSK_NO_MANUAL_ALL=true

# Do not run API tests in Dusk.
#DUSK_NO_API_TEST_ALL=true

# dusk use uploads dir.
#UPLOADS_DIRECTORY_BASE=uploads_dusk/

Expand Down
17 changes: 17 additions & 0 deletions tests/DuskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ protected function setUp(): void
});
}

// Laravel9以前
// コマンドライン引数 第5(配列インデックス4)に no_manual が指定されていた場合は、マニュアル作成しない。
if ($_SERVER && count($_SERVER['argv']) > 4) {
if ($_SERVER['argv'][4] == 'no_manual') {
Expand All @@ -119,6 +120,17 @@ protected function setUp(): void
}
}

// Laravel 10対応(phpunit 10.x) dusk実行時のコマンドライン引数はテストクラスのパスと認識されるため、envで対応
// .envの DUSK_NO_MANUAL_ALL に何か値が指定されていた場合は、マニュアル作成しない。
if (env('DUSK_NO_MANUAL_ALL')) {
$this->no_manual = true;
}

// .envの DUSK_NO_API_TEST_ALL に何か値が指定されていた場合は、APIテストを実行しない。
if (env('DUSK_NO_API_TEST_ALL')) {
$this->no_api_test = true;
}

/* 一旦コメントアウト。データのクリアは、意識して行いたいかもしれないので。

// テスト実行のタイミングで一度だけ実行する
Expand Down Expand Up @@ -557,6 +569,11 @@ public function putManualData($img_args = null, $method = null, $sort = 0, $leve
*/
public function putManualTemplateData($frame, $category, $test_path, $plugin, $templates)
{
// マニュアル用データ出力がOFF の場合は、出力せずに戻る。
if ($this->no_manual) {
return;
}

// 画像関係パス
$img_args = "";

Expand Down