-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tests): move e2e tests for consultation-portal to their app #17008
base: main
Are you sure you want to change the base?
Changes from 8 commits
e7d5e93
b76ada4
ad64565
743692e
7b8102c
62a7add
cec0ca0
348e044
ff2adf2
89c648e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
**/*.log | ||
**/tmp/ | ||
**/temp/ | ||
**/.next/ | ||
|
||
# Outputs | ||
**/dist/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
ARG NODE_IMAGE_TAG=20.15.0-alpine3.20 | ||
|
||
# Stage 1: Install dependencies | ||
FROM node:${NODE_IMAGE_TAG} AS dependencies | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install Python3 and build tools | ||
RUN apk add --no-cache python3 py3-pip make g++ && ln -sf /usr/bin/python3 /usr/bin/python | ||
|
||
# Copy only package management files | ||
COPY package.json yarn.lock ./ | ||
COPY .yarn/ .yarn | ||
COPY .yarnrc.yml .yarnrc.yml | ||
COPY ./apps/native/app/package.json ./apps/native/app/package.json | ||
|
||
# Install dependencies | ||
RUN --mount=type=cache,target=/app/.yarn/cache \ | ||
yarn install --immutable && yarn cache clean | ||
|
||
# Stage 2: Final runtime image | ||
FROM node:${NODE_IMAGE_TAG} | ||
|
||
# Install Python (runtime requirement if needed) | ||
RUN apk add --no-cache python3 py3-pip && ln -sf /usr/bin/python3 /usr/bin/python | ||
|
||
# Enable Corepack and Yarn 3.2.3 | ||
RUN corepack enable && corepack prepare [email protected] --activate | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy from dependencies stage | ||
COPY --from=dependencies /app/node_modules ./node_modules | ||
COPY --from=dependencies /app/yarn.lock ./yarn.lock | ||
COPY --from=dependencies /app/.yarn/ ./.yarn | ||
COPY --from=dependencies /app/.yarnrc.yml ./.yarnrc.yml | ||
|
||
# Copy source code and necessary configuration files | ||
COPY ./apps ./apps | ||
COPY ./libs ./libs | ||
COPY ./infra ./infra | ||
COPY ./tools ./tools | ||
COPY ./tsconfig.base.json ./ | ||
COPY ./tsconfig.shared.json ./ | ||
COPY ./package.json ./ | ||
|
||
Comment on lines
+23
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add security best practices Consider enhancing the security of the final image:
# Copy source code and necessary configuration files
COPY ./apps ./apps
COPY ./libs ./libs
COPY ./infra ./infra
COPY ./tools ./tools
COPY ./tsconfig.base.json ./
COPY ./tsconfig.shared.json ./
COPY ./package.json ./
+
+# Create non-root user
+RUN addgroup -S appgroup && adduser -S appuser -G appgroup
+RUN chown -R appuser:appgroup /app
+USER appuser
+
+# Add healthcheck
+HEALTHCHECK --interval=30s --timeout=3s \
+ CMD wget --no-verbose --tries=1 --spider http://localhost:4200/samradsgatt || exit 1
|
||
# Verify Yarn version in runtime container | ||
RUN yarn --version | ||
|
||
# Default command to run the app | ||
CMD ["yarn", "nx", "serve"] | ||
|
||
# ARG NODE_IMAGE_TAG=20.15.0-alpine3.20 | ||
# FROM node:${NODE_IMAGE_TAG} AS build | ||
|
||
# WORKDIR /app | ||
|
||
# # Install build dependencies | ||
# RUN apk add --no-cache \ | ||
# python3 \ | ||
# py3-pip \ | ||
# make \ | ||
# g++ | ||
|
||
# # Set Python symlink | ||
# RUN ln -sf /usr/bin/python3 /usr/bin/python | ||
|
||
# # Install dependencies | ||
# COPY package.json yarn.lock ./ | ||
# COPY .yarn/ .yarn | ||
# COPY .yarnrc.yml .yarnrc.yml | ||
# COPY ./apps/native/app/package.json ./apps/native/app/package.json | ||
|
||
# # Run yarn install | ||
# RUN --mount=type=cache,target=/app/.yarn/cache \ | ||
# yarn install --immutable | ||
|
||
# # Copy source code | ||
# COPY . . | ||
|
||
# # Verify installation | ||
# RUN yarn nx --version | ||
|
||
# # Set default entrypoint | ||
# CMD ["yarn", "nx"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,24 @@ Login here https://island-is.awsapps.com/start#/ (Contact devops if you need acc | |
Copy env variables as instructed [here](https://docs.devland.is/technical-overview/devops/dockerizing#troubleshooting) (image arrows 1,2,3) | ||
Paste env variables into terminal | ||
|
||
## E2E Testing | ||
|
||
### Quick Start | ||
|
||
To run the E2E tests for the `consultation-portal` app: | ||
|
||
```bash | ||
# Install dependencies | ||
yarn install && yarn codegen | ||
|
||
# Start the server | ||
yarn nx e2e consultation-portal | ||
``` | ||
Comment on lines
+74
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance the Quick Start guide with additional setup details. The current instructions might be insufficient for first-time users. Consider adding:
Here's a suggested enhancement: ### Quick Start
+Prerequisites:
+- Ensure you have the required environment variables (see Development section above)
+- The API should be running locally (follow steps 1-5 in the Development section)
+
To run the E2E tests for the `consultation-portal` app:
```bash
# Install dependencies
yarn install && yarn codegen
# Start the server
yarn nx e2e consultation-portal +These tests verify both authenticated and unauthenticated user flows in the consultation portal.
|
||
|
||
### More Resources | ||
|
||
For further details, refer to the [E2E Testing Library README](../../libs/testing/e2e/README.md). | ||
|
||
## Project owner | ||
|
||
- [Stjórnarráðið](https://www.stjornarradid.is) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove commented-out code
Instead of keeping the commented-out test job configuration, consider removing it entirely since it's tracked in version control. If this code needs to be referenced later, it can be found in the git history.
🧰 Tools
🪛 actionlint (1.7.4)
190-190: label "ec2-runners" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)