👷(CI) add test-e2e job to people.yml
Add test-e2e to people.yml, it will run e2e tests on every PR. Steps: - set env vars for e2e tests - build and start docker servers (backend, keycloak, DB) - install playwright - build apps - run e2e tests - save reports
This commit is contained in:
50
.github/workflows/people.yml
vendored
50
.github/workflows/people.yml
vendored
@@ -75,30 +75,56 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
- name: Test Desk App
|
- name: Test Desk App
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
run: yarn test
|
run: yarn test
|
||||||
|
|
||||||
build-front-desk:
|
test-e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
NEXT_PUBLIC_API_URL: http://localhost:8071/api/v1.0/
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: src/frontend/apps/desk
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set services env variables
|
||||||
|
run: |
|
||||||
|
make create-env-files
|
||||||
|
|
||||||
|
- name: Build and Start Docker Servers
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
||||||
|
run: |
|
||||||
|
docker-compose build --pull --build-arg BUILDKIT_INLINE_CACHE=1
|
||||||
|
make run
|
||||||
|
|
||||||
|
- name: Apply DRH migrations
|
||||||
|
run: |
|
||||||
|
make migrate
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18.x'
|
node-version: '18.x'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
cache-dependency-path: src/frontend/apps/desk/yarn.lock
|
cache-dependency-path: src/frontend/yarn.lock
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: cd src/frontend/ && yarn install --frozen-lockfile
|
||||||
- name: Build Desk App
|
|
||||||
run: yarn build
|
- name: Install Playwright Browsers
|
||||||
|
run: cd src/frontend/apps/e2e && yarn install
|
||||||
|
|
||||||
|
- name: Build CI App
|
||||||
|
run: cd src/frontend/ && yarn ci:build
|
||||||
|
|
||||||
|
- name: Run e2e tests
|
||||||
|
run: cd src/frontend/ && yarn e2e:test
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: src/frontend/apps/e2e/report/
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
build-mails:
|
build-mails:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
13
Makefile
13
Makefile
@@ -68,14 +68,19 @@ data/static:
|
|||||||
|
|
||||||
# -- Project
|
# -- Project
|
||||||
|
|
||||||
|
create-env-files: ## Copy the dist env files to env files
|
||||||
|
create-env-files: \
|
||||||
|
env.d/development/common \
|
||||||
|
env.d/development/crowdin \
|
||||||
|
env.d/development/postgresql \
|
||||||
|
env.d/development/kc_postgresql
|
||||||
|
.PHONY: create-env-files
|
||||||
|
|
||||||
bootstrap: ## Prepare Docker images for the project and install frontend dependencies
|
bootstrap: ## Prepare Docker images for the project and install frontend dependencies
|
||||||
bootstrap: \
|
bootstrap: \
|
||||||
data/media \
|
data/media \
|
||||||
data/static \
|
data/static \
|
||||||
env.d/development/common \
|
create-env-files \
|
||||||
env.d/development/crowdin \
|
|
||||||
env.d/development/postgresql \
|
|
||||||
env.d/development/kc_postgresql \
|
|
||||||
build \
|
build \
|
||||||
run \
|
run \
|
||||||
migrate \
|
migrate \
|
||||||
|
|||||||
@@ -56,6 +56,19 @@
|
|||||||
"realmRoles": [
|
"realmRoles": [
|
||||||
"user"
|
"user"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"username": "user-e2e",
|
||||||
|
"enabled": true,
|
||||||
|
"credentials": [
|
||||||
|
{
|
||||||
|
"type": "password",
|
||||||
|
"value": "password-e2e"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"realmRoles": [
|
||||||
|
"user"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"roles": {
|
"roles": {
|
||||||
@@ -2259,4 +2272,5 @@
|
|||||||
"clientPolicies": {
|
"clientPolicies": {
|
||||||
"policies": []
|
"policies": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2,3 +2,4 @@ NEXT_PUBLIC_API_URL=http://localhost:8071/api/v1.0/
|
|||||||
NEXT_PUBLIC_KEYCLOAK_URL=http://localhost:8080/
|
NEXT_PUBLIC_KEYCLOAK_URL=http://localhost:8080/
|
||||||
NEXT_PUBLIC_KEYCLOAK_REALM=people
|
NEXT_PUBLIC_KEYCLOAK_REALM=people
|
||||||
NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=people-front
|
NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=people-front
|
||||||
|
NEXT_PUBLIC_KEYCLOAK_LOGIN=true
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "prettier --check . && yarn stylelint && next build",
|
"build": "prettier --check . && yarn stylelint && next build",
|
||||||
|
"build:ci": "cp .env.development .env.local && yarn build",
|
||||||
"build-theme": "cunningham -g css,ts -o src/cunningham --utility-classes",
|
"build-theme": "cunningham -g css,ts -o src/cunningham --utility-classes",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const useAuthStore = create<AuthStore>((set) => ({
|
|||||||
|
|
||||||
initAuth: () =>
|
initAuth: () =>
|
||||||
set((state) => {
|
set((state) => {
|
||||||
if (process.env.NODE_ENV === 'development' && !state.initialized) {
|
if (process.env.NEXT_PUBLIC_KEYCLOAK_LOGIN && !state.initialized) {
|
||||||
initKeycloak((token) => set({ authenticated: true, token }));
|
initKeycloak((token) => set({ authenticated: true, token }));
|
||||||
return { initialized: true };
|
return { initialized: true };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'cd ../.. && yarn dev:desk --port ' + PORT,
|
command: `cd ../.. && yarn app:${process.env.CI ? "start" : "dev"} --port ${PORT}`,
|
||||||
url: baseURL,
|
url: baseURL,
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"app:start": "yarn APP_DESK run start",
|
"app:start": "yarn APP_DESK run start",
|
||||||
"app:build": "yarn APP_DESK run build",
|
"app:build": "yarn APP_DESK run build",
|
||||||
"app:test": "yarn APP_DESK run test",
|
"app:test": "yarn APP_DESK run test",
|
||||||
|
"ci:build": "yarn APP_DESK run build:ci",
|
||||||
"e2e:test": "yarn APP_E2E run test"
|
"e2e:test": "yarn APP_E2E run test"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
Reference in New Issue
Block a user