Skip to content

Commit

Permalink
fix: Allure deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kneerose authored and NabinKawan committed May 16, 2024
1 parent 4d2ee99 commit e30a5ba
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 45 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
# - govtool/backend
# - tests/govtool-backend

schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
deployment:
Expand Down Expand Up @@ -70,7 +68,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
Expand All @@ -81,7 +79,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
Expand Down Expand Up @@ -113,12 +111,12 @@ 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
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: backend
REPORT_NAME: govtool-backend
GH_PAGES: ${{vars.GH_PAGES}}
10 changes: 6 additions & 4 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ jobs:
path: tests/govtool-frontend/playwright/allure-results

env:
FRONTEND_URL: ${{vars.HOST_URL}}
HOST_URL: ${{vars.HOST_URL}}
API_URL: ${{vars.HOST_URL}}/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
Expand Down Expand Up @@ -139,5 +141,5 @@ jobs:
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: integration
REPORT_NAME: govtool-frontend
GH_PAGES: ${{vars.GH_PAGES}}
2 changes: 1 addition & 1 deletion generate_latest_report_redirect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cat <<EOF > build/index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$REPORT_NAME/$REPORT_NUMBER">
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$REPORT_NAME/$REPORT_NUMBER#behaviors">
<title>Redirecting...</title>
</head>
</html>
Expand Down
8 changes: 4 additions & 4 deletions tests/govtool-frontend/playwright/lib/lockInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class LockInterceptor {
address: string,
lockId: string
): Promise<void> {
const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`);
const lockFilePath = path.resolve(__dirname, `../${address}`);

try {
await log(
Expand All @@ -50,7 +50,7 @@ export class LockInterceptor {
address: string,
lockId: string
): Promise<void> {
const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`);
const lockFilePath = path.resolve(__dirname, `../${address}`);

try {
await log(
Expand Down Expand Up @@ -155,7 +155,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);
}

Expand All @@ -170,7 +170,7 @@ function log(message: string): Promise<void> {
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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ export default class GovernanceActionsPage {
expect(proposalData.length, "No proposals to sort").toBeGreaterThan(0);

// API validation
proposalData.forEach(async (proposal) => {
if (proposal.elements.length <= 1) return;
for (const proposal of proposalData) {
if (proposal.elements.length <= 1) continue;

const proposals = proposal.elements as IProposal[];
for (let i = 0; i <= proposals.length - 2; i++) {
const isValid = validationFn(proposals[i], proposals[i + 1]);
expect(isValid, "API Sorting validation failed").toBe(true);
}
});
}

// Frontend validation
// Frontend validation
const proposalCards = await Promise.all(
filterKeys.map((key) =>
this.page.getByTestId(`govaction-${key}-card`).allInnerTexts()
Expand Down
14 changes: 7 additions & 7 deletions tests/govtool-frontend/playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"format": "prettier . --write"
},
"dependencies": {
"@cardanoapi/cardano-test-wallet": "^1.0.2",
"@cardanoapi/cardano-test-wallet": "^1.1.1",
"@faker-js/faker": "^8.4.1",
"@noble/curves": "^1.3.0",
"@noble/ed25519": "^2.0.0",
Expand Down
20 changes: 2 additions & 18 deletions tests/govtool-frontend/playwright/tests/dRep.setup.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import environments from "@constants/environments";
import { dRepWallets } from "@constants/staticWallets";
import { setAllureEpic, setAllureStory } from "@helpers/allure";
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");
import { setAllureStory, setAllureEpic } from "@helpers/allure";

const dRepInfo = require("../lib/_mock/dRepInfo.json");

setup.describe.configure({ timeout: environments.txTimeOut });

setup.beforeEach(async () => {
await setAllureEpic("Setup");
await setAllureStory("DRep");
});

dRepWallets.forEach((wallet) => {
setup(`Register DRep of wallet: ${wallet.address}`, async () => {
try {
Expand All @@ -33,16 +30,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;
}
});

0 comments on commit e30a5ba

Please sign in to comment.