Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
- "staging.govtool.byron.network/api"
- "govtool.cardanoapi.io/api"
- "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr"
- "dev-sanchonet.govtool.byron.network/api"
- "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr"
- "be.gov.tools"
network:
required: true
Expand All @@ -39,7 +39,7 @@ concurrency:
jobs:
backend-tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
outputs:
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
status: ${{ steps.run-tests.outcome }}
Expand All @@ -58,7 +58,6 @@ jobs:
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
-d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"


- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- "govtool.cardanoapi.io"
- "preview.gov.tools"
- "gov.tools"
- "p80-z78acf3c2-zded6a792-gtw.z937eb260.rustrocks.fr"
network:
required: true
type: choice
Expand Down
27 changes: 27 additions & 0 deletions tests/govtool-frontend/playwright/lib/constants/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const adaHolder01AuthFile = ".auth/adaHolder01.json";
export const adaHolder02AuthFile = ".auth/adaHolder02.json";
export const adaHolder03AuthFile = ".auth/adaHolder03.json";
export const adaHolder04AuthFile = ".auth/adaHolder04.json";
export const adaHolder05AuthFile = ".auth/adaHolder05.json";
export const adaHolder06AuthFile = ".auth/adaHolder06.json";

export const user01AuthFile = ".auth/user01.json";

export const dRep01AuthFile = ".auth/dRep01.json";
export const dRep02AuthFile = ".auth/dRep02.json";
export const dRep03AuthFile = ".auth/dRep03.json";

export const proposal01AuthFile = ".auth/proposal01.json";
export const proposal02AuthFile = ".auth/proposal02.json";
export const proposal03AuthFile = ".auth/proposal03.json";
export const proposal04AuthFile = ".auth/proposal04.json";
export const proposal05AuthFile = ".auth/proposal05.json";
export const proposal06AuthFile = ".auth/proposal06.json";
export const proposal07AuthFile = ".auth/proposal07.json";
export const proposal08AuthFile = ".auth/proposal08.json";
export const proposal09AuthFile = ".auth/proposal09.json";

export const budgetProposal01AuthFile = ".auth/budgetProposal01.json";
export const budgetProposal02AuthFile = ".auth/budgetProposal02.json";
export const budgetProposal03AuthFile = ".auth/budgetProposal03.json";
export const budgetProposal04AuthFile = ".auth/budgetProposal04.json";
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const adaHolderWallets = [

export const userWallets = [user01Wallet];

export const dRepWallets = [dRep01Wallet, dRep02Wallet, dRep03Wallet];
export const dRepWallets = [dRep01Wallet, dRep02Wallet];
export const budgetProposalDRepWallets = [dRep03Wallet];

export const proposalWallets = [
proposal01Wallet,
Expand All @@ -65,4 +66,5 @@ export const allStaticWallets = [
...proposalWallets,
faucetWallet,
proposalFaucetWallet,
...budgetProposalDRepWallets,
];
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { budgetProposal01AuthFile } from "@constants/auth";
import { budgetProposal01Wallet } from "@constants/staticWallets";
import { test as base } from "@fixtures/walletExtension";
import { createNewPageWithWallet } from "@helpers/page";
Expand All @@ -12,7 +13,7 @@ export const test = base.extend<TestOptions>({
proposalId: async ({ browser }, use) => {
// setup
const budgetProposalPage = await createNewPageWithWallet(browser, {
storageState: ".auth/budgetProposal01.json",
storageState: budgetProposal01AuthFile,
wallet: budgetProposal01Wallet,
});

Expand Down
3 changes: 2 additions & 1 deletion tests/govtool-frontend/playwright/lib/fixtures/proposal.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { proposal01AuthFile } from "@constants/auth";
import { proposal01Wallet } from "@constants/staticWallets";
import { test as base } from "@fixtures/walletExtension";
import { createNewPageWithWallet } from "@helpers/page";
Expand All @@ -15,7 +16,7 @@ export const test = base.extend<TestOptions>({
proposalId: async ({ browser, pollEnabled }, use) => {
// setup
const proposalPage = await createNewPageWithWallet(browser, {
storageState: ".auth/proposal01.json",
storageState: proposal01AuthFile,
wallet: proposal01Wallet,
});

Expand Down
14 changes: 10 additions & 4 deletions tests/govtool-frontend/playwright/lib/helpers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import {
proposal08Wallet,
proposal09Wallet,
} from "@constants/staticWallets";
import {
proposal05AuthFile,
proposal07AuthFile,
proposal08AuthFile,
proposal09AuthFile,
} from "@constants/auth";

interface CreateUserProps {
page: Page;
Expand Down Expand Up @@ -91,22 +97,22 @@ export const getDraftProposalWalletAndState = (proposalType: string) => {
switch (proposalType) {
case ProposalType.info:
return {
storageState: ".auth/proposal05.json",
storageState: proposal05AuthFile,
wallet: proposal05Wallet,
};
case ProposalType.treasury:
return {
storageState: ".auth/proposal07.json",
storageState: proposal07AuthFile,
wallet: proposal07Wallet,
};
case ProposalType.updatesToTheConstitution:
return {
storageState: ".auth/proposal08.json",
storageState: proposal08AuthFile,
wallet: proposal08Wallet,
};
case ProposalType.motionOfNoConfedence:
return {
storageState: ".auth/proposal09.json",
storageState: proposal09AuthFile,
wallet: proposal09Wallet,
};
}
Expand Down
10 changes: 0 additions & 10 deletions tests/govtool-frontend/playwright/lib/helpers/cardano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ export async function skipIfNotInfoAndBootstrapping(type: ProposalType) {
}
}

export async function skipIfNotHardFork() {
const currentProtocolVersion = await getProtocolParamsMajorVersion();
if (currentProtocolVersion < 9) {
await allure.description(
"Govtool Features will be available after hardfork."
);
test.skip();
}
}

export async function skipIfMainnet() {
if (environments.networkId === 1) {
await allure.description(
Expand Down
66 changes: 59 additions & 7 deletions tests/govtool-frontend/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ export default defineConfig({
/* Configure projects for major browsers */
projects: [
{
name: "auth setup",
testMatch: "**/auth.setup.ts",
name: "adaholder auth setup",
testMatch: "**/adaholder.auth.setup.ts",
},
{
name: "user auth setup",
testMatch: "**/user.auth.setup.ts",
},
{
name: "faucet setup",
Expand All @@ -55,7 +59,25 @@ export default defineConfig({
{
name: "dRep setup",
testMatch: "**/dRep.setup.ts",
dependencies: environments.ci ? ["faucet setup"] : [],
dependencies: environments.ci ? ["faucet setup", "wallet bootstrap"] : [],
},
{
name: "proposal budget dRep setup",
testMatch: "**/proposal-budget.dRep.setup.ts",
teardown: environments.ci && "cleanup faucet",
},
{
name: "dRep auth setup",
testMatch: "**/dRep.auth.setup.ts",
dependencies: environments.ci ? ["dRep setup"] : [],
},
{
name: "proposal discussion auth setup",
testMatch: "**/proposal-discussion.auth.setup.ts",
},
{
name: "proposal budget auth setup",
testMatch: "**/proposal-budget.auth.setup.ts",
},
{
name: "proposal setup",
Expand All @@ -71,7 +93,24 @@ export default defineConfig({
name: "transaction",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.tx.spec.ts",
dependencies: environments.ci ? ["auth setup", "wallet bootstrap"] : [],
dependencies: environments.ci ? ["adaholder auth setup", "wallet bootstrap"] : [],
},
{
name: "proposal discussion",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.pd.spec.ts",
dependencies: environments.ci
? ["proposal discussion auth setup"]
: [],
},
{
name: "proposal budget",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.pb.spec.ts",
dependencies: environments.ci
? ["proposal budget auth setup"]
: [],
testIgnore: ["**/*.dRep.pb.spec.ts"],
},
{
name: "proposal submission",
Expand All @@ -85,14 +124,23 @@ export default defineConfig({
name: "loggedin (desktop)",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.loggedin.spec.ts",
dependencies: environments.ci ? ["auth setup"] : [],
dependencies: environments.ci ? ["user auth setup"] : [],
},
{
name: "proposal budget dRep",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.dRep.pb.spec.ts",
dependencies: environments.ci
? ["proposal budget auth setup","proposal budget dRep setup"]
: [],
teardown: environments.ci && "cleanup dRep",
},
{
name: "dRep",
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.dRep.spec.ts",
dependencies: environments.ci
? ["auth setup", "dRep setup", "wallet bootstrap"]
? ["dRep setup", "dRep auth setup", "wallet bootstrap"]
: [],
teardown: environments.ci && "cleanup dRep",
},
Expand All @@ -101,7 +149,7 @@ export default defineConfig({
use: { ...devices["Desktop Chrome"] },
testMatch: "**/*.delegation.spec.ts",
dependencies: environments.ci
? ["auth setup", "dRep setup", "wallet bootstrap"]
? ["adaholder auth setup", "dRep setup", "wallet bootstrap"]
: [],
teardown: environments.ci && "cleanup delegation",
},
Expand All @@ -114,6 +162,8 @@ export default defineConfig({
"**/*.dRep.spec.ts",
"**/*.tx.spec.ts",
"**/*.ga.spec.ts",
"**/*.pd.spec.ts",
"**/*.pb.spec.ts",
],
},
{
Expand All @@ -125,6 +175,8 @@ export default defineConfig({
"**/*.delegation.spec.ts",
"**/*.tx.spec.ts",
"**/*.ga.spec.ts",
"**/*.pd.spec.ts",
"**/*.pb.spec.ts",
"**/walletConnect.spec.ts",
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { user01AuthFile } from "@constants/auth";
import { user01Wallet } from "@constants/staticWallets";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import LoginPage from "@pages/loginPage";

test.use({ storageState: ".auth/user01.json", wallet: user01Wallet });
test.use({ storageState: user01AuthFile, wallet: user01Wallet });
test.beforeEach(async () => {
await setAllureEpic("1. Wallet connect");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import BudgetDiscussionDetailsPage from "@pages/budgetDiscussionDetailsPage";
import { expect } from "@playwright/test";
import { dRep03Wallet } from "@constants/staticWallets";
import BudgetDiscussionPage from "@pages/budgetDiscussionPage";
import { dRep03AuthFile } from "@constants/auth";
import { skipIfMainnet } from "@helpers/cardano";

test.beforeEach(async () => {
await setAllureEpic("11. Proposal Budget");
await skipIfMainnet();
});

test.describe("Budget proposal dRep behaviour", () => {
test.use({
storageState: ".auth/dRep03.json",
storageState: dRep03AuthFile,
wallet: dRep03Wallet,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { budgetProposal01AuthFile } from "@constants/auth";
import { budgetProposal01Wallet } from "@constants/staticWallets";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/walletExtension";
Expand All @@ -12,7 +13,7 @@ test.beforeEach(async () => {

test.describe("Budget proposal logged in state", () => {
test.use({
storageState: ".auth/budgetProposal01.json",
storageState: budgetProposal01AuthFile,
wallet: budgetProposal01Wallet,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { functionWaitedAssert } from "@helpers/waitedLoop";
import BudgetDiscussionDetailsPage from "@pages/budgetDiscussionDetailsPage";
import BudgetDiscussionPage from "@pages/budgetDiscussionPage";
import { expect } from "@playwright/test";
import { BudgetDiscussionEnum, CommentResponse } from "@types";
import { BudgetDiscussionEnum } from "@types";

const mockBudgetProposal = require("../../lib/_mock/budgetProposal.json");
const mockPoll = require("../../lib/_mock/budgetProposalPoll.json");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import {
budgetProposal01AuthFile,
budgetProposal02AuthFile,
budgetProposal03AuthFile,
budgetProposal04AuthFile,
} from "@constants/auth";
import {
budgetProposal01Wallet,
budgetProposal02Wallet,
Expand Down Expand Up @@ -26,7 +32,7 @@ test.beforeEach(async () => {

test.describe("Budget proposal 01 wallet", () => {
test.use({
storageState: ".auth/budgetProposal01.json",
storageState: budgetProposal01AuthFile,
wallet: budgetProposal01Wallet,
});

Expand Down Expand Up @@ -413,7 +419,7 @@ test.describe("Budget proposal 01 wallet", () => {

test("12C. Should save and view draft proposal", async ({ browser }) => {
const page = await createNewPageWithWallet(browser, {
storageState: ".auth/budgetProposal02.json",
storageState: budgetProposal02AuthFile,
wallet: budgetProposal02Wallet,
});

Expand Down Expand Up @@ -461,7 +467,7 @@ test("12C. Should save and view draft proposal", async ({ browser }) => {

test("12H. Should submit a valid budget proposal", async ({ browser }) => {
const page = await createNewPageWithWallet(browser, {
storageState: ".auth/budgetProposal03.json",
storageState: budgetProposal03AuthFile,
wallet: budgetProposal03Wallet,
});
const budgetSubmissionPage = new BudgetDiscussionSubmissionPage(page);
Expand All @@ -482,7 +488,7 @@ test("12I. Should submit a valid draft budget proposal", async ({
}) => {
test.slow();
const page = await createNewPageWithWallet(browser, {
storageState: ".auth/budgetProposal04.json",
storageState: budgetProposal04AuthFile,
wallet: budgetProposal04Wallet,
});

Expand Down
Loading