From 2b167c32d8ee9f347d8e6798ec8d64cad622d895 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 09:50:44 -0300 Subject: [PATCH 1/6] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20do=20Logintest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dusk.yml | 7 +++++++ .gitignore | 1 + tests/Browser/IndexTest.php | 2 +- tests/Browser/LoginTest.php | 29 +++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tests/Browser/LoginTest.php diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index 53ecb1f..e1b8482 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -8,6 +8,13 @@ jobs: dusk: runs-on: ubuntu-latest + senhaunica-faker: + image: uspdev/senhaunica-faker + env: + APP_URL: http://127.0.0.1:3141 + ports: + - 3141:3141 + env: SERVICE_NAME: bibfiles diff --git a/.gitignore b/.gitignore index 88fad7c..7d4b5a4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ Homestead.yaml npm-debug.log yarn-error.log /public/vendor +.phpunit.cache/test-results diff --git a/tests/Browser/IndexTest.php b/tests/Browser/IndexTest.php index e62fdf9..3e13eb1 100644 --- a/tests/Browser/IndexTest.php +++ b/tests/Browser/IndexTest.php @@ -11,7 +11,7 @@ class IndexTest extends DuskTestCase /** * A basic browser test example. */ - public function test_basic_example(): void + public function test_index(): void { $this->browse(function (Browser $browser) { $browser->visit('/') diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php new file mode 100644 index 0000000..cf4a2cc --- /dev/null +++ b/tests/Browser/LoginTest.php @@ -0,0 +1,29 @@ +browse(function (Browser $browser) { + $browser->visit('/') + ->assertSee('Não autenticado') + ->clickLink('Entrar') + ->waitFor('#loginUsuario', 20) + ->type('#loginUsuario', '1111') + ->press('Login') + ->pause('3000') + ->assertSee('Consulta de Arquivos') + ->click('.login_logout_link') + ->assertSee('Não autenticado'); + }); + } +} From 192014f10cae926eaf5a22c4ef0be5a4f5cf3c1f Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 09:53:43 -0300 Subject: [PATCH 2/6] Tentativa 1 gitDusk --- .github/workflows/dusk.yml | 99 +++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index e1b8482..1e7d189 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -8,65 +8,84 @@ jobs: dusk: runs-on: ubuntu-latest - senhaunica-faker: - image: uspdev/senhaunica-faker - env: - APP_URL: http://127.0.0.1:3141 - ports: - - 3141:3141 - - env: - SERVICE_NAME: bibfiles + services: + mariadb: + image: mariadb:10.11 + env: + MARIADB_DATABASE: db + MARIADB_ROOT_PASSWORD: admin + MARIADB_USER: admin + MARIADB_PASSWORD: admin + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping --silent" + --health-interval=5s + --health-timeout=5s + --health-retries=10 + senhaunica-faker: + image: uspdev/senhaunica-faker + env: + APP_URL: http://127.0.0.1:3141 + ports: + - 3141:3141 steps: - name: Checkout uses: actions/checkout@v4 - - name: Create .env + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + extensions: mbstring, dom, pdo, mysql + coverage: none + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Copy env from example run: cp .env.example .env - - name: Add auth.local to hosts to senhaunica-faker works properly + - name: Remove Dusk visual variables run: | - echo "127.0.0.1 auth.local" | sudo tee -a /etc/hosts + sed -i '/DUSK_START_MAXIMIZED/d' .env || true + sed -i '/DUSK_HEADLESS_DISABLED/d' .env || true - - name: Set UID/GID + - name: Configure .env file for testing run: | - echo "UID=$(id -u)" >> $GITHUB_ENV - echo "GID=$(id -g)" >> $GITHUB_ENV + echo "APP_URL=http://127.0.0.1:47800" >> .env + echo "DUSK_DRIVER_URL=http://localhost:9515" >> .env + echo "DB_CONNECTION=mysql" >> .env + echo "DB_HOST=127.0.0.1" >> .env + echo "DB_PORT=3306" >> .env + echo "DB_DATABASE=db" >> .env + echo "DB_USERNAME=admin" >> .env + echo "DB_PASSWORD=admin" >> .env + echo "SENHAUNICA_DEV=http://127.0.0.1:3141/wsusuario/oauth" >> .env - - name: Build and start containers - run: docker compose up -d --build + - name: Generate APP_KEY + run: php artisan key:generate - name: Wait for MariaDB run: | - for i in {1..40}; do - if docker compose exec -T mariadb mariadb -u${{ env.SERVICE_NAME }} -p${{ env.SERVICE_NAME }} -e "SELECT 1;" &> /dev/null; then - echo "MariaDB is ready" - exit 0 - fi - echo "Waiting for MariaDB..." + for i in {1..30}; do + mysqladmin ping -h127.0.0.1 -P3306 --silent && break sleep 2 done - - name: Install Composer dependencies - run: docker compose exec -T ${{ env.SERVICE_NAME }} composer install --no-interaction --prefer-dist - - - name: Generate APP_KEY - run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan key:generate - - name: Run migrations - run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan migrate --force + run: php artisan migrate --force - - name: Install ChromeDriver - run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan dusk:chrome-driver --detect + - name: Install Chrome + uses: browser-actions/setup-chrome@v1 - - name: Run Dusk - run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan dusk --without-tty + - name: Install ChromeDriver + run: php artisan dusk:chrome-driver --detect - - name: Show logs on failure - if: failure() - run: docker compose logs + - name: Start Laravel server + run: php artisan serve --port=47800 & - - name: Stop containers - if: always() - run: docker compose down -v + - name: Run Dusk + run: php artisan dusk --without-tty \ No newline at end of file From 6617f31d2a834864f590c0ec904077cc574ba157 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 10:04:51 -0300 Subject: [PATCH 3/6] Tentativa 2 teste no github --- .github/workflows/dusk.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index 1e7d189..38ca1a7 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -50,6 +50,7 @@ jobs: - name: Remove Dusk visual variables run: | + sed -i -E '/^(APP_URL|DUSK_DRIVER_URL|DUSK_START_MAXIMIZED|DUSK_HEADLESS_DISABLED|SENHAUNICA_DEV)=/d' .env sed -i '/DUSK_START_MAXIMIZED/d' .env || true sed -i '/DUSK_HEADLESS_DISABLED/d' .env || true @@ -85,7 +86,12 @@ jobs: run: php artisan dusk:chrome-driver --detect - name: Start Laravel server - run: php artisan serve --port=47800 & + run: | + php artisan serve --host=127.0.0.1 --port=47800 > /tmp/laravel.log 2>&1 & + for i in {1..30}; do + curl --fail --silent http://127.0.0.1:47800/ > /dev/null && break + sleep 1 + done - name: Run Dusk run: php artisan dusk --without-tty \ No newline at end of file From 5cce9b950179597aecbdf278be04e988ee957bf6 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 10:10:24 -0300 Subject: [PATCH 4/6] Tentativa 3 gitDusk --- .github/workflows/dusk.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index 38ca1a7..3688a54 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -85,13 +85,26 @@ jobs: - name: Install ChromeDriver run: php artisan dusk:chrome-driver --detect - - name: Start Laravel server + - name: Start Laravel server and run Dusk run: | php artisan serve --host=127.0.0.1 --port=47800 > /tmp/laravel.log 2>&1 & + server_pid=$! + trap 'kill "$server_pid"' EXIT + for i in {1..30}; do - curl --fail --silent http://127.0.0.1:47800/ > /dev/null && break + if curl --fail --silent http://127.0.0.1:47800/ > /dev/null; then + break + fi + if ! kill -0 "$server_pid" 2>/dev/null; then + cat /tmp/laravel.log + exit 1 + fi sleep 1 done - - name: Run Dusk - run: php artisan dusk --without-tty \ No newline at end of file + if ! curl --fail --silent http://127.0.0.1:47800/ > /dev/null; then + cat /tmp/laravel.log + exit 1 + fi + + php artisan dusk --without-tty \ No newline at end of file From 5c8a6c506e649f37185acb19415e3f45fe8c43af Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 10:15:43 -0300 Subject: [PATCH 5/6] Tentativa 4 Gitdusk --- .github/workflows/dusk.yml | 109 +++++++++++-------------------------- 1 file changed, 32 insertions(+), 77 deletions(-) diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index 3688a54..3eb9519 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -8,103 +8,58 @@ jobs: dusk: runs-on: ubuntu-latest - services: - mariadb: - image: mariadb:10.11 - env: - MARIADB_DATABASE: db - MARIADB_ROOT_PASSWORD: admin - MARIADB_USER: admin - MARIADB_PASSWORD: admin - MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes - ports: - - 3306:3306 - options: >- - --health-cmd="mysqladmin ping --silent" - --health-interval=5s - --health-timeout=5s - --health-retries=10 - senhaunica-faker: - image: uspdev/senhaunica-faker - env: - APP_URL: http://127.0.0.1:3141 - ports: - - 3141:3141 + env: + SERVICE_NAME: copaco steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.4 - extensions: mbstring, dom, pdo, mysql - coverage: none - - - name: Install Composer dependencies - run: composer install --no-progress --prefer-dist --optimize-autoloader - - - name: Copy env from example + - name: Create .env run: cp .env.example .env - - name: Remove Dusk visual variables + - name: Add auth.local to hosts to senhaunica-faker works properly run: | - sed -i -E '/^(APP_URL|DUSK_DRIVER_URL|DUSK_START_MAXIMIZED|DUSK_HEADLESS_DISABLED|SENHAUNICA_DEV)=/d' .env - sed -i '/DUSK_START_MAXIMIZED/d' .env || true - sed -i '/DUSK_HEADLESS_DISABLED/d' .env || true + echo "127.0.0.1 auth.local" | sudo tee -a /etc/hosts - - name: Configure .env file for testing + - name: Set UID/GID run: | - echo "APP_URL=http://127.0.0.1:47800" >> .env - echo "DUSK_DRIVER_URL=http://localhost:9515" >> .env - echo "DB_CONNECTION=mysql" >> .env - echo "DB_HOST=127.0.0.1" >> .env - echo "DB_PORT=3306" >> .env - echo "DB_DATABASE=db" >> .env - echo "DB_USERNAME=admin" >> .env - echo "DB_PASSWORD=admin" >> .env - echo "SENHAUNICA_DEV=http://127.0.0.1:3141/wsusuario/oauth" >> .env + echo "UID=$(id -u)" >> $GITHUB_ENV + echo "GID=$(id -g)" >> $GITHUB_ENV - - name: Generate APP_KEY - run: php artisan key:generate + - name: Build and start containers + run: docker compose up -d --build - name: Wait for MariaDB run: | - for i in {1..30}; do - mysqladmin ping -h127.0.0.1 -P3306 --silent && break + for i in {1..40}; do + if docker compose exec -T mariadb mariadb -u${{ env.SERVICE_NAME }} -p${{ env.SERVICE_NAME }} -e "SELECT 1;" &> /dev/null; then + echo "MariaDB is ready" + exit 0 + fi + echo "Waiting for MariaDB..." sleep 2 done - - name: Run migrations - run: php artisan migrate --force + - name: Install Composer dependencies + run: docker compose exec -T ${{ env.SERVICE_NAME }} composer install --no-interaction --prefer-dist - - name: Install Chrome - uses: browser-actions/setup-chrome@v1 + - name: Generate APP_KEY + run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan key:generate - - name: Install ChromeDriver - run: php artisan dusk:chrome-driver --detect + - name: Run migrations + run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan migrate --force - - name: Start Laravel server and run Dusk - run: | - php artisan serve --host=127.0.0.1 --port=47800 > /tmp/laravel.log 2>&1 & - server_pid=$! - trap 'kill "$server_pid"' EXIT + - name: Install ChromeDriver + run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan dusk:chrome-driver --detect - for i in {1..30}; do - if curl --fail --silent http://127.0.0.1:47800/ > /dev/null; then - break - fi - if ! kill -0 "$server_pid" 2>/dev/null; then - cat /tmp/laravel.log - exit 1 - fi - sleep 1 - done + - name: Run Dusk + run: docker compose exec -T ${{ env.SERVICE_NAME }} php artisan dusk --without-tty - if ! curl --fail --silent http://127.0.0.1:47800/ > /dev/null; then - cat /tmp/laravel.log - exit 1 - fi + - name: Show logs on failure + if: failure() + run: docker compose logs - php artisan dusk --without-tty \ No newline at end of file + - name: Stop containers + if: always() + run: docker compose down -v From aaabb3f28a2ae5d7482e181867a40716024bf579 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 16 Sep 2026 10:18:54 -0300 Subject: [PATCH 6/6] =?UTF-8?q?corre=C3=A7=C3=A3o=20menor=20tentativa=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dusk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml index 3eb9519..53ecb1f 100644 --- a/.github/workflows/dusk.yml +++ b/.github/workflows/dusk.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest env: - SERVICE_NAME: copaco + SERVICE_NAME: bibfiles steps: - name: Checkout