From 79809db62609fdb3d38f18dfc52ded394154e6a6 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 5 Mar 2025 14:31:43 +0000 Subject: [PATCH] run e2e testing in CI, add wiremock service Signed-off-by: Andrew Twydell --- .github/workflows/main.yml | 52 ++++++++++++++++++- .../wiremock/__files/ok-cache-plex.xml | 16 ++++++ .../wiremock/mappings/ok-cache-plex.json | 13 +++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 packages/vsce/__tests__/__e2e__/resources/wiremock/__files/ok-cache-plex.xml create mode 100644 packages/vsce/__tests__/__e2e__/resources/wiremock/mappings/ok-cache-plex.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23f71dec..d4243176 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,9 +92,59 @@ jobs: # name: zowe-cics-client # path: dist/* + e2e-test: + runs-on: ubuntu-latest + + services: + wiremock: + image: wiremock/wiremock + ports: + - 8080:8080 + volumes: + - ${{ github.workspace }}/packages/vsce/__tests__/__e2e__/resources/wiremock:/home/wiremock + options: --name wiremock + + steps: + - name: Change workspace folder so wiremock service can write + run: sudo chown -R $USER:$USER $GITHUB_WORKSPACE + + - name: Checkout + uses: actions/checkout@v4 + + - name: Restart Wiremock with new mappings + run: docker restart wiremock + + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Install Dependencies + run: npm ci + + - name: Build Source + id: build + run: npm run build + + - name: List Wiremock mappings + if: ${{ always() && steps.build.outcome == 'success' }} + run: curl localhost:8080/__admin/mappings + + - name: Test Wiremock route + if: ${{ always() && steps.build.outcome == 'success' }} + run: curl localhost:8080/CICSSystemManagement/CICSResultCache/E06EB1264D925C60 + + - name: E2E Tests + if: ${{ always() && steps.build.outcome == 'success' }} + uses: coactions/setup-xvfb@v1 + with: + run: npm run test:e2e + release: if: github.event_name == 'push' && github.ref_protected - needs: test + needs: + - test + - e2e-test runs-on: ubuntu-latest permissions: contents: write diff --git a/packages/vsce/__tests__/__e2e__/resources/wiremock/__files/ok-cache-plex.xml b/packages/vsce/__tests__/__e2e__/resources/wiremock/__files/ok-cache-plex.xml new file mode 100644 index 00000000..44c92224 --- /dev/null +++ b/packages/vsce/__tests__/__e2e__/resources/wiremock/__files/ok-cache-plex.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/packages/vsce/__tests__/__e2e__/resources/wiremock/mappings/ok-cache-plex.json b/packages/vsce/__tests__/__e2e__/resources/wiremock/mappings/ok-cache-plex.json new file mode 100644 index 00000000..dd40c1df --- /dev/null +++ b/packages/vsce/__tests__/__e2e__/resources/wiremock/mappings/ok-cache-plex.json @@ -0,0 +1,13 @@ +{ + "request": { + "method": "GET", + "url": "/CICSSystemManagement/CICSResultCache/E06EB1264D925C60" + }, + "response": { + "status": 200, + "bodyFileName": "ok-cache-plex.xml", + "headers": { + "Content-Type": "text/xml" + } + } +} \ No newline at end of file