From d5095c3aa565c01cba40cb3ce7e844a94d97b19c Mon Sep 17 00:00:00 2001
From: Jakob Moser <moser@cl.uni-heidelberg.de>
Date: Thu, 26 Sep 2024 20:34:08 +0200
Subject: [PATCH] Try adding frontend tests to pipeline

---
 .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ad3a6d6..3607cff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,3 +25,32 @@ lint-openapi:
     stage: test
     script: openapi lint portal/static/docs/api/v0/openapi-spec.yaml
     allow_failure: true
+
+test-frontend:
+    image: python
+    stage: test
+    before_script:
+        - apt-get update
+        - apt-get install -y ca-certificates curl gnupg faketime
+        - mkdir -p /etc/apt/keyrings
+        - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
+        - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
+        - apt-get update
+        - apt-get install -y nodejs libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
+        - pip install --upgrade pip setuptools
+        - pip install pipenv
+        - pipenv requirements > requirements.txt
+        - pip uninstall --yes pipenv
+        - pip install -r requirements.txt
+        - npm install cypress
+    script:
+        - mkdir instance
+        - export FLASK_APP=portal
+        - faketime '2024-09-26 13:37:00' flask run &
+        - faketime '2024-09-26 13:37:00' npx cypress run
+    artifacts:
+        when: always
+        paths:
+            - cypress/videos
+            - cypress/screenshots
+        expire_in: 1 week
-- 
GitLab