Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschucki committed Mar 16, 2024
1 parent 37cb6d6 commit 0edf64e
Show file tree
Hide file tree
Showing 22 changed files with 1,394 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pr0poll
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/dusk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Dusk Tests
on: [push]
jobs:

dusk-php:
runs-on: ubuntu-latest
env:
APP_URL: "http://127.0.0.1:8000"
DB_USERNAME: root
DB_PASSWORD: root
MAIL_MAILER: log
steps:
- uses: actions/checkout@v4
- name: Prepare The Environment
run: cp .env.example .env
- name: Create Database
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE \`pr0poll\` character set UTF8mb4 collate utf8mb4_bin;"
- name: Install Composer Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Generate Application Key
run: php artisan key:generate
- name: Upgrade Chrome Driver
run: php artisan dusk:chrome-driver --detect
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run Laravel Server
run: php artisan serve --no-reload &
- name: Run Dusk Tests
run: php artisan dusk
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: console
path: tests/Browser/console
27 changes: 27 additions & 0 deletions .github/workflows/pest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pest Tests
on: [push]
jobs:

dusk-php:
runs-on: ubuntu-latest
env:
APP_URL: "http://127.0.0.1:8000"
DB_USERNAME: root
DB_PASSWORD: root
MAIL_MAILER: log
steps:
- uses: actions/checkout@v4
- name: Prepare The Environment
run: cp .env.example .env
- name: Create Database
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE \`pr0poll\` character set UTF8mb4 collate utf8mb4_bin;"
- name: Install Composer Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Generate Application Key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Run Pest Tests
run: php artisan test
1 change: 1 addition & 0 deletions app/Filament/Pages/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Login extends \Filament\Pages\Auth\Login
protected function getAuthenticateFormAction(): Action
{
return Action::make('authenticate')
->extraAttributes(['id' => 'loginButton'])
->label('Mit pr0gramm anmelden')
->submit('login');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/MyPollResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static function form(Form $form): Form
return Block::make((string) $questionType->getKey())->label($questionType->title)->schema([
Components\Hidden::make('question_type_id')->default($questionType->getKey()),
Components\Hidden::make('uuid')->default(\Str::uuid()->toString()),
TextInput::make('title')->label('Titel')->maxLength(255)->required()->live(true),
TextInput::make('title')->extraAttributes(['class' => $questionType->getKey().'Input'])->label('Titel')->maxLength(255)->required()->live(true),
Textarea::make('description')->label('Beschreibung')->nullable(),
Components\Repeater::make('options')->label('Auswahlmöglichkeiten')->schema([
TextInput::make('title')->required()->label('Titel')->maxLength(255),
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@
"barryvdh/laravel-debugbar": "^3.9",
"fakerphp/faker": "^1.9.1",
"laravel-lang/common": "^6.1",
"laravel/dusk": "^8.0",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-laravel": "^2.3",
"phpunit/phpunit": "^10.1",
"roave/security-advisories": "dev-latest",
"spatie/laravel-ignition": "^2.0"
Expand Down
Loading

0 comments on commit 0edf64e

Please sign in to comment.