Skip to content

Commit 368b1f7

Browse files
committed
Fix failing dusk tests
1 parent f5ddd79 commit 368b1f7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/tests.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,21 @@ jobs:
131131
composer require protonemedia/laravel-dusk-fakes:^1.6 --dev --with-all-dependencies
132132
working-directory: ./laravel_app_${{ matrix.php-version }}
133133

134+
- name: Set port number based on PHP version
135+
run: |
136+
if [[ "${{ matrix.php-version }}" == "8.2" ]]; then
137+
echo "SERVER_PORT=8000" >> $GITHUB_ENV
138+
elif [[ "${{ matrix.php-version }}" == "8.3" ]]; then
139+
echo "SERVER_PORT=8001" >> $GITHUB_ENV
140+
else
141+
echo "SERVER_PORT=8002" >> $GITHUB_ENV
142+
fi
143+
134144
- name: Start Chrome Driver and PHP Server
135145
run: |
136146
php artisan dusk:chrome-driver --detect &
137147
./vendor/laravel/dusk/bin/chromedriver-linux &
138-
php artisan serve --port=$((8000 + ${{ matrix.php-version == '8.2' && 0 || matrix.php-version == '8.3' && 1 || 2 }})) --no-reload &
148+
php artisan serve --port=${{ env.SERVER_PORT }} --no-reload &
139149
working-directory: ./laravel_app_${{ matrix.php-version }}
140150

141151
- name: Run Tests
@@ -144,7 +154,7 @@ jobs:
144154

145155
- name: Run Dusk Tests
146156
env:
147-
APP_URL: http://127.0.0.1:$((8000 + ${{ matrix.php-version == '8.2' && 0 || matrix.php-version == '8.3' && 1 || 2 }}))
157+
APP_URL: "http://127.0.0.1:${{ env.SERVER_PORT }}"
148158
APP_ENV: testing
149159
run: php artisan dusk -vvv
150160
working-directory: ./laravel_app_${{ matrix.php-version }}

0 commit comments

Comments
 (0)