Skip to content
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

Update cypress.yml #117

Merged
merged 18 commits into from
May 28, 2024
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
27 changes: 27 additions & 0 deletions .env.cypress
Original file line number Diff line number Diff line change
@@ -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
22 changes: 13 additions & 9 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
name: Laravel-Docker-Cypress
name: Cypress

on:
pull_request:
branches: [ "main" ]

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
5 changes: 5 additions & 0 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],

'silent' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
],

];
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
6 changes: 3 additions & 3 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down