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
50 changes: 50 additions & 0 deletions .github/workflows/faucet_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Faucet Tests

on:
push:
branches: [main]
workflow_dispatch:

jobs:
faucet-test:
runs-on: ubuntu-latest
timeout-minutes: 15

strategy:
max-parallel: 1
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Setup npm version 10
run: |
npm i -g npm@10 --registry=https://registry.npmjs.org

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-deps-${{ matrix.node-version }}-

- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci

- name: Build
run: npm run build

- name: Run Faucet Tests
run: npm run test:faucet
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ Breaking down the command:
* `--entrypoint bash rippleci/rippled:develop` manually overrides the entrypoint (for the latest version of rippled on the `develop` branch)
* `-c 'rippled -a'` provides the bash command to start `rippled` in standalone mode from the manual entrypoint

### Faucet Tests

Faucet tests are designed to ensure the functionality of account funding and other interactions that require a funded wallet, typically by interacting with a Faucet service. These tests are crucial for verifying real-world scenarios where new accounts need to be activated on the XRP Ledger.

To run Faucet tests locally, you'll first need to ensure your development environment is set up and the project is built. Faucet tests do not require a locally running `rippled` instance to execute.

From the root directory of xrpl.js, run the following commands:

```bash
npm install
npm run build
npm run test:faucet
```

### Browser Tests

There are two ways to run browser tests.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test": "lerna run test --stream",
"test:browser": "lerna run test:browser --stream",
"test:integration": "lerna run test:integration --stream",
"test:faucet": "lerna run test:faucet --stream",
"lint": "lerna run lint --stream",
"clean": "lerna run clean --stream",
"build": "lerna run build --stream",
Expand Down
13 changes: 13 additions & 0 deletions packages/xrpl/jest.config.faucet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest configuration for faucet tests
const base = require('../../jest.config.base.js')

module.exports = {
...base,
roots: [...base.roots, '<rootDir>/test'],
testTimeout: 60000, // Longer timeout for faucet tests
testMatch: [
'<rootDir>/test/faucet/**/*.test.ts',
'<rootDir>/test/faucet/*.test.ts',
],
displayName: 'xrpl.js-faucet',
}
3 changes: 2 additions & 1 deletion packages/xrpl/jest.config.integration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest configuration for api
// Jest configuration for integration tests (local rippled only)
const base = require('../../jest.config.base.js')

module.exports = {
Expand All @@ -9,5 +9,6 @@ module.exports = {
'<rootDir>/test/integration/**/*.test.ts',
'<rootDir>/test/integration/*.test.ts',
],
testPathIgnorePatterns: ['<rootDir>/test/faucet/'],
displayName: 'xrpl.js',
}
1 change: 1 addition & 0 deletions packages/xrpl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"prepublish": "run-s clean build",
"test": "jest --config=jest.config.unit.js --verbose false --silent=false",
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json jest --config=jest.config.integration.js --verbose false --silent=false --runInBand",
"test:faucet": "jest --config jest.config.faucet.js",
"test:browser": "npm run build && npm run build:browserTests && karma start ./karma.config.js",
"test:watch": "jest --watch --config=jest.config.unit.js --verbose false --silent=false",
"format": "prettier --write '{src,test}/**/*.ts'",
Expand Down
Loading