From 0a9f1026d9056512dd1f8d9298f1d925fb721772 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:26:40 +0530 Subject: [PATCH 01/30] Create cypress.yml --- .github/workflows/cypress.yml | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/cypress.yml diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml new file mode 100644 index 0000000..46d192e --- /dev/null +++ b/.github/workflows/cypress.yml @@ -0,0 +1,83 @@ +name: Cypress Tests + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - uses: actions/checkout@v4 + + # Step 2: Set up Node.js in the root directory + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + # Step 3: Install dependencies (with `cd` into the tests directory) + - name: Install dependencies + working-directory: ./tests # Switch to the 'tests' directory + run: | + npm ci # Install dependencies from 'tests/package-lock.json' + npx cypress install # Install Cypress if not already installed + # Step 4: Set up Allure commandline + - name: Set up Allure commandline + working-directory: ./tests # Switch to the 'tests' directory + run: npm install -g allure-commandline + + # Step 5: Start the API server (before running Cypress tests) + - name: Start API Server + working-directory: ./tests + run: | + nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background + sleep 30 # Wait for 30 seconds to allow the server to start + # Step 6: Run Cypress tests + - name: Run Cypress tests + working-directory: ./tests # Switch to the 'tests' directory + run: | + npx cypress run # Run the Cypress tests + # Step 7: Upload test results + - name: Upload test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: cypress-test-results + path: | + ./tests/allure-results/ + ./tests/results/*.json + generate-report: + needs: tests + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - uses: actions/checkout@v4 + + # Step 2: Download test results + - name: Download test results + uses: actions/download-artifact@v3 + with: + name: cypress-test-results + path: results + + # Step 3: Generate combined Allure report + - name: Generate Allure Report + run: | + allure generate results/cypress-test-results -o results/allure-report --clean + # Step 4: Upload combined report + - name: Upload Allure Report + uses: actions/upload-artifact@v3 + with: + name: allure-report + path: results/allure-report + retention-days: 30 From b39558002dfd6dc6d4bb1457040eb93c4045f948 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:33:50 +0530 Subject: [PATCH 02/30] Update cypress.yml --- .github/workflows/cypress.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 46d192e..492bd5c 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -30,22 +30,25 @@ jobs: run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed + # Step 4: Set up Allure commandline - name: Set up Allure commandline working-directory: ./tests # Switch to the 'tests' directory run: npm install -g allure-commandline - # Step 5: Start the API server (before running Cypress tests) + # Step 5: Start the API server (on the correct host and port) - name: Start API Server working-directory: ./tests run: | - nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background + nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 & # Start the API server on all interfaces sleep 30 # Wait for 30 seconds to allow the server to start + # Step 6: Run Cypress tests - name: Run Cypress tests working-directory: ./tests # Switch to the 'tests' directory run: | npx cypress run # Run the Cypress tests + # Step 7: Upload test results - name: Upload test results if: always() @@ -55,6 +58,7 @@ jobs: path: | ./tests/allure-results/ ./tests/results/*.json + generate-report: needs: tests runs-on: ubuntu-latest @@ -74,6 +78,7 @@ jobs: - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean + # Step 4: Upload combined report - name: Upload Allure Report uses: actions/upload-artifact@v3 From 111b51b373a5f4d14b98c9d47f099cb6f461b3fb Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:40:53 +0530 Subject: [PATCH 03/30] Update cypress.yml --- .github/workflows/cypress.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 492bd5c..668781e 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,4 +1,4 @@ -name: Cypress Tests +name: Run Cypress Tests on: push: @@ -14,11 +14,20 @@ jobs: tests: runs-on: ubuntu-latest + services: + api-server: + image: openjdk:11 + options: --network host + ports: + - 7081:7081 # Expose port 7081 from the container + env: + SERVER_ADDRESS: "0.0.0.0" # Make sure the server listens on all interfaces + steps: # Step 1: Check out the repository - uses: actions/checkout@v4 - # Step 2: Set up Node.js in the root directory + # Step 2: Set up Node.js - name: Set up Node.js uses: actions/setup-node@v4 with: @@ -31,25 +40,20 @@ jobs: npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Set up Allure commandline - - name: Set up Allure commandline - working-directory: ./tests # Switch to the 'tests' directory - run: npm install -g allure-commandline - - # Step 5: Start the API server (on the correct host and port) + # Step 4: Start the API server - name: Start API Server working-directory: ./tests run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 & # Start the API server on all interfaces sleep 30 # Wait for 30 seconds to allow the server to start - # Step 6: Run Cypress tests + # Step 5: Run Cypress tests - name: Run Cypress tests - working-directory: ./tests # Switch to the 'tests' directory + working-directory: ./tests run: | npx cypress run # Run the Cypress tests - # Step 7: Upload test results + # Step 6: Upload test results - name: Upload test results if: always() uses: actions/upload-artifact@v3 @@ -74,12 +78,12 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate combined Allure report + # Step 3: Generate Allure report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload combined report + # Step 4: Upload Allure report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 719034b993233950ca1e8fa7fa11cc39cba1a84e Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:43:21 +0530 Subject: [PATCH 04/30] Update cypress.yml --- .github/workflows/cypress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 668781e..5bbe971 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -17,7 +17,7 @@ jobs: services: api-server: image: openjdk:11 - options: --network host + options: --network github_network_${{ github.run_id }} # Use a user-defined network ports: - 7081:7081 # Expose port 7081 from the container env: From 484d71a249852592d4294e62ac0b39895e67616c Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:08:14 +0530 Subject: [PATCH 05/30] Update cypress.yml --- .github/workflows/cypress.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 5bbe971..d705c5f 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -21,7 +21,7 @@ jobs: ports: - 7081:7081 # Expose port 7081 from the container env: - SERVER_ADDRESS: "0.0.0.0" # Make sure the server listens on all interfaces + SERVER_ADDRESS: "0.0.0.0" # Ensure the server listens on all interfaces steps: # Step 1: Check out the repository @@ -35,21 +35,18 @@ jobs: # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies - working-directory: ./tests # Switch to the 'tests' directory run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed # Step 4: Start the API server - name: Start API Server - working-directory: ./tests run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 & # Start the API server on all interfaces sleep 30 # Wait for 30 seconds to allow the server to start # Step 5: Run Cypress tests - name: Run Cypress tests - working-directory: ./tests run: | npx cypress run # Run the Cypress tests @@ -60,8 +57,8 @@ jobs: with: name: cypress-test-results path: | - ./tests/allure-results/ - ./tests/results/*.json + ./allure-results/ + ./results/*.json generate-report: needs: tests From 62e0d984311b6802002f55e7a6fcee61bcef4a53 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:10:05 +0530 Subject: [PATCH 06/30] Update cypress.yml --- .github/workflows/cypress.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index d705c5f..9e7ab59 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -14,15 +14,6 @@ jobs: tests: runs-on: ubuntu-latest - services: - api-server: - image: openjdk:11 - options: --network github_network_${{ github.run_id }} # Use a user-defined network - ports: - - 7081:7081 # Expose port 7081 from the container - env: - SERVER_ADDRESS: "0.0.0.0" # Ensure the server listens on all interfaces - steps: # Step 1: Check out the repository - uses: actions/checkout@v4 @@ -33,24 +24,30 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies (with `cd` into the tests directory) + # Step 3: Install dependencies - name: Install dependencies run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Start the API server + # Step 4: Set up a Docker network for API server + - name: Create Docker network + run: | + docker network create github_network_${{ github.run_id }} # Create a user-defined network + + # Step 5: Start the API server in a Docker container - name: Start API Server run: | - nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 & # Start the API server on all interfaces + docker run -d --name api-server --network github_network_${{ github.run_id }} -p 7081:7081 \ + -e "SERVER_ADDRESS=0.0.0.0" openjdk:11 java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 sleep 30 # Wait for 30 seconds to allow the server to start - # Step 5: Run Cypress tests + # Step 6: Run Cypress tests - name: Run Cypress tests run: | npx cypress run # Run the Cypress tests - # Step 6: Upload test results + # Step 7: Upload test results - name: Upload test results if: always() uses: actions/upload-artifact@v3 From 0d11fac1dca7d49c448dd1b41a72982f45ed004a Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:13:33 +0530 Subject: [PATCH 07/30] Update cypress.yml --- .github/workflows/cypress.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 9e7ab59..69af356 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -14,6 +14,15 @@ jobs: tests: runs-on: ubuntu-latest + services: + api-server: + image: openjdk:11 + options: --network github_network_${{ github.run_id }} # Use a user-defined network + ports: + - 7081:7081 # Expose port 7081 from the container + env: + SERVER_ADDRESS: "0.0.0.0" # Ensure the server listens on all interfaces + steps: # Step 1: Check out the repository - uses: actions/checkout@v4 @@ -30,12 +39,12 @@ jobs: npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Set up a Docker network for API server + # Step 4: Create Docker network manually - name: Create Docker network run: | docker network create github_network_${{ github.run_id }} # Create a user-defined network - # Step 5: Start the API server in a Docker container + # Step 5: Start the API server - name: Start API Server run: | docker run -d --name api-server --network github_network_${{ github.run_id }} -p 7081:7081 \ From 00cdea858ccfb2964514ea45c6ee1643c79f1b85 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:19:18 +0530 Subject: [PATCH 08/30] Update cypress.yml --- .github/workflows/cypress.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 69af356..ec4f55c 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -17,7 +17,7 @@ jobs: services: api-server: image: openjdk:11 - options: --network github_network_${{ github.run_id }} # Use a user-defined network + options: --network github_network_${{ github.run_id }} # User-defined network ports: - 7081:7081 # Expose port 7081 from the container env: @@ -25,7 +25,8 @@ jobs: steps: # Step 1: Check out the repository - - uses: actions/checkout@v4 + - name: Checkout Repository + uses: actions/checkout@v4 # Step 2: Set up Node.js - name: Set up Node.js @@ -34,13 +35,13 @@ jobs: node-version: '20' # Step 3: Install dependencies - - name: Install dependencies + - name: Install Dependencies run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Create Docker network manually - - name: Create Docker network + # Step 4: Create Docker network + - name: Create Docker Network run: | docker network create github_network_${{ github.run_id }} # Create a user-defined network @@ -49,16 +50,16 @@ jobs: run: | docker run -d --name api-server --network github_network_${{ github.run_id }} -p 7081:7081 \ -e "SERVER_ADDRESS=0.0.0.0" openjdk:11 java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 - sleep 30 # Wait for 30 seconds to allow the server to start + sleep 30 # Wait for 30 seconds to ensure the server starts # Step 6: Run Cypress tests - - name: Run Cypress tests + - name: Run Cypress Tests run: | npx cypress run # Run the Cypress tests # Step 7: Upload test results - - name: Upload test results - if: always() + - name: Upload Test Results + if: always() # Ensure the results are uploaded even if tests fail uses: actions/upload-artifact@v3 with: name: cypress-test-results @@ -67,26 +68,32 @@ jobs: ./results/*.json generate-report: - needs: tests + needs: tests # This job runs after the 'tests' job runs-on: ubuntu-latest steps: # Step 1: Check out the repository - - uses: actions/checkout@v4 + - name: Checkout Repository + uses: actions/checkout@v4 # Step 2: Download test results - - name: Download test results + - name: Download Test Results uses: actions/download-artifact@v3 with: name: cypress-test-results path: results - # Step 3: Generate Allure report + # Step 3: Install Allure Command Line Tool + - name: Install Allure Command Line Tool + run: | + npm install -g allure-commandline --save-dev + + # Step 4: Generate Allure Report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload Allure report + # Step 5: Upload Allure Report as an artifact - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 25127a442351dc5c2dfb38894f61e3ea05dd43b0 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:20:31 +0530 Subject: [PATCH 09/30] Update cypress.yml --- .github/workflows/cypress.yml | 37 ++++++++++++++--------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index ec4f55c..ec8ae62 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -17,7 +17,7 @@ jobs: services: api-server: image: openjdk:11 - options: --network github_network_${{ github.run_id }} # User-defined network + options: --network github_network_${{ github.run_id }} # Use a user-defined network ports: - 7081:7081 # Expose port 7081 from the container env: @@ -25,8 +25,7 @@ jobs: steps: # Step 1: Check out the repository - - name: Checkout Repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 # Step 2: Set up Node.js - name: Set up Node.js @@ -35,31 +34,31 @@ jobs: node-version: '20' # Step 3: Install dependencies - - name: Install Dependencies + - name: Install dependencies run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Create Docker network - - name: Create Docker Network + # Step 4: Create Docker network manually + - name: Create Docker network run: | docker network create github_network_${{ github.run_id }} # Create a user-defined network - # Step 5: Start the API server + # Step 5: Start the API Server - name: Start API Server run: | docker run -d --name api-server --network github_network_${{ github.run_id }} -p 7081:7081 \ -e "SERVER_ADDRESS=0.0.0.0" openjdk:11 java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 - sleep 30 # Wait for 30 seconds to ensure the server starts + sleep 30 # Wait for 30 seconds to allow the server to start # Step 6: Run Cypress tests - - name: Run Cypress Tests + - name: Run Cypress tests run: | npx cypress run # Run the Cypress tests # Step 7: Upload test results - - name: Upload Test Results - if: always() # Ensure the results are uploaded even if tests fail + - name: Upload test results + if: always() uses: actions/upload-artifact@v3 with: name: cypress-test-results @@ -68,32 +67,26 @@ jobs: ./results/*.json generate-report: - needs: tests # This job runs after the 'tests' job + needs: tests runs-on: ubuntu-latest steps: # Step 1: Check out the repository - - name: Checkout Repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 # Step 2: Download test results - - name: Download Test Results + - name: Download test results uses: actions/download-artifact@v3 with: name: cypress-test-results path: results - # Step 3: Install Allure Command Line Tool - - name: Install Allure Command Line Tool - run: | - npm install -g allure-commandline --save-dev - - # Step 4: Generate Allure Report + # Step 3: Generate Allure Report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 5: Upload Allure Report as an artifact + # Step 4: Upload Allure report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 24ad64ebadbb6d0a2eee7befd1183b581ba426d0 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:26:56 +0530 Subject: [PATCH 10/30] Update cypress.yml --- .github/workflows/cypress.yml | 46 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index ec8ae62..7187e67 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,4 +1,4 @@ -name: Run Cypress Tests +name: Cypress Tests on: push: @@ -14,45 +14,43 @@ jobs: tests: runs-on: ubuntu-latest - services: - api-server: - image: openjdk:11 - options: --network github_network_${{ github.run_id }} # Use a user-defined network - ports: - - 7081:7081 # Expose port 7081 from the container - env: - SERVER_ADDRESS: "0.0.0.0" # Ensure the server listens on all interfaces - steps: # Step 1: Check out the repository - uses: actions/checkout@v4 - # Step 2: Set up Node.js + # Step 2: Set up Node.js in the root directory - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' - # Step 3: Install dependencies + # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies + working-directory: ./tests # Switch to the 'tests' directory run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Create Docker network manually - - name: Create Docker network - run: | - docker network create github_network_${{ github.run_id }} # Create a user-defined network + # Step 4: Set up Allure commandline + - name: Set up Allure commandline + working-directory: ./tests # Switch to the 'tests' directory + run: npm install -g allure-commandline - # Step 5: Start the API Server + # Step 5: Start the API server (before running Cypress tests) - name: Start API Server + working-directory: ./tests run: | - docker run -d --name api-server --network github_network_${{ github.run_id }} -p 7081:7081 \ - -e "SERVER_ADDRESS=0.0.0.0" openjdk:11 java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar --server.address=0.0.0.0 --server.port=7081 - sleep 30 # Wait for 30 seconds to allow the server to start + nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background + # Wait for the API server to become available + while ! curl --silent --fail http://localhost:7081/; do + echo "Waiting for API server to be available..." + sleep 5 + done + echo "API server is up and running!" # Step 6: Run Cypress tests - name: Run Cypress tests + working-directory: ./tests # Switch to the 'tests' directory run: | npx cypress run # Run the Cypress tests @@ -63,8 +61,8 @@ jobs: with: name: cypress-test-results path: | - ./allure-results/ - ./results/*.json + ./tests/allure-results/ + ./tests/results/*.json generate-report: needs: tests @@ -81,12 +79,12 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate Allure Report + # Step 3: Generate combined Allure report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload Allure report + # Step 4: Upload combined report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From dec33e54042bc9d58694a22eac634a0a4d3ab8c7 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:28:09 +0530 Subject: [PATCH 11/30] Update cypress.yml --- .github/workflows/cypress.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 7187e67..bcb1b0d 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -26,19 +26,16 @@ jobs: # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies - working-directory: ./tests # Switch to the 'tests' directory run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed # Step 4: Set up Allure commandline - name: Set up Allure commandline - working-directory: ./tests # Switch to the 'tests' directory run: npm install -g allure-commandline # Step 5: Start the API server (before running Cypress tests) - name: Start API Server - working-directory: ./tests run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background # Wait for the API server to become available @@ -50,7 +47,6 @@ jobs: # Step 6: Run Cypress tests - name: Run Cypress tests - working-directory: ./tests # Switch to the 'tests' directory run: | npx cypress run # Run the Cypress tests @@ -61,8 +57,8 @@ jobs: with: name: cypress-test-results path: | - ./tests/allure-results/ - ./tests/results/*.json + ./allure-results/ + ./results/*.json generate-report: needs: tests From 6dd4949b98ee61eb498cc7b953a36e7d5369a258 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:48:58 +0530 Subject: [PATCH 12/30] Update cypress.yml --- .github/workflows/cypress.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index bcb1b0d..0f2d4df 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -26,10 +26,10 @@ jobs: # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies + working-directory: ./tests # Switch to the 'tests' directory run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Set up Allure commandline - name: Set up Allure commandline run: npm install -g allure-commandline @@ -38,18 +38,11 @@ jobs: - name: Start API Server run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background - # Wait for the API server to become available - while ! curl --silent --fail http://localhost:7081/; do - echo "Waiting for API server to be available..." - sleep 5 - done - echo "API server is up and running!" - + sleep 30 # Wait for 30 seconds to allow the server to start # Step 6: Run Cypress tests - name: Run Cypress tests run: | npx cypress run # Run the Cypress tests - # Step 7: Upload test results - name: Upload test results if: always() @@ -59,7 +52,6 @@ jobs: path: | ./allure-results/ ./results/*.json - generate-report: needs: tests runs-on: ubuntu-latest @@ -79,7 +71,6 @@ jobs: - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload combined report - name: Upload Allure Report uses: actions/upload-artifact@v3 From 12d2a6d32a00f76832197df39cd11f237d937ec6 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:50:11 +0530 Subject: [PATCH 13/30] Update cypress.yml --- .github/workflows/cypress.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 0f2d4df..2d8a9f3 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -26,7 +26,6 @@ jobs: # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies - working-directory: ./tests # Switch to the 'tests' directory run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed From 5ca7ceb3a0e7ce75ddcbfc69e3400966e7f4b7cd Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 00:01:00 +0530 Subject: [PATCH 14/30] Update cypress.yml --- .github/workflows/cypress.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 2d8a9f3..bcba2a6 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -24,24 +24,27 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies (with `cd` into the tests directory) + # Step 3: Install dependencies - name: Install dependencies run: | - npm ci # Install dependencies from 'tests/package-lock.json' + npm ci # Install dependencies from 'package-lock.json' npx cypress install # Install Cypress if not already installed - # Step 4: Set up Allure commandline + + # Step 4: Set up Allure commandline for reporting - name: Set up Allure commandline run: npm install -g allure-commandline - # Step 5: Start the API server (before running Cypress tests) + # Step 5: Start API Server - name: Start API Server run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background sleep 30 # Wait for 30 seconds to allow the server to start + # Step 6: Run Cypress tests - name: Run Cypress tests run: | - npx cypress run # Run the Cypress tests + npx cypress run # Run Cypress tests + # Step 7: Upload test results - name: Upload test results if: always() @@ -51,6 +54,7 @@ jobs: path: | ./allure-results/ ./results/*.json + generate-report: needs: tests runs-on: ubuntu-latest @@ -66,11 +70,12 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate combined Allure report + # Step 3: Generate Allure report from test results - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload combined report + + # Step 4: Upload the Allure report as an artifact - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 64470bdee268fda14a44dc0fa1d49157ca651bd6 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 00:09:23 +0530 Subject: [PATCH 15/30] Update cypress.yml --- .github/workflows/cypress.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index bcba2a6..70a5735 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -24,27 +24,24 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies + # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies run: | - npm ci # Install dependencies from 'package-lock.json' + npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed - - # Step 4: Set up Allure commandline for reporting + # Step 4: Set up Allure commandline - name: Set up Allure commandline run: npm install -g allure-commandline - # Step 5: Start API Server + # Step 5: Start the API server (before running Cypress tests) - name: Start API Server run: | nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background sleep 30 # Wait for 30 seconds to allow the server to start - # Step 6: Run Cypress tests - name: Run Cypress tests run: | - npx cypress run # Run Cypress tests - + npx cypress run # Run the Cypress tests # Step 7: Upload test results - name: Upload test results if: always() @@ -52,9 +49,8 @@ jobs: with: name: cypress-test-results path: | - ./allure-results/ - ./results/*.json - + ./tests/allure-results/ + ./tests/results/*.json generate-report: needs: tests runs-on: ubuntu-latest @@ -70,12 +66,11 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate Allure report from test results + # Step 3: Generate combined Allure report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - - # Step 4: Upload the Allure report as an artifact + # Step 4: Upload combined report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From a52cd240894cb59621e194d67da67d2f31e84b4e Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 00:17:15 +0530 Subject: [PATCH 16/30] Update cypress.yml --- .github/workflows/cypress.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 70a5735..4d8c427 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -18,7 +18,7 @@ jobs: # Step 1: Check out the repository - uses: actions/checkout@v4 - # Step 2: Set up Node.js in the root directory + # Step 2: Set up Node.js - name: Set up Node.js uses: actions/setup-node@v4 with: @@ -29,19 +29,33 @@ jobs: run: | npm ci # Install dependencies from 'tests/package-lock.json' npx cypress install # Install Cypress if not already installed + # Step 4: Set up Allure commandline - name: Set up Allure commandline run: npm install -g allure-commandline - # Step 5: Start the API server (before running Cypress tests) - - name: Start API Server + # Step 5: Install Java and start the API server (before running Cypress tests) + - name: Set up Java and start API Server run: | - nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar & # Start the API server in the background - sleep 30 # Wait for 30 seconds to allow the server to start - # Step 6: Run Cypress tests + # Install Java (required to run the API server) + sudo apt-get install openjdk-17-jdk -y + + # Start the API server in the background + nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar > server.log 2>&1 & + + # Wait for the API server to be fully up and accessible + echo "Waiting for the API server to be ready..." + until curl --silent --head http://localhost:7081/api/books; do + echo "Server not ready yet. Retrying in 2 seconds..." + sleep 2 + done + echo "Server is up and running." + + # Step 6: Run Cypress tests (both UI and API tests) - name: Run Cypress tests run: | npx cypress run # Run the Cypress tests + # Step 7: Upload test results - name: Upload test results if: always() @@ -51,6 +65,7 @@ jobs: path: | ./tests/allure-results/ ./tests/results/*.json + generate-report: needs: tests runs-on: ubuntu-latest @@ -66,11 +81,12 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate combined Allure report + # Step 3: Generate Allure report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload combined report + + # Step 4: Upload the generated Allure report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From dd35f6cb7f627b811cfc1fa8451df77dea0466f7 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 00:42:33 +0530 Subject: [PATCH 17/30] Update cypress.yml --- .github/workflows/cypress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 4d8c427..8a84f18 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -27,7 +27,7 @@ jobs: # Step 3: Install dependencies (with `cd` into the tests directory) - name: Install dependencies run: | - npm ci # Install dependencies from 'tests/package-lock.json' + npm ci # Install dependencies from 'package-lock.json' npx cypress install # Install Cypress if not already installed # Step 4: Set up Allure commandline From 0d7a72aa0f3402326f87cc2f7c23669b87e5dc5e Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:01:30 +0530 Subject: [PATCH 18/30] Update cypress.yml --- .github/workflows/cypress.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 8a84f18..eb84bb4 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -24,7 +24,7 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies (with `cd` into the tests directory) + # Step 3: Install dependencies - name: Install dependencies run: | npm ci # Install dependencies from 'package-lock.json' @@ -34,15 +34,13 @@ jobs: - name: Set up Allure commandline run: npm install -g allure-commandline - # Step 5: Install Java and start the API server (before running Cypress tests) + # Step 5: Install Java and start API server - name: Set up Java and start API Server run: | # Install Java (required to run the API server) sudo apt-get install openjdk-17-jdk -y - # Start the API server in the background nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar > server.log 2>&1 & - # Wait for the API server to be fully up and accessible echo "Waiting for the API server to be ready..." until curl --silent --head http://localhost:7081/api/books; do @@ -56,16 +54,23 @@ jobs: run: | npx cypress run # Run the Cypress tests - # Step 7: Upload test results + # Step 7: List files for debugging + - name: List files and directories + run: | + echo "Listing Allure results directory:" + ls -l ./allure-results/ || echo "No allure-results directory found" + echo "Listing Results directory:" + ls -l ./results/ || echo "No results directory found" + + # Step 8: Upload test results - name: Upload test results if: always() uses: actions/upload-artifact@v3 with: name: cypress-test-results path: | - ./tests/allure-results/ - ./tests/results/*.json - + ./allure-results/ # Path to Allure results + ./results/results.json # Path to JSON results generate-report: needs: tests runs-on: ubuntu-latest @@ -81,12 +86,12 @@ jobs: name: cypress-test-results path: results - # Step 3: Generate Allure report + # Step 3: Generate Allure Report - name: Generate Allure Report run: | allure generate results/cypress-test-results -o results/allure-report --clean - # Step 4: Upload the generated Allure report + # Step 4: Upload Allure report - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 56dd2fce3eeb5e4348935d4ab6e0076a86a46ca7 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:08:32 +0530 Subject: [PATCH 19/30] Update cypress.yml --- .github/workflows/cypress.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index eb84bb4..8ead7a8 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -24,17 +24,19 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies + # Step 3: Install dependencies (including Allure dependencies) - name: Install dependencies run: | npm ci # Install dependencies from 'package-lock.json' + npm install allure-commandline --save-dev + npm install allure-cypress --save-dev + npm install mocha-allure-reporter --save-dev + npm install @badeball/cypress-cucumber-preprocessor --save-dev + npm install @bahmutov/cypress-esbuild-preprocessor --save-dev + npm install cypress @badeball/cypress-cucumber-preprocessor cypress-file-upload --save-dev npx cypress install # Install Cypress if not already installed - # Step 4: Set up Allure commandline - - name: Set up Allure commandline - run: npm install -g allure-commandline - - # Step 5: Install Java and start API server + # Step 4: Set up Java and start the API server - name: Set up Java and start API Server run: | # Install Java (required to run the API server) @@ -49,28 +51,25 @@ jobs: done echo "Server is up and running." - # Step 6: Run Cypress tests (both UI and API tests) + # Step 5: Run Cypress tests with the mocha-allure-reporter - name: Run Cypress tests run: | - npx cypress run # Run the Cypress tests + npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results - # Step 7: List files for debugging + # Step 6: List files and directories for debugging - name: List files and directories run: | echo "Listing Allure results directory:" ls -l ./allure-results/ || echo "No allure-results directory found" - echo "Listing Results directory:" - ls -l ./results/ || echo "No results directory found" - # Step 8: Upload test results + # Step 7: Upload test results - name: Upload test results if: always() uses: actions/upload-artifact@v3 with: name: cypress-test-results - path: | - ./allure-results/ # Path to Allure results - ./results/results.json # Path to JSON results + path: ./allure-results/ # Path to Allure results + generate-report: needs: tests runs-on: ubuntu-latest From 306668f3a0f1f957172c91a42816de79d3c6c883 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:36:53 +0530 Subject: [PATCH 20/30] Update cypress.yml --- .github/workflows/cypress.yml | 84 +++++++++++++++-------------------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 8ead7a8..7c9669b 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,4 +1,4 @@ -name: Cypress Tests +name: Cypress Tests with Allure Report on: push: @@ -24,76 +24,64 @@ jobs: with: node-version: '20' - # Step 3: Install dependencies (including Allure dependencies) + # Step 3: Install dependencies - name: Install dependencies run: | - npm ci # Install dependencies from 'package-lock.json' - npm install allure-commandline --save-dev - npm install allure-cypress --save-dev - npm install mocha-allure-reporter --save-dev - npm install @badeball/cypress-cucumber-preprocessor --save-dev - npm install @bahmutov/cypress-esbuild-preprocessor --save-dev - npm install cypress @badeball/cypress-cucumber-preprocessor cypress-file-upload --save-dev - npx cypress install # Install Cypress if not already installed + npm ci + npx cypress install # Ensure Cypress is installed - # Step 4: Set up Java and start the API server - - name: Set up Java and start API Server + # Step 4: Set up Allure commandline + - name: Set up Allure commandline + run: npm install -g allure-commandline + + # Step 5: Install additional dependencies for Allure and Cypress + - name: Install additional dependencies run: | - # Install Java (required to run the API server) - sudo apt-get install openjdk-17-jdk -y - # Start the API server in the background - nohup java -jar ./src/api/demo-0.0.1-SNAPSHOT.jar > server.log 2>&1 & - # Wait for the API server to be fully up and accessible - echo "Waiting for the API server to be ready..." - until curl --silent --head http://localhost:7081/api/books; do - echo "Server not ready yet. Retrying in 2 seconds..." - sleep 2 - done - echo "Server is up and running." + npm install mocha-allure-reporter allure-cypress --save-dev + npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor --save-dev - # Step 5: Run Cypress tests with the mocha-allure-reporter + # Step 6: Run Cypress tests with Allure reporter - name: Run Cypress tests run: | npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results - # Step 6: List files and directories for debugging - - name: List files and directories - run: | - echo "Listing Allure results directory:" - ls -l ./allure-results/ || echo "No allure-results directory found" + # Step 7: Generate the Allure report + - name: Generate Allure Report + run: allure generate allure-results --clean - # Step 7: Upload test results - - name: Upload test results - if: always() - uses: actions/upload-artifact@v3 + # Step 8: Deploy Allure Report to GitHub Pages + - name: Deploy Allure Report to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 with: - name: cypress-test-results - path: ./allure-results/ # Path to Allure results + personal_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./allure-report + publish_branch: gh-pages + # Optional: If you'd like to host using a simple webserver instead of GitHub Pages generate-report: needs: tests runs-on: ubuntu-latest steps: - # Step 1: Check out the repository - - uses: actions/checkout@v4 + - name: Check out the repository + uses: actions/checkout@v4 - # Step 2: Download test results - - name: Download test results - uses: actions/download-artifact@v3 - with: - name: cypress-test-results - path: results + # Step 1: Install HTTP Server + - name: Install http-server + run: | + npm install -g http-server - # Step 3: Generate Allure Report - - name: Generate Allure Report + # Step 2: Serve the Allure report locally + - name: Serve Allure Report run: | - allure generate results/cypress-test-results -o results/allure-report --clean + # Generate the report if not generated yet + allure generate allure-results --clean + http-server ./allure-report -p 8080 & - # Step 4: Upload Allure report + # Step 3: Optional - Upload Allure report artifact (for easier access) - name: Upload Allure Report uses: actions/upload-artifact@v3 with: name: allure-report - path: results/allure-report + path: ./allure-report retention-days: 30 From ca2c5fdb7c17f5a613fc51ac197a7cf1befead96 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:50:07 +0530 Subject: [PATCH 21/30] Update cypress.yml --- .github/workflows/cypress.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 7c9669b..a296afa 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -40,14 +40,18 @@ jobs: npm install mocha-allure-reporter allure-cypress --save-dev npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor --save-dev - # Step 6: Run Cypress tests with Allure reporter + # Run Cypress tests and generate Allure results - name: Run Cypress tests run: | npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results + echo "Cypress tests completed" - # Step 7: Generate the Allure report - - name: Generate Allure Report - run: allure generate allure-results --clean + # Always generate Allure report, even if tests failed + - name: Generate Allure report + run: | + allure generate allure-results --clean + allure open allure-report # This step can be omitted if you want to push it to GitHub Pages + if: always() # This ensures it runs even if previous steps fail # Step 8: Deploy Allure Report to GitHub Pages - name: Deploy Allure Report to GitHub Pages From 3f0c525873774b40c074b2de4dd1448e71ab2491 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:58:30 +0530 Subject: [PATCH 22/30] Update cypress.yml --- .github/workflows/cypress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index a296afa..7633c03 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -32,13 +32,13 @@ jobs: # Step 4: Set up Allure commandline - name: Set up Allure commandline - run: npm install -g allure-commandline + run: npm install allure-commandline # Step 5: Install additional dependencies for Allure and Cypress - name: Install additional dependencies run: | npm install mocha-allure-reporter allure-cypress --save-dev - npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor --save-dev + npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor cypress-file-upload --save-dev # Run Cypress tests and generate Allure results - name: Run Cypress tests From 335c184abdf7e206d4b51f45a2ee4f7d7fc17004 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:04:23 +0530 Subject: [PATCH 23/30] Update cypress.yml --- .github/workflows/cypress.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 7633c03..a335eb5 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -40,17 +40,16 @@ jobs: npm install mocha-allure-reporter allure-cypress --save-dev npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor cypress-file-upload --save-dev - # Run Cypress tests and generate Allure results + # Step 6: Run Cypress tests and generate Allure results - name: Run Cypress tests run: | npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results echo "Cypress tests completed" - # Always generate Allure report, even if tests failed + # Step 7: Always generate Allure report, even if tests failed - name: Generate Allure report run: | allure generate allure-results --clean - allure open allure-report # This step can be omitted if you want to push it to GitHub Pages if: always() # This ensures it runs even if previous steps fail # Step 8: Deploy Allure Report to GitHub Pages From 13a0fd41a8b83524b4fb573111f9fde067b59ba1 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:14:41 +0530 Subject: [PATCH 24/30] Update cypress.yml --- .github/workflows/cypress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index a335eb5..b2322f7 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -32,7 +32,7 @@ jobs: # Step 4: Set up Allure commandline - name: Set up Allure commandline - run: npm install allure-commandline + run: npm install -g allure-commandline # Step 5: Install additional dependencies for Allure and Cypress - name: Install additional dependencies From 817f04ab11033df646857a00d6e299bd3d2a8ba8 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:22:10 +0530 Subject: [PATCH 25/30] Update cypress.yml --- .github/workflows/cypress.yml | 38 ++++++++--------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index b2322f7..3e19503 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -29,7 +29,7 @@ jobs: run: | npm ci npx cypress install # Ensure Cypress is installed - + # Step 4: Set up Allure commandline - name: Set up Allure commandline run: npm install -g allure-commandline @@ -50,38 +50,16 @@ jobs: - name: Generate Allure report run: | allure generate allure-results --clean - if: always() # This ensures it runs even if previous steps fail - - # Step 8: Deploy Allure Report to GitHub Pages - - name: Deploy Allure Report to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - personal_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./allure-report - publish_branch: gh-pages + if: always() - # Optional: If you'd like to host using a simple webserver instead of GitHub Pages - generate-report: - needs: tests - runs-on: ubuntu-latest - - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - # Step 1: Install HTTP Server - - name: Install http-server - run: | - npm install -g http-server - - # Step 2: Serve the Allure report locally - - name: Serve Allure Report + # Step 8: Serve the Allure report locally + - name: Serve Allure Report Locally run: | - # Generate the report if not generated yet - allure generate allure-results --clean + npm install -g http-server # Install http-server http-server ./allure-report -p 8080 & - - # Step 3: Optional - Upload Allure report artifact (for easier access) + # Note: You could use "nohup" if needed to run this in the background, e.g., `nohup http-server ./allure-report -p 8080 &` + + # Step 9: Optionally, Upload Allure report as artifact for easy access - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 3ffc41546bc1dce4d3da979f86adb6127a7c19e6 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:27:13 +0530 Subject: [PATCH 26/30] Update cypress.yml --- .github/workflows/cypress.yml | 45 ++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 3e19503..9391277 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -29,7 +29,7 @@ jobs: run: | npm ci npx cypress install # Ensure Cypress is installed - + # Step 4: Set up Allure commandline - name: Set up Allure commandline run: npm install -g allure-commandline @@ -40,26 +40,49 @@ jobs: npm install mocha-allure-reporter allure-cypress --save-dev npm install @bahmutov/cypress-esbuild-preprocessor @badeball/cypress-cucumber-preprocessor cypress-file-upload --save-dev - # Step 6: Run Cypress tests and generate Allure results + # Step 6: Run Cypress tests and generate Allure results (ensure it doesn't fail the workflow) - name: Run Cypress tests run: | - npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results - echo "Cypress tests completed" + npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results || true + echo "Cypress tests completed (even with failures)" # Step 7: Always generate Allure report, even if tests failed - name: Generate Allure report run: | allure generate allure-results --clean - if: always() + if: always() # Ensures it runs even if the previous step fails + + # Step 8: Deploy Allure Report to GitHub Pages + - name: Deploy Allure Report to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + personal_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./allure-report # Folder where the Allure report is generated + publish_branch: gh-pages # Deploy to gh-pages branch + if: always() # Ensures this step runs even if tests fail - # Step 8: Serve the Allure report locally - - name: Serve Allure Report Locally + # Optional: If you'd like to host using a simple webserver instead of GitHub Pages + generate-report: + needs: tests + runs-on: ubuntu-latest + + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + # Step 1: Install HTTP Server + - name: Install http-server + run: | + npm install -g http-server + + # Step 2: Serve the Allure report locally + - name: Serve Allure Report run: | - npm install -g http-server # Install http-server + # Generate the report if not generated yet + allure generate allure-results --clean http-server ./allure-report -p 8080 & - # Note: You could use "nohup" if needed to run this in the background, e.g., `nohup http-server ./allure-report -p 8080 &` - - # Step 9: Optionally, Upload Allure report as artifact for easy access + + # Step 3: Optional - Upload Allure report artifact (for easier access) - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From 823b1f4b3e94ef6d5629ac76a18097be7d36c7d7 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:33:51 +0530 Subject: [PATCH 27/30] Update cypress.yml --- .github/workflows/cypress.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 9391277..f72a354 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -61,7 +61,7 @@ jobs: publish_branch: gh-pages # Deploy to gh-pages branch if: always() # Ensures this step runs even if tests fail - # Optional: If you'd like to host using a simple webserver instead of GitHub Pages + # Optional: Serve the Allure report via a simple HTTP server for local viewing (not required for GitHub Pages deployment) generate-report: needs: tests runs-on: ubuntu-latest @@ -70,19 +70,19 @@ jobs: - name: Check out the repository uses: actions/checkout@v4 - # Step 1: Install HTTP Server + # Step 1: Install HTTP Server locally (optional) - name: Install http-server run: | npm install -g http-server - # Step 2: Serve the Allure report locally + # Step 2: Serve the Allure report locally (optional for local testing) - name: Serve Allure Report run: | # Generate the report if not generated yet allure generate allure-results --clean http-server ./allure-report -p 8080 & - # Step 3: Optional - Upload Allure report artifact (for easier access) + # Step 3: Optional - Upload Allure report artifact for easier access (for local testing) - name: Upload Allure Report uses: actions/upload-artifact@v3 with: From e62f24be63228ec2189a113ce4c0d2e57bfa31a7 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 03:03:06 +0530 Subject: [PATCH 28/30] Update cypress.yml --- .github/workflows/cypress.yml | 40 ++++++++--------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index f72a354..8fa4fa9 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -46,13 +46,20 @@ jobs: npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results || true echo "Cypress tests completed (even with failures)" - # Step 7: Always generate Allure report, even if tests failed + # Step 7: Stop the API server if it's running (assuming it was started in the background) + - name: Stop API Server + run: | + # Find the API server process and kill it + pkill -f "node" # Or replace "node" with the command used to start the API server (e.g., "npm start") + if: always() # This ensures it runs even if previous steps fail + + # Step 8: Always generate Allure report, even if tests failed - name: Generate Allure report run: | allure generate allure-results --clean if: always() # Ensures it runs even if the previous step fails - # Step 8: Deploy Allure Report to GitHub Pages + # Step 9: Deploy Allure Report to GitHub Pages - name: Deploy Allure Report to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: @@ -60,32 +67,3 @@ jobs: publish_dir: ./allure-report # Folder where the Allure report is generated publish_branch: gh-pages # Deploy to gh-pages branch if: always() # Ensures this step runs even if tests fail - - # Optional: Serve the Allure report via a simple HTTP server for local viewing (not required for GitHub Pages deployment) - generate-report: - needs: tests - runs-on: ubuntu-latest - - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - # Step 1: Install HTTP Server locally (optional) - - name: Install http-server - run: | - npm install -g http-server - - # Step 2: Serve the Allure report locally (optional for local testing) - - name: Serve Allure Report - run: | - # Generate the report if not generated yet - allure generate allure-results --clean - http-server ./allure-report -p 8080 & - - # Step 3: Optional - Upload Allure report artifact for easier access (for local testing) - - name: Upload Allure Report - uses: actions/upload-artifact@v3 - with: - name: allure-report - path: ./allure-report - retention-days: 30 From b24903b22103c2444b651190cc44800fce9c7059 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 03:04:16 +0530 Subject: [PATCH 29/30] Update cypress.yml From f7171676ed61bb53cc9cf6407836babf096bbfc6 Mon Sep 17 00:00:00 2001 From: Heshan Sanjaya <116169635+HeshanSnjaya@users.noreply.github.com> Date: Sun, 5 Jan 2025 03:09:55 +0530 Subject: [PATCH 30/30] Update cypress.yml --- .github/workflows/cypress.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 8fa4fa9..1d1f8bb 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -46,20 +46,13 @@ jobs: npx cypress run --reporter mocha-allure-reporter --reporter-options allureResults=allure-results || true echo "Cypress tests completed (even with failures)" - # Step 7: Stop the API server if it's running (assuming it was started in the background) - - name: Stop API Server - run: | - # Find the API server process and kill it - pkill -f "node" # Or replace "node" with the command used to start the API server (e.g., "npm start") - if: always() # This ensures it runs even if previous steps fail - - # Step 8: Always generate Allure report, even if tests failed + # Step 7: Always generate Allure report, even if tests failed - name: Generate Allure report run: | allure generate allure-results --clean if: always() # Ensures it runs even if the previous step fails - # Step 9: Deploy Allure Report to GitHub Pages + # Step 8: Deploy Allure Report to GitHub Pages - name: Deploy Allure Report to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: