diff --git a/.env.cypress b/.env.cypress new file mode 100644 index 0000000..20868dd --- /dev/null +++ b/.env.cypress @@ -0,0 +1,27 @@ +APP_NAME=notaR +APP_ENV=local +APP_KEY=base64:ikjUI2Mbr1dKGd3fvDDB+ldw4qZ9bs3qQcySGFO5axQ= +APP_DEBUG=true +APP_URL=http://0.0.0.0:8000 +APP_SCHEME=http +APP_SERVICE=app +APP_TIMEZONE='America/Sao_Paulo' + +LOG_CHANNEL=silent +LOG_LEVEL=none + +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 +DB_DATABASE=notaR +DB_USERNAME=notaR +DB_PASSWORD=password + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +WWWUSER=1000 +WWWGROUP=1000 diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 679d244..5c6beb1 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,4 +1,4 @@ -name: Laravel-Docker-Cypress +name: Cypress on: pull_request: @@ -6,19 +6,23 @@ on: jobs: laravel-tests: - + permissions: + contents: write runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Set permissions + run: sudo chmod -R 777 storage bootstrap/cache - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.example', '.env');" + run: php -r "file_exists('.env') || copy('.env.cypress', '.env');" - name: Install run: ./deploy.sh - - name: Generate key - run: docker exec notar_app_1 php artisan key:generate - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - name: Create Database run: docker exec -t notar_app_1 php artisan migrate - - name: Execute tests - run: npx cypress run + - name: Create admin user + run: docker exec -t notar_app_1 php artisan migrate:admin novasenha + - name: Cypress run + uses: cypress-io/github-action@v6 + with: + config-file: cypress.config.js diff --git a/config/logging.php b/config/logging.php index 6aa77fe..dcaa2dc 100644 --- a/config/logging.php +++ b/config/logging.php @@ -99,6 +99,11 @@ 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], + + 'silent' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], ], ]; diff --git a/cypress.config.js b/cypress.config.js index 31f9c28..e307556 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -12,7 +12,7 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { return require('./tests/cypress/plugins/index.js')(on, config) }, - baseUrl: 'http://localhost:8000', + baseUrl: 'http://0.0.0.0:8000', specPattern: 'tests/cypress/integration/**/*.cy.{js,jsx,ts,tsx}', supportFile: 'tests/cypress/support/index.js', }, diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 6782e75..b90b124 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -21,14 +21,14 @@ class DatabaseSeeder extends Seeder public function run() { $ind_user = User::factory()->create(); - $alunos = User::factory()->count(30)->create(); + $alunos = User::factory()->count(10)->create(); $turma_vazia = Turma::factory()->create(); - $turmas = Turma::factory()->count(10) + $turmas = Turma::factory()->count(3) ->hasAttached($alunos) ->create(); - $exercicios = Exercicio::factory()->count(30) + $exercicios = Exercicio::factory()->count(5) ->has(Teste::factory()->count(3)) ->create();