Skip to content

Commit ff69a55

Browse files
committed
Attempt to fix problematic airnode-admin e2e test
1 parent fae06c7 commit ff69a55

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

packages/airnode-admin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"cli": "ts-node bin/admin.ts",
1717
"compile": "tsc --build tsconfig.json",
1818
"pack": "yarn pack",
19-
"test:e2e": "jest --selectProjects e2e",
19+
"test:e2e": "jest --selectProjects e2e --runInBand",
2020
"test:e2e:update-snapshot": "yarn test:e2e --updateSnapshot",
2121
"test:e2e:watch": "yarn test:e2e --watch",
2222
"test": "SILENCE_LOGGER=true jest --selectProjects unit",

packages/airnode-admin/test/e2e/cli.feature.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ it('has disabled DEBUG_COMMANDS flag', () => {
2525
});
2626

2727
describe('CLI', () => {
28-
jest.setTimeout(45_000);
28+
jest.setTimeout(300_000);
2929

3030
let provider: ethers.providers.StaticJsonRpcProvider;
3131
let deployer: ethers.providers.JsonRpcSigner;
@@ -333,7 +333,6 @@ Template data:
333333
describe('withdrawal', () => {
334334
let sponsor: ethers.Wallet;
335335
let sponsorWallet: ethers.Wallet;
336-
const sponsorBalance = () => sponsor.getBalance();
337336

338337
beforeEach(async () => {
339338
// Prepare for derivation of designated wallet - see test for designated wallet derivation for details
@@ -371,13 +370,25 @@ Template data:
371370

372371
expect(checkWithdrawalStatus()).toBe('Withdrawal request is not fulfilled yet');
373372

374-
const balanceBefore = await sponsorBalance();
373+
const balanceBefore = await sponsor.getBalance();
375374
airnodeRrp = airnodeRrp.connect(sponsorWallet);
376-
await admin.fulfillWithdrawal(airnodeRrp, withdrawalRequestId, airnodeWallet.address, sponsor.address, '0.8');
377-
expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');
378-
expect((await sponsorBalance()).toString()).toBe(
379-
balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString()
375+
376+
const fulfillResult = await admin.fulfillWithdrawal(
377+
airnodeRrp,
378+
withdrawalRequestId,
379+
airnodeWallet.address,
380+
sponsor.address,
381+
'0.8'
380382
);
383+
expect(fulfillResult).not.toBeNull();
384+
385+
expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');
386+
387+
// Create a fresh provider instance to avoid stale connection issues in CI
388+
const freshProvider = new ethers.providers.StaticJsonRpcProvider(PROVIDER_URL);
389+
const balanceAfter = await freshProvider.getBalance(sponsor.address);
390+
391+
expect(balanceAfter.toString()).toBe(balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString());
381392
});
382393
});
383394

0 commit comments

Comments
 (0)