From 9882f3dc927baed2ec156ae250bdf0f108296b1d Mon Sep 17 00:00:00 2001 From: Nabin Kawan Date: Mon, 20 May 2024 13:28:43 +0545 Subject: [PATCH 1/5] fix: workflows (test_backend, test_integration_playwright) --- .github/workflows/test_backend.yml | 17 ++++++----- .../workflows/test_integration_playwright.yml | 28 ++++++++++++++----- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index 7c53ee7b3..2dd5ca67c 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -4,21 +4,20 @@ on: push: paths: - .github/workflows/test_backend.yml - # - govtool/backend - # - tests/govtool-backend + branches: + - test + - chore/update-backend-workflow - schedule: - - cron: "0 0 * * *" workflow_dispatch: inputs: deployment: required: true type: choice - default: "staging.govtool.byron.network/api" + default: "govtool.cardanoapi.io/api" options: - "sanchogov.tools/api" - "staging.govtool.byron.network/api" - - "govtool-sanchonet.cardanoapi.io/api" + - "govtool.cardanoapi.io/api" jobs: backend-tests: @@ -70,7 +69,7 @@ jobs: ref: gh-pages path: gh-pages repository: ${{vars.GH_PAGES}} - token: ${{secrets.PERSONAL_TOKEN}} + ssh-key: ${{ secrets.DEPLOY_KEY }} - name: Register report id: register-project @@ -81,7 +80,7 @@ jobs: - if: steps.register-project.outputs.project_exists != 'true' uses: JamesIves/github-pages-deploy-action@v4 with: - token: ${{ secrets.PERSONAL_TOKEN }} + ssh-key: ${{ secrets.DEPLOY_KEY }} repository-name: ${{vars.GH_PAGES}} branch: gh-pages folder: project @@ -113,7 +112,7 @@ jobs: - name: Deploy report to Github Pages uses: JamesIves/github-pages-deploy-action@v4 with: - token: ${{ secrets.PERSONAL_TOKEN }} + ssh-key: ${{ secrets.DEPLOY_KEY }} repository-name: ${{vars.GH_PAGES}} branch: gh-pages folder: build diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index 80f0cb971..6ca120c82 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -4,14 +4,26 @@ on: push: paths: - .github/workflows/test_integration_playwright.yml + branches: + - test + workflow_dispatch: + inputs: + deployment: + required: true + type: choice + default: "govtool.cardanoapi.io" + options: + - "sanchogov.tools" + - "staging.govtool.byron.network" + - "govtool.cardanoapi.io" + workflow_run: - workflows: ["Build and deploy GovTool test stack"] + workflows: ["Build and deploy GovTool to TEST server"] types: [completed] jobs: integration-tests: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }} defaults: run: working-directory: tests/govtool-frontend/playwright @@ -50,18 +62,20 @@ jobs: path: tests/govtool-frontend/playwright/allure-results env: - FRONTEND_URL: ${{vars.HOST_URL}} - API_URL: ${{vars.HOST_URL}}/api + HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }} + API_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}/api DOCS_URL: ${{ vars.DOCS_URL }} FAUCET_API_URL: ${{ vars.FAUCET_API_URL }} FAUCET_API_KEY: ${{secrets.FAUCET_API_KEY}} KUBER_API_URL: ${{vars.KUBER_API_URL}} KUBER_API_KEY: ${{secrets.KUBER_API_KEY}} - WORKERS: ${{vars.TEST_WORKERS}} + TEST_WORKERS: ${{vars.TEST_WORKERS}} + CI: ${{vars.CI}} + CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}} publish-report: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }} + if: always() needs: integration-tests steps: - uses: actions/checkout@v4 @@ -128,5 +142,5 @@ jobs: target-folder: ${{ env.REPORT_NAME }} env: - REPORT_NAME: integration + REPORT_NAME: govtool-frontend GH_PAGES: ${{vars.GH_PAGES}} From 34dad6e70dff584b5cc2f0f13b461b1fdde299c1 Mon Sep 17 00:00:00 2001 From: Nabin Kawan Date: Mon, 20 May 2024 13:36:20 +0545 Subject: [PATCH 2/5] Redirect to allure dashboard to #behaviors --- generate_latest_report_redirect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_latest_report_redirect.sh b/generate_latest_report_redirect.sh index de2ad8646..688e61239 100644 --- a/generate_latest_report_redirect.sh +++ b/generate_latest_report_redirect.sh @@ -11,7 +11,7 @@ cat < build/index.html - + Redirecting... From 1e64bf6e8bacb2ea6e4172dfa577fa05cc26e1ab Mon Sep 17 00:00:00 2001 From: Nabin Kawan Date: Mon, 20 May 2024 13:36:35 +0545 Subject: [PATCH 3/5] fix: File path issue --- .../playwright/lib/lockInterceptor.ts | 8 ++++---- .../playwright/tests/dRep.setup.ts | 16 ---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/lockInterceptor.ts b/tests/govtool-frontend/playwright/lib/lockInterceptor.ts index a749d26c8..8db59c067 100644 --- a/tests/govtool-frontend/playwright/lib/lockInterceptor.ts +++ b/tests/govtool-frontend/playwright/lib/lockInterceptor.ts @@ -15,7 +15,7 @@ export class LockInterceptor { address: string, lockId: string ): Promise { - const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`); + const lockFilePath = path.resolve(__dirname, `../${address}`); try { await log( @@ -42,7 +42,7 @@ export class LockInterceptor { address: string, lockId: string ): Promise { - const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`); + const lockFilePath = path.resolve(__dirname, `../${address}`); try { await log( @@ -147,7 +147,7 @@ export class LockInterceptor { } function checkAddressLock(address: string): boolean { - const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`); + const lockFilePath = path.resolve(__dirname, `../${address}`); return lockfile.checkSync(lockFilePath); } @@ -162,7 +162,7 @@ function log(message: string): Promise { hour12: false, timeZone: "Asia/Kathmandu", }; - const logFilePath = path.resolve(__dirname, "../.logs/lock_logs.txt"); + const logFilePath = path.resolve(__dirname, "../lock_logs.txt"); const logMessage = `[${new Date().toLocaleString("en-US", options)}] ${message}\n`; return new Promise((resolve, reject) => { fs.appendFile(logFilePath, logMessage, (err) => { diff --git a/tests/govtool-frontend/playwright/tests/dRep.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.setup.ts index 38c587663..f00ac7919 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.setup.ts @@ -3,11 +3,8 @@ import { dRepWallets } from "@constants/staticWallets"; import { pollTransaction } from "@helpers/transaction"; import { expect, test as setup } from "@playwright/test"; import kuberService from "@services/kuberService"; -import { Logger } from "../../cypress/lib/logger/logger"; import fetch = require("node-fetch"); -const dRepInfo = require("../lib/_mock/dRepInfo.json"); - setup.describe.configure({ timeout: environments.txTimeOut }); dRepWallets.forEach((wallet) => { @@ -28,16 +25,3 @@ dRepWallets.forEach((wallet) => { } }); }); - -setup("Setup dRep metadata", async () => { - try { - const res = await fetch(`${environments.metadataBucketUrl}/Test_dRep`, { - method: "PUT", - body: JSON.stringify(dRepInfo), - }); - Logger.success("Uploaded dRep metadata to bucket"); - } catch (err) { - Logger.fail(`Failed to upload dRep metadata: ${err}`); - throw err; - } -}); From c2fb53b4b2d62564249f25fa8778fb777b1b4d5b Mon Sep 17 00:00:00 2001 From: Nabin Kawan Date: Mon, 20 May 2024 16:33:17 +0545 Subject: [PATCH 4/5] Use latest cardano-test-wallet(v1.1.2) --- .../govtool-frontend/playwright/package-lock.json | 14 +++++++------- tests/govtool-frontend/playwright/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/govtool-frontend/playwright/package-lock.json b/tests/govtool-frontend/playwright/package-lock.json index 6fed6820e..ac37ec594 100644 --- a/tests/govtool-frontend/playwright/package-lock.json +++ b/tests/govtool-frontend/playwright/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@cardanoapi/cardano-test-wallet": "^1.1.1", + "@cardanoapi/cardano-test-wallet": "^1.1.2", "@faker-js/faker": "^8.4.1", "@noble/curves": "^1.3.0", "@noble/ed25519": "^2.0.0", @@ -86,9 +86,9 @@ } }, "node_modules/@cardanoapi/cardano-test-wallet": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-1.1.1.tgz", - "integrity": "sha512-bNseN0PY0vQ7o7FPKRQW3ZGhUgjQ9bavbbvUiIJ/oTTCwItAq1ds7CGRuVH4hDr8kPSUB76pHQMk8QvEXdMs5A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-1.1.2.tgz", + "integrity": "sha512-1pdc47EXMsa1iLcsmZAlfJEDkWRo23wd93CnZtj5Z/clGyvXsVj+ZDqakqnYMvQFr+IVrwROujdFHc9G2/2YDw==" }, "node_modules/@cbor-extract/cbor-extract-linux-x64": { "version": "2.2.0", @@ -3206,9 +3206,9 @@ "dev": true }, "@cardanoapi/cardano-test-wallet": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-1.1.1.tgz", - "integrity": "sha512-bNseN0PY0vQ7o7FPKRQW3ZGhUgjQ9bavbbvUiIJ/oTTCwItAq1ds7CGRuVH4hDr8kPSUB76pHQMk8QvEXdMs5A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-1.1.2.tgz", + "integrity": "sha512-1pdc47EXMsa1iLcsmZAlfJEDkWRo23wd93CnZtj5Z/clGyvXsVj+ZDqakqnYMvQFr+IVrwROujdFHc9G2/2YDw==" }, "@cbor-extract/cbor-extract-linux-x64": { "version": "2.2.0", diff --git a/tests/govtool-frontend/playwright/package.json b/tests/govtool-frontend/playwright/package.json index 23e5ab032..3daf73c97 100644 --- a/tests/govtool-frontend/playwright/package.json +++ b/tests/govtool-frontend/playwright/package.json @@ -26,7 +26,7 @@ "format": "prettier . --write" }, "dependencies": { - "@cardanoapi/cardano-test-wallet": "^1.1.1", + "@cardanoapi/cardano-test-wallet": "^1.1.2", "@faker-js/faker": "^8.4.1", "@noble/curves": "^1.3.0", "@noble/ed25519": "^2.0.0", From d361133184e5c3ac4af513c0b5abf9e4eb4c2dcc Mon Sep 17 00:00:00 2001 From: Nabin Kawan Date: Tue, 21 May 2024 09:56:45 +0545 Subject: [PATCH 5/5] Remove 'paths' trigger from test workflow --- .github/workflows/test_backend.yml | 4 ---- .github/workflows/test_integration_playwright.yml | 2 -- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index 2dd5ca67c..6254cef48 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -2,12 +2,8 @@ name: Backend Test on: push: - paths: - - .github/workflows/test_backend.yml branches: - test - - chore/update-backend-workflow - workflow_dispatch: inputs: deployment: diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index 6ca120c82..c65c56f8a 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -2,8 +2,6 @@ name: Integration Test [Playwright] on: push: - paths: - - .github/workflows/test_integration_playwright.yml branches: - test workflow_dispatch: