From dce7c0a54ad3559c2b4780842c777ae42336464d Mon Sep 17 00:00:00 2001
From: amvanbaren <aart.vanbaren@eclipse-foundation.org>
Date: Wed, 2 Oct 2024 19:04:10 +0300
Subject: [PATCH] test smoketest

---
 .github/workflows/smoketest.yml | 56 +++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 .github/workflows/smoketest.yml

diff --git a/.github/workflows/smoketest.yml b/.github/workflows/smoketest.yml
new file mode 100644
index 000000000..865973c4c
--- /dev/null
+++ b/.github/workflows/smoketest.yml
@@ -0,0 +1,56 @@
+name: Playwright Tests against open-vsx.org
+on:
+  push:
+    branches:
+      # - production
+      - master
+jobs:
+  test:
+    timeout-minutes: 60
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          repository: EclipseFdn/open-vsx.org
+          path: open-vsx.org
+      - uses: actions/checkout@v4
+        with:
+          # repository: eclipse/openvsx
+          path: openvsx
+      - uses: actions/setup-node@v3
+        with:
+          node-version: 18.x
+      - name: Install dependencies
+        working-directory: ./openvsx/webui
+        run: yarn
+      - name: Install Playwright Browsers
+        working-directory: ./openvsx/webui
+        run: yarn playwright install --with-deps
+      - name: Get server version
+        id: read_version
+        run: |
+          read -r line < ./open-vsx.org/Dockerfile
+          version="${line:19}"
+          echo "version='${line:19}'" >> "$GITHUB_OUTPUT"
+      - name: Wait 10 minutes for deployment
+        # run: sleep 10m
+        run: sleep 30s
+      - name: Get running server version
+        id: running_version
+        uses: fjogeleit/http-request-action@v1
+        with:
+          url: "https://open-vsx.org/api/version"
+      - name: Check new server deployment is running
+        id: check_version
+        run: |
+          echo "is_version=${{ steps.running_version.outputs.status == 200 && fromJson(steps.running_version.outputs.response).version == steps.read_version.outputs.version }}" >> "$GITHUB_OUTPUT"
+      - name: Run Playwright tests
+        if: steps.check_version.outputs.is_version
+        working-directory: ./openvsx/webui
+        run: yarn smoke-tests
+      - uses: actions/upload-artifact@v3
+        if: steps.check_version.outputs.is_version
+        with:
+          name: playwright-report
+          path: openvsx/webui/playwright-report/
+          retention-days: 30