👷(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:
Anthony LC
2024-01-11 17:06:25 +01:00
committed by Anthony LC
parent 5f280ae3fc
commit da851f508a
8 changed files with 67 additions and 19 deletions

View File

@@ -2,3 +2,4 @@ NEXT_PUBLIC_API_URL=http://localhost:8071/api/v1.0/
NEXT_PUBLIC_KEYCLOAK_URL=http://localhost:8080/
NEXT_PUBLIC_KEYCLOAK_REALM=people
NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=people-front
NEXT_PUBLIC_KEYCLOAK_LOGIN=true

View File

@@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"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",
"start": "next start",
"lint": "next lint",

View File

@@ -16,7 +16,7 @@ const useAuthStore = create<AuthStore>((set) => ({
initAuth: () =>
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 }));
return { initialized: true };
}

View File

@@ -32,7 +32,7 @@ export default defineConfig({
},
webServer: {
command: 'cd ../.. && yarn dev:desk --port ' + PORT,
command: `cd ../.. && yarn app:${process.env.CI ? "start" : "dev"} --port ${PORT}`,
url: baseURL,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -14,6 +14,7 @@
"app:start": "yarn APP_DESK run start",
"app:build": "yarn APP_DESK run build",
"app:test": "yarn APP_DESK run test",
"ci:build": "yarn APP_DESK run build:ci",
"e2e:test": "yarn APP_E2E run test"
},
"resolutions": {