Skip to content

Commit

Permalink
Blokh/feat/test infra (#500)
Browse files Browse the repository at this point in the history
* feat(database-infra): generated infra for test creations ( test & nest )

generate database infra for test creations, generated test for end-user in order to test the
test-infra

* feat: generated global setup and teardown

* updated DATABASE_SCHEMA_NAME using zod

* fixed comments

* removed unnecessary actions and docker compose

* updated lock

* feat: running foramt

* updated DB_CONTAINER type

* feat(added testglobal): added TestGlobal

* updated pnpm lock

* feat: added TESTCONTAINERS_RYUK_DISABLED true

* ran commitlint

* removed unnecessary wawait

* removed test using windows

* updated test runnign strategy

* removed windows test as it does not support db request

* feat(added support for unit test ing test and e2e test): added support for unit test

added support for unit test, integration test and e2e test

* added different ci for ubuntu and windows

* updated commons

* removed unit test from browser sdk

* removed unit test from workflow

* fixed package json

* removed unit test from node-sdk

* added crossenv

* merged with dev

* fixed enduser test

* reverted removal of unittest

* ran format

* updated nx json

* added unit test for workflow core

* fixed nx json

* fixed duplicated tests configuration on nx

* reverted remoival of lint

* merged with dev
  • Loading branch information
Blokh authored Jun 14, 2023
1 parent d2598bf commit 4b6b32a
Show file tree
Hide file tree
Showing 35 changed files with 645 additions and 60 deletions.
39 changes: 39 additions & 0 deletions .github/actions/integration-test-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test
description: Test the project

runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.1

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install

- name: Test
shell: bash
run: pnpm test:integration
39 changes: 39 additions & 0 deletions .github/actions/unit-test-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test
description: Test the project

runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.1

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install

- name: Test
shell: bash
run: pnpm test:unit
27 changes: 17 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,36 @@ jobs:

- name: Format
uses: ./.github/actions/format-action

test:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
timeout-minutes: 60
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build-action

test_linux:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Test
uses: ./.github/actions/test-action
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

test_windows:
runs-on: windows-latest
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build-action
- name: Test
uses: ./.github/actions/unit-test-action
1 change: 1 addition & 0 deletions apps/backoffice-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"dev": "vite",
"build": "vite build",
"test": "vitest run --passWithNoTests",
"test:unit": "vitest run --passWithNoTests",
"test:e2e": "playwright test",
"typecheck": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const Cases: FunctionComponent<ICasesProps> & ICasesChildren = ({
</div>
</div>
<div className={`flex items-center justify-between`}>
<div className="dropdown-hover dropdown dropdown-bottom z-[60]">
<div className="dropdown dropdown-bottom dropdown-hover z-[60]">
<button
className={`btn-ghost btn-sm btn h-[2.125rem] gap-2 border-neutral/10 text-xs focus-visible:outline-primary theme-dark:border-neutral/50`}
tabIndex={0}
Expand Down
2 changes: 1 addition & 1 deletion apps/backoffice-v2/src/pages/SignIn/SignIn.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const SignIn: FunctionComponent = () => {
return (
<section className={`flex h-full flex-col items-center justify-center`}>
<div className={`mb-16`}>
{env.VITE_IMAGE_LOGO_URL ? (
{!!env.VITE_IMAGE_LOGO_URL ? (
<img className={`w-40`} src={env.VITE_IMAGE_LOGO_URL} />
) : (
<BallerineLogo />
Expand Down
11 changes: 10 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "test"]
"cacheableOperations": ["build", "test", "test:unit", "test:integration", "test:e2e"]
}
}
},
Expand All @@ -20,6 +20,15 @@
"test": {
"dependsOn": [{ "projects": "self", "target": "build" }]
},
"test:unit": {
"dependsOn": [{ "projects": "self", "target": "build" }]
},
"test:integration": {
"dependsOn": [{ "projects": "self", "target": "build" }]
},
"test:e2e": {
"dependsOn": [{ "projects": "self", "target": "build" }]
},
"lint": {
"dependsOn": [{ "projects": "self", "target": "build" }]
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"format:check": "nx run-many --target=format:check --exclude=@ballerine/backoffice-v2",
"lint": "nx run-many --target=lint --projects=@ballerine/web-ui-sdk,@ballerine/workflows-service,@ballerine/workflow-browser-sdk",
"test": "nx run-many --target=test --exclude=@ballerine/common",
"test:unit": "nx run-many --target=test:unit --exclude=@ballerine/common",
"test:integration": "nx run-many --target=test:integration --exclude=@ballerine/common",
"test:e2e": "nx run-many --target=test:e2e",
"playwright:install": "nx run-many --target=playwright:install",
"dev": "nx run-many --target=dev --projects=@ballerine/workflows-service,@ballerine/backoffice-v2",
Expand Down
1 change: 1 addition & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"build": "rollup --config rollup.config.js",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"tsc -b --watch\"",
"test": "vitest",
"test:unit": "vitest",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint . --fix",
Expand Down
3 changes: 2 additions & 1 deletion packages/rules-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"scripts": {
"build": "rollup --config rollup.config.js",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"tsc -b --watch\"",
"test": "vitest run"
"test": "vitest run",
"test:unit": "vitest run"
},
"engines": {
"node": ">=12"
Expand Down
3 changes: 2 additions & 1 deletion packages/workflow-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"build": "pnpm clean && rollup --config rollup.config.js",
"watch": "tsc -w",
"dev": "concurrently --kill-others \"pnpm build -w\" \"pnpm watch\"",
"test": "vitest run"
"test": "vitest run",
"test:unit": "vitest run"
},
"engines": {
"node": ">=12"
Expand Down
Loading

0 comments on commit 4b6b32a

Please sign in to comment.