Skip to content
Draft
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
51 changes: 0 additions & 51 deletions .github/workflows/postman-tests.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Sync platform versions

on:
repository_dispatch:
types:
- cf-reeve-platform-pr

jobs:
create-or-update-pr:
runs-on: ubuntu-latest
steps:
- name: test
run: |
echo "triggered"
echo "payload: ${{ github.event.client_payload.TRIGGERING_PAYLOAD }}"
VERSION=$(echo $PAYLOAD | jq -r .version)
PR_NAME=$(echo $PAYLOAD | jq -r .prName)
SOURCE_BRANCH=$(echo $PAYLOAD | jq -r .sourceBranch)
TARGET_BRANCH=$(echo $PAYLOAD | jq -r .targetBranch)

VERSION_NEW="${{ github.event.client_payload.TRIGGERING_PAYLOAD.version }}"

echo "version direct access: $VERSION_NEW"

# check if pr with source branch already exists
if ! gh pr view $SOURCE_BRANCH
then
gh pr create --title "$PR_NAME" --body "" --base $TARGET_BRANCH --head $SOURCE_BRANCH
fi
gh pr checkout $SOURCE_BRANCH

sed -i -E "s|extra\[\"cfLobPlatformVersion\"\] = \".*\"|extra\[\"cfLobPlatformVersion\"\] = \"test-version\"|g" build.gradle.kts

git add build.gradle.kts
git commit -m "chore: bump platform version"
git push
109 changes: 109 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: e2e Tests

on:
pull_request:
env:
REEVE_DB_MIGRATIONS_REPO: cardano-foundation/cf-reeve-db-migrations
REEVE_DB_MIGRATIONS_REF: main
REEVE_DB_MIGRATIONS_PATH: cf-application/src/main/resources/db/migration/postgresql/cf-reeve-db-migrations
GITLAB_MAVEN_REGISTRY_URL: ${{ secrets.GITLAB_MAVEN_REGISTRY_URL }}

jobs:
postman:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout cf-reeve-db-migrations
uses: actions/checkout@v4
with:
repository: ${{ env.REEVE_DB_MIGRATIONS_REPO }}
ref: ${{ env.REEVE_DB_MIGRATIONS_REF }}
ssh-key: ${{ secrets.CF_REEVE_DB_MIGRATIONS_SSH_DEPLOY_KEY }}
path: ${{ env.REEVE_DB_MIGRATIONS_PATH }}

- name: Set up Docker Compose
run: |
docker compose build --build-arg GITLAB_MAVEN_REGISTRY_URL="${GITLAB_MAVEN_REGISTRY_URL}"
docker compose up -d
timeout 150 docker compose logs -f api || true
- name: Services health-check API
run: |
timeout 180 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000/swagger-ui/index.html)" != "200" ]]; do sleep 2;echo "."; done'
echo "API is up"
docker ps
- name: Services health-check Keycloak
run: |
timeout 180 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8080/realms/master)" != "200" ]]; do sleep 2;echo "."; done'
echo "Keycloak is up"
docker ps
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Newman (Postman CLI)
run: npm install -g newman
- name: Run Postman Collection with Environment
run: |
newman run postman/Reeve_Integration.postman_collection.json \
--environment postman/Reeve_env.postman_environment.json

playwright:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout cf-reeve-db-migrations
uses: actions/checkout@v4
with:
repository: ${{ env.REEVE_DB_MIGRATIONS_REPO }}
ref: ${{ env.REEVE_DB_MIGRATIONS_REF }}
ssh-key: ${{ secrets.CF_REEVE_DB_MIGRATIONS_SSH_DEPLOY_KEY }}
path: ${{ env.REEVE_DB_MIGRATIONS_PATH }}

- name: Set up Docker Compose
run: |
docker compose build --build-arg GITLAB_MAVEN_REGISTRY_URL="${GITLAB_MAVEN_REGISTRY_URL}"
docker compose up -d
timeout 150 docker compose logs -f api || true

- name: Services health-check API
run: |
timeout 180 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000/swagger-ui/index.html)" != "200" ]]; do sleep 2;echo "."; done'
echo "API is up"
docker ps

- name: Services health-check Keycloak
run: |
timeout 180 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8080/realms/master)" != "200" ]]; do sleep 2;echo "."; done'
echo "Keycloak is up"
docker ps

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 24

- name: Install Playwright dependencies
working-directory: playwright
run: |
npm ci
npx playwright install --with-deps

- name: Create .env file
working-directory: playwright
run: |
echo "API_URL=http://localhost:9000/api/v1" >> .env
echo "LOGIN_URL=http://localhost:8080" >> .env
echo "MANAGER_USER=${{ secrets.PLAYWRIGHT_USER }}" >> .env
echo "MANAGER_PASSWORD=${{ secrets.PLAYWRIGHT_PASSWORD }}" >> .env
echo "API_LOG_REQUEST=false" >> .env
echo "ORGANIZATION_ID=${{ secrets.PLAYWRIGHT_ORGANIZATION_ID }}" >> .env
echo "CI=true" >> .env

- name: Run Playwright e2e tests
working-directory: playwright
run: npm run test
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ subprojects {
extra["springBootVersion"] = "3.3.3"
extra["springCloudVersion"] = "2023.0.0"
extra["jMoleculesVersion"] = "2023.1.0"
extra["cfLobPlatformVersion"] = "1.3.0-release-1.3.0-cb5d279-GHRUN19708586929"
extra["cfLobPlatformVersion"] = "1.3.0-PR495-a1d91c3-GHRUN19827668643"

dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
Expand Down
28 changes: 28 additions & 0 deletions playwright/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/node_modules
/.pnp
.pnp.js

# testing
/coverage
.auth/
.logs/
.reports/
/resources/
allure-results
**/.features-gen/**/*.spec.js

# production
/build

# misc
.DS_Store
../.env

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/resources

54 changes: 54 additions & 0 deletions playwright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 🧪 Reeve API Automation Framework

This project uses [Playwright](https://playwright.dev/) with BDD-style tests using [playwright-bdd](https://github.com/folke/playwright-bdd).

## 📦 Installation

To install all dependencies, including Playwright and playwright-bdd:

- Install Playwright and Playwright-BDD
```
npm i -D @playwright/test playwright-bdd
```
```
npx playwright install
```
- Install only Playwright-BDD
```
npm i -D playwright-bdd
```
## Env file to run in local

1. Create a `.env` file at the root of the playwright folder.
2. Use next structure as example.
3. Ask a team member for the required environment variables & corresponding values for the API, KEYCLOAK and extra application necessary variables.

```
API_URL= <API env url>
LOGIN_URL= <KEYCLOAK url>
MANAGER_USER= <Manager user name>
MANAGER_PASSWORD= <Manager user password>
API_LOG_REQUEST= <Boolean flag to show in logger the request body and params>
ORGANIZATION_ID= <Organization ID>
```

## ⚙️ Test run in local:

### Run all tests in feature files
npm test
### You can run a specific .feature file by passing it as an argument:
npm test "your-feature-file.feature"

## 📂 Test Structure

The test suite follows a BDD-style structure using [Gherkin](https://cucumber.io/docs/gherkin/)
feature files and corresponding step definitions.

### 🔸 Folder layout
- `tests/`
- `e2e/`: Contains `.feature` files written in Gherkin syntax. Each file describes user scenarios using Given, When, and Then steps.
- `test-scenarios.feature`
- `other-tests.feature`
- `steps/`: Contains the step definitions — the TypeScript code that implements the behavior described in the feature files.
- `test-scenarios.steps.ts`

8 changes: 8 additions & 0 deletions playwright/api/api-helpers/batches-status-codes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export enum BatchesStatusCodes {
APPROVE = "APPROVE",
PENDING = "PENDING",
INVALID = "INVALID",
PUBLISH = "PUBLISH",
PUBLISHED = "PUBLISHED"

}
42 changes: 42 additions & 0 deletions playwright/api/api-helpers/enpoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as process from "process";

export class Reeve {
static readonly BASE_URL = process.env.API_URL as string;
static readonly LOGIN_URL = process.env.LOGIN_URL as string;

static SignIn = class {
public static get Base() {
return `${Reeve.LOGIN_URL}/realms/reeve-master/protocol/openid-connect/token`;
}
};
static Transactions = class {
public static get Types() {
return `${Reeve.BASE_URL}/transaction-types`
}
public static get Extraction() {
return `${Reeve.BASE_URL}/extraction`
}
public static get Validation() {
return `${Reeve.Transactions.Extraction}/validation`
}
}
static Organization = class {
public static get Base() {
return `${Reeve.BASE_URL}/organisations`
}
public static get EventCodes() {
return `${Reeve.Organization.Base}/:orgId/event-codes`
}
public static get ChartOfAccounts() {
return `${Reeve.Organization.Base}/:orgId/chart-of-accounts`
}
}
static Batches = class {
public static get Batches() {
return `${Reeve.BASE_URL}/batches`
}
public static get BatchById() {
return `${Reeve.Batches.Batches}/:batchId`
}
}
}
6 changes: 6 additions & 0 deletions playwright/api/api-helpers/http-status-codes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum HttpStatusCodes {
success = 200,
RequestAccepted = 202,
BadRequest = 400,
Unauthorized= 401
}
Loading