From 6127958df14d47b377bf03ba5c4fbd03c76c4f81 Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Sun, 2 Aug 2026 13:14:02 +0200 Subject: [PATCH 1/7] ci: fix test execution in complete-workflow pipeline --- .github/workflows/complete-workflow.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/complete-workflow.yml b/.github/workflows/complete-workflow.yml index 6d2ab30..aef95ad 100644 --- a/.github/workflows/complete-workflow.yml +++ b/.github/workflows/complete-workflow.yml @@ -63,8 +63,8 @@ jobs: - name: Client Unit Tests (Components + Virtual DOM) run: npm run test:unit - client-server-integration-tests: - name: E2E & Integration (Chrome + Selenium) + client-server-tests: + name: Integration & E2E (Vitest, Chrome + Selenium) runs-on: ubuntu-latest needs: [server-tests, client-tests] @@ -86,22 +86,30 @@ jobs: cache: 'npm' cache-dependency-path: frontend/package-lock.json + - name: Install dependencies + run: npm ci + working-directory: frontend + - name: Set up Chrome for Selenium uses: browser-actions/setup-chrome@v1 with: chrome-version: stable - - name: Prepare and Launch Full Environment + - name: Client Integration Tests (Vitest) + E2E Client-Server Tests (Selenium) env: HEADLESS_TESTS: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" run: | cd frontend - npm run dev & + npm run dev > /dev/null 2>&1 < /dev/null & cd ../backend/pcmod - ./mvnw spring-boot:run & + ./mvnw spring-boot:run > /dev/null 2>&1 < /dev/null & npx wait-on http-get://localhost:5173 https-get://localhost:8443/ - ./mvnw test -Dgroups="client-server-integration,client-system" \ No newline at end of file + cd ../../frontend + npm run test:integration + + cd ../backend/pcmod + ./mvnw test -Dgroups="client-system" \ No newline at end of file From 99a696261913d1977a2f39cedfdb65ad6a3e45b3 Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Sun, 2 Aug 2026 13:48:25 +0200 Subject: [PATCH 2/7] ci: add default DB properties for CI tests --- backend/pcmod/src/main/resources/application.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/pcmod/src/main/resources/application.properties b/backend/pcmod/src/main/resources/application.properties index fd601b7..7633fb9 100644 --- a/backend/pcmod/src/main/resources/application.properties +++ b/backend/pcmod/src/main/resources/application.properties @@ -7,10 +7,10 @@ server.ssl.key-store-password=password server.ssl.key-password=secret server.ssl.key-alias=selfsigned -spring.datasource.url=${DB_URL} -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} -spring.jpa.hibernate.ddl-auto=${DB_MODE} +spring.datasource.url=${DB_URL:jdbc:mysql://localhost:3306/pcmod} +spring.datasource.username=${DB_USERNAME:root} +spring.datasource.password=${DB_PASSWORD:password} +spring.jpa.hibernate.ddl-auto=${DB_MODE:create-drop} spring.servlet.encoding.charset=UTF-8 spring.servlet.encoding.enabled=true From 7e5a865e9376b0aa9cd7af21db63283b9455957a Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Sun, 2 Aug 2026 13:14:02 +0200 Subject: [PATCH 3/7] ci: fix test execution in complete-workflow pipeline --- .github/workflows/complete-workflow.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/complete-workflow.yml b/.github/workflows/complete-workflow.yml index 6d2ab30..aef95ad 100644 --- a/.github/workflows/complete-workflow.yml +++ b/.github/workflows/complete-workflow.yml @@ -63,8 +63,8 @@ jobs: - name: Client Unit Tests (Components + Virtual DOM) run: npm run test:unit - client-server-integration-tests: - name: E2E & Integration (Chrome + Selenium) + client-server-tests: + name: Integration & E2E (Vitest, Chrome + Selenium) runs-on: ubuntu-latest needs: [server-tests, client-tests] @@ -86,22 +86,30 @@ jobs: cache: 'npm' cache-dependency-path: frontend/package-lock.json + - name: Install dependencies + run: npm ci + working-directory: frontend + - name: Set up Chrome for Selenium uses: browser-actions/setup-chrome@v1 with: chrome-version: stable - - name: Prepare and Launch Full Environment + - name: Client Integration Tests (Vitest) + E2E Client-Server Tests (Selenium) env: HEADLESS_TESTS: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" run: | cd frontend - npm run dev & + npm run dev > /dev/null 2>&1 < /dev/null & cd ../backend/pcmod - ./mvnw spring-boot:run & + ./mvnw spring-boot:run > /dev/null 2>&1 < /dev/null & npx wait-on http-get://localhost:5173 https-get://localhost:8443/ - ./mvnw test -Dgroups="client-server-integration,client-system" \ No newline at end of file + cd ../../frontend + npm run test:integration + + cd ../backend/pcmod + ./mvnw test -Dgroups="client-system" \ No newline at end of file From 7a203a4a100003fc5b0614ad0385e787c330b999 Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Sun, 2 Aug 2026 13:48:25 +0200 Subject: [PATCH 4/7] ci: add default DB properties for CI tests --- backend/pcmod/src/main/resources/application.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/pcmod/src/main/resources/application.properties b/backend/pcmod/src/main/resources/application.properties index fd601b7..7633fb9 100644 --- a/backend/pcmod/src/main/resources/application.properties +++ b/backend/pcmod/src/main/resources/application.properties @@ -7,10 +7,10 @@ server.ssl.key-store-password=password server.ssl.key-password=secret server.ssl.key-alias=selfsigned -spring.datasource.url=${DB_URL} -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} -spring.jpa.hibernate.ddl-auto=${DB_MODE} +spring.datasource.url=${DB_URL:jdbc:mysql://localhost:3306/pcmod} +spring.datasource.username=${DB_USERNAME:root} +spring.datasource.password=${DB_PASSWORD:password} +spring.jpa.hibernate.ddl-auto=${DB_MODE:create-drop} spring.servlet.encoding.charset=UTF-8 spring.servlet.encoding.enabled=true From aaa014997db8fd9a44f592c9b65e8b2a07c062fb Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Tue, 4 Aug 2026 13:27:01 +0200 Subject: [PATCH 5/7] ci: add Sonar analysis to complete workflow and fix analysis report --- .github/workflows/basic-workflow.yml | 2 +- .github/workflows/complete-workflow.yml | 54 ++++++++++++++++--------- frontend/package.json | 5 +-- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.github/workflows/basic-workflow.yml b/.github/workflows/basic-workflow.yml index 2d13fe9..92884f1 100644 --- a/.github/workflows/basic-workflow.yml +++ b/.github/workflows/basic-workflow.yml @@ -39,7 +39,7 @@ jobs: - name: Run Client Unit Tests with Coverage working-directory: frontend - run: npm run test:coverage + run: npm run test:unit-coverage # Backend steps diff --git a/.github/workflows/complete-workflow.yml b/.github/workflows/complete-workflow.yml index aef95ad..568b69a 100644 --- a/.github/workflows/complete-workflow.yml +++ b/.github/workflows/complete-workflow.yml @@ -30,17 +30,11 @@ jobs: distribution: 'temurin' cache: 'maven' - - name: Server Unit Tests (Services + Mocks) - run: ./mvnw test -Dgroups="server-unit" - - - name: Server Integration Tests (Services + Testcontainers) - run: ./mvnw test -Dgroups="server-integration" - - - name: Server System Tests (API REST with Rest Assured) - run: ./mvnw test -Dgroups="server-system" + - name: Server Tests (JUnit, Testcontainers, Rest Assured) + run: ./mvnw verify client-tests: - name: Frontend Unit Tests (Virtual DOM / Vitest) + name: Frontend Unit and Integration Tests (Virtual DOM / Vitest) runs-on: ubuntu-latest defaults: run: @@ -60,11 +54,28 @@ jobs: - name: Install dependencies run: npm ci - - name: Client Unit Tests (Components + Virtual DOM) - run: npm run test:unit + - name: Set up JDK 25 + uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: 'maven' + + - name: Run backend and Client Unit and Integration Tests (Virtual DOM / Vitest) + env: + HEADLESS_TESTS: "true" + NODE_TLS_REJECT_UNAUTHORIZED: "0" + run: | + cd ../backend/pcmod + ./mvnw spring-boot:run > /dev/null 2>&1 < /dev/null & + + npx wait-on https-get://localhost:8443/api/v1/components/ + + cd ../../frontend + npm run test:coverage client-server-tests: - name: Integration & E2E (Vitest, Chrome + Selenium) + name: E2E Client-Server Tests (Chrome + Selenium) runs-on: ubuntu-latest needs: [server-tests, client-tests] @@ -95,7 +106,7 @@ jobs: with: chrome-version: stable - - name: Client Integration Tests (Vitest) + E2E Client-Server Tests (Selenium) + - name: E2E Client-Server Tests (Selenium) env: HEADLESS_TESTS: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" @@ -106,10 +117,15 @@ jobs: cd ../backend/pcmod ./mvnw spring-boot:run > /dev/null 2>&1 < /dev/null & - npx wait-on http-get://localhost:5173 https-get://localhost:8443/ + npx wait-on http-get://localhost:5173 https-get://localhost:8443/api/v1/components/ - cd ../../frontend - npm run test:integration - - cd ../backend/pcmod - ./mvnw test -Dgroups="client-system" \ No newline at end of file + ./mvnw test -Dgroups="client-system" + + # SonarCloud Analysis + - name: SonarCloud Analysis + uses: sonarsource/sonarcloud-github-action@v3.1.0 + with: + projectBaseDir: . + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 5b841f1..4d096c4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,9 +8,8 @@ "start": "react-router-serve ./build/server/index.js", "typecheck": "react-router typegen && tsc", "test": "vitest", - "test:unit": "vitest run tests/unit", - "test:integration": "vitest run tests/integration", - "test:coverage": "vitest run tests/unit --coverage" + "test:unit-coverage": "vitest run tests/unit --coverage", + "test:coverage": "vitest run tests/ --coverage" }, "dependencies": { "@react-router/node": "8.0.0", From 9635ae628e924a177464c1ca1d44fed05ad18f08 Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Wed, 5 Aug 2026 12:42:06 +0200 Subject: [PATCH 6/7] ci: add Chrome options to WebDriver and MySQL service to GitHub Actions --- .github/workflows/complete-workflow.yml | 54 ++++++++++++++++++- .../pcmod/e2e/ui/ComponentsSystemTests.java | 11 +++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/.github/workflows/complete-workflow.yml b/.github/workflows/complete-workflow.yml index 568b69a..5281aef 100644 --- a/.github/workflows/complete-workflow.yml +++ b/.github/workflows/complete-workflow.yml @@ -19,6 +19,20 @@ jobs: run: working-directory: backend/pcmod + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: pcmod + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + steps: - name: Checkout code uses: actions/checkout@v4 @@ -31,7 +45,11 @@ jobs: cache: 'maven' - name: Server Tests (JUnit, Testcontainers, Rest Assured) - run: ./mvnw verify + env: + DB_URL: jdbc:mysql://localhost:3306/pcmod + DB_USERNAME: root + DB_PASSWORD: password + run: ./mvnw verify '-Dtest=!es.codeurjcstudents.pcmod.e2e.ui.**' client-tests: name: Frontend Unit and Integration Tests (Virtual DOM / Vitest) @@ -40,6 +58,20 @@ jobs: run: working-directory: frontend + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: pcmod + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + steps: - name: Checkout code uses: actions/checkout@v4 @@ -65,6 +97,9 @@ jobs: env: HEADLESS_TESTS: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" + DB_URL: jdbc:mysql://localhost:3306/pcmod + DB_USERNAME: root + DB_PASSWORD: password run: | cd ../backend/pcmod ./mvnw spring-boot:run > /dev/null 2>&1 < /dev/null & @@ -79,6 +114,20 @@ jobs: runs-on: ubuntu-latest needs: [server-tests, client-tests] + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: pcmod + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + steps: - name: Checkout code uses: actions/checkout@v4 @@ -110,6 +159,9 @@ jobs: env: HEADLESS_TESTS: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" + DB_URL: jdbc:mysql://localhost:3306/pcmod + DB_USERNAME: root + DB_PASSWORD: password run: | cd frontend npm run dev > /dev/null 2>&1 < /dev/null & diff --git a/backend/pcmod/src/test/java/es/codeurjcstudents/pcmod/e2e/ui/ComponentsSystemTests.java b/backend/pcmod/src/test/java/es/codeurjcstudents/pcmod/e2e/ui/ComponentsSystemTests.java index 58e1785..b59c0b9 100644 --- a/backend/pcmod/src/test/java/es/codeurjcstudents/pcmod/e2e/ui/ComponentsSystemTests.java +++ b/backend/pcmod/src/test/java/es/codeurjcstudents/pcmod/e2e/ui/ComponentsSystemTests.java @@ -12,6 +12,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @@ -24,7 +25,15 @@ public class ComponentsSystemTests { @BeforeEach public void setupTest() { - driver = new ChromeDriver(); + ChromeOptions options = new ChromeOptions(); + options.addArguments("--incognito"); + options.addArguments("--disable-notifications"); + options.addArguments("--disable-features=PasswordLeakDetection"); + options.addArguments("--headless"); + options.addArguments("--no-sandbox"); + options.addArguments("--disable-dev-shm-usage"); + + driver = new ChromeDriver(options); wait = new WebDriverWait(driver, Duration.ofSeconds(10)); } From b9492c1da011f857743e5b1b7b0f1e4c152c9830 Mon Sep 17 00:00:00 2001 From: jaimeeg5 Date: Wed, 5 Aug 2026 13:15:48 +0200 Subject: [PATCH 7/7] ci: fix 0% coverage report --- .github/workflows/complete-workflow.yml | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/complete-workflow.yml b/.github/workflows/complete-workflow.yml index 5281aef..a68deec 100644 --- a/.github/workflows/complete-workflow.yml +++ b/.github/workflows/complete-workflow.yml @@ -36,6 +36,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 25 uses: actions/setup-java@v4 @@ -51,6 +53,12 @@ jobs: DB_PASSWORD: password run: ./mvnw verify '-Dtest=!es.codeurjcstudents.pcmod.e2e.ui.**' + - name: Save JaCoCo Report + uses: actions/upload-artifact@v4 + with: + name: jacoco-report + path: backend/pcmod/target/site/jacoco/jacoco.xml + client-tests: name: Frontend Unit and Integration Tests (Virtual DOM / Vitest) runs-on: ubuntu-latest @@ -75,6 +83,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Node.js uses: actions/setup-node@v4 @@ -109,6 +119,12 @@ jobs: cd ../../frontend npm run test:coverage + - name: Save LCOV Report + uses: actions/upload-artifact@v4 + with: + name: lcov-report + path: frontend/coverage/lcov.info + client-server-tests: name: E2E Client-Server Tests (Chrome + Selenium) runs-on: ubuntu-latest @@ -131,6 +147,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 25 uses: actions/setup-java@v4 @@ -174,6 +192,18 @@ jobs: ./mvnw test -Dgroups="client-system" # SonarCloud Analysis + - name: Download JaCoCo Report + uses: actions/download-artifact@v4 + with: + name: jacoco-report + path: backend/pcmod/target/site/jacoco + + - name: Download LCOV Report + uses: actions/download-artifact@v4 + with: + name: lcov-report + path: frontend/coverage + - name: SonarCloud Analysis uses: sonarsource/sonarcloud-github-action@v3.1.0 with: