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
73 changes: 69 additions & 4 deletions tests/govtool-frontend/playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,76 @@ npx playwright install

---

## 🔧 Faucet wallet Configuration

This section guides you through generating a Cardano faucet wallet and configuring it for use. Follow the steps below to create and set the config on env

### Step 1: Generate a Faucet Wallet

Run the following command to generate a new faucet wallet:

```bash
npm run generate-faucet-wallet
```

The script will:

- Display the wallet details (payment private key, stake public key hash, and wallet address) in the terminal.

**Example Output:**

```
🎉 Wallet generated successfully!
-----------------------------------
🔑 Payment Private Key: <your-payment-private-key>
🔗 Stake Public Key Hash: <your-stake-pkh>
🏠 Wallet Address: <your-wallet-address>
-----------------------------------

📋 Please copy the following to your environment variables:
1. Set FAUCET_PAYMENT_PRIVATE=<your-payment-private-key>
2. Set FAUCET_STAKE_PKH=<your-stake-pkh>
3. Set FAUCET_ADDRESS=<your-wallet-address>

🎈 All set! Please ensure this wallet is funded with a sufficient balance
```

### Step 2: Configure Environment Variables

Securely store the generated wallet details in your environment variables. Add the following to your `.env` file or environment configuration:

```env
FAUCET_PAYMENT_PRIVATE=<your-payment-private-key>
FAUCET_STAKE_PKH=<your-stake-pkh>
FAUCET_ADDRESS=<your-wallet-address>
```

⚠️ **Security Note**: Store your wallet details in a secure location for future use. The payment private key is sensitive and must be protected to prevent unauthorized access to your funds.

### Step 3: Fund the Wallet

Ensure the wallet address has sufficient funds for your test runs. The required balance depends on the specific tests you plan to execute (refer to the test-specific test run details below).

To check the wallet balance, visit:

```
https://${network}.cardanoscan.io/address/<your-wallet-address>
```

Replace `${network}` with the appropriate Cardano network (e.g.`preprod`, or `preview`) and `<your-wallet-address>` with the generated address.

**Example**:

- For a preview wallet: `https://preview.cardanoscan.io/address/<your-wallet-address>`
- Monitor the balance to ensure it meets the requirements for individual or all test runs.

---

## 🧪 Running Tests

### 🔑 Generate Test Wallets

Before each test run, generate fresh test wallets to avoid conflicts:
Before each test run, generate test wallets required for wallet-dependent tests:

```bash
npm run generate-wallets
Expand Down Expand Up @@ -115,7 +180,7 @@ Each test suite can be run in **UI** or **Headless** mode.

---

#### 1. **Delegation Pillars**
#### 1. **Delegation Pillar**

- **Pre-requisite**: Ensure the faucet address holds at least **12,000 ADA**.

Expand All @@ -133,7 +198,7 @@ npm run test:headless:delegation-pillar

---

#### 2. **Voting Pillars**
#### 2. **Voting Pillar**

- **Pre-requisite**: Ensure the faucet address holds at least **12,000 ADA**.

Expand Down Expand Up @@ -167,7 +232,7 @@ npm run test:headless:outcomes

---

#### 4. **Proposal Pillars**
#### 4. **Proposal Pillar**

_Includes both Proposal Discussion and Budget Discussion_

Expand Down
32 changes: 32 additions & 0 deletions tests/govtool-frontend/playwright/generate_faucet_wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ShelleyWallet } from "./lib/helpers/crypto";

(async () => {
try {
console.log("\nGenerating your wallet... 🔐");
const wallet = await ShelleyWallet.generate();
const walletJson = wallet.json();

// Display wallet details
console.log("\n🎉 Wallet generated successfully!");
console.log("-----------------------------------");
console.log("💼 Wallet:", walletJson);
console.log(`🔑 Payment Private Key: ${walletJson.payment.private}`);
console.log(`🔗 Stake Public Key Hash: ${walletJson.stake.pkh}`);
console.log(`🏠 Wallet Address: ${walletJson.address}`);
console.log("-----------------------------------");

// Instructions for environment variables
console.log(
"\n📋 Please copy the following to your environment variables:"
);
console.log(`1. Set FAUCET_PAYMENT_PRIVATE=${walletJson.payment.private}`);
console.log(`2. Set FAUCET_STAKE_PKH=${walletJson.stake.pkh}`);
console.log(`3. Set FAUCET_ADDRESS=${walletJson.address}`);

console.log(
"\n🎈 All set! Please ensure this wallet is funded with a sufficient balance"
);
} catch (error) {
console.error("\n❌ An error occurred:", error.message);
}
})();
3 changes: 2 additions & 1 deletion tests/govtool-frontend/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"test:headless:usersnap": "npx playwright test userSnap.spec.ts",
"test:headless:misc": "npx playwright test miscellaneous",
"format": "prettier . --write",
"generate-wallets": "ts-node ./generate_wallets.ts 23"
"generate-wallets": "ts-node ./generate_wallets.ts 23",
"generate-faucet-wallet": "ts-node ./generate_faucet_wallet.ts"
},
"dependencies": {
"@cardanoapi/cardano-test-wallet": "^3.3.1",
Expand Down