Skip to content

Update newman.yml

Update newman.yml #17

Workflow file for this run

name: Automated API tests using Postman CLI
on: push
jobs:
automated-api-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.205"
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20.11.1"
- name: Install Node.js dependencies
run: npm install
working-directory: librarymanagementsystem-frontend
- name: Adjust Angular Budget
run: |
sed -i 's/"maximumError": "1mb"/"maximumError": "3mb"/' librarymanagementsystem-frontend/angular.json
sed -i 's/"maximumWarning": "1mb"/"maximumWarning": "2mb"/' librarymanagementsystem-frontend/angular.json
- name: Build Angular project
run: npm run build
working-directory: librarymanagementsystem-frontend
- name: Install .NET dependencies
run: dotnet restore
working-directory: librarymanagementsystem-backend/src/librarymanagementsystembackend/WebAPI
- name: Build .NET project
run: dotnet build --configuration Release
working-directory: librarymanagementsystem-backend/src/librarymanagementsystembackend/WebAPI
- name: Start .NET API server
run: |
dotnet run --no-build --project librarymanagementsystem-backend/src/librarymanagementsystembackend/WebAPI/WebAPI.csproj > dotnet_server_log.txt 2>&1 &
Start-Sleep -s 60 # Wait longer for the server to start
cat dotnet_server_log.txt
- name: Check if API server is up
run: |
echo "Checking if API server is up..."
curl -I http://localhost:60805/swagger/index.html
- name: Install Postman CLI
run: |
powershell.exe -NoProfile -InputFormat None -ExecutionPolicy AllSigned -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://dl-cli.pstmn.io/install/win64.ps1'))"
- name: Login to Postman CLI
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
- name: Run API tests
run: |
postman collection run "24412719-c07f3885-9a3d-4d2e-98b9-82c42e0a57fa" -e "24412719-04416698-a03d-471a-834a-38bf4922a759"