Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate e2e tests to use anvil testnet #1061

Merged
merged 3 commits into from
Apr 16, 2024
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
12 changes: 12 additions & 0 deletions docker/env.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ services:
build:
dockerfile: ./services/testnet/Dockerfile
context: .
healthcheck:
test: ["CMD", "curl", "http://testnet:8545"]
interval: 1s
timeout: 20s
retries: 20

graph-node-postgres:
image: postgres
Expand Down Expand Up @@ -30,6 +35,13 @@ services:
ipfs: 'ipfs:5001'
ethereum: "goerli:http://testnet:8545"
GRAPH_LOG: info
ETHEREUM_REORG_THRESHOLD: 1
ETHEREUM_ANCESTOR_COUNT: 1
healthcheck:
test: ["CMD", "curl", "http://graph-node:8020"]
interval: 5s
timeout: 60s
retries: 20

subgraph-deployer:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git clone -b feature/dependency-funding --single-branch https://github.com/radic

echo "📁 Creating subgraph config file for local env"
cd ./drips-subgraph
printf '{ "network": "goerli", "immutableSplitsDriver": { "address": "0xEC8493BdbBbBe22a6F54573cFeE23ac8Ab90dF77", "block": 1 }, "repoDriver": { "address": "0xb9C8e18E82687a564Ac4D26E22D28a4C95057CE9", "block": 1 }, "drips": { "address": "0xa0523b86472561f0859d84C094cc04e6c4B33169", "block": 1 }, "nftDriver": { "address": "0xc95eb214845d5693abc750692161CB008796ae5C", "block": 1 },"metaData": { "address": "0xC58cEa5a448A761d2dE80DFa8BfE298780e9dd66", "block": 1 } }' > config.json
printf '{ "network": "goerli", "immutableSplitsDriver": { "address": "0xEC8493BdbBbBe22a6F54573cFeE23ac8Ab90dF77", "block": 0 }, "repoDriver": { "address": "0xb9C8e18E82687a564Ac4D26E22D28a4C95057CE9", "block": 0 }, "drips": { "address": "0xa0523b86472561f0859d84C094cc04e6c4B33169", "block": 0 }, "nftDriver": { "address": "0xc95eb214845d5693abc750692161CB008796ae5C", "block": 0 },"metaData": { "address": "0xC58cEa5a448A761d2dE80DFa8BfE298780e9dd66", "block": 0 } }' > config.json
echo "🛠 Installing subgraph deps…"
npm install

Expand Down
4 changes: 0 additions & 4 deletions docker/services/subgraph-deployer/scripts/deploy-subgraph.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
set -euo pipefail

echo "Waiting for testnet to launch on 8545..."
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' testnet:8545)" != "404" ]]; do sleep 5; done'
echo "Testnet launched"

echo "Waiting for graph node to launch on 8020..."
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' graph-node:8020)" != "405" ]]; do sleep 5; done'
echo "graph node launched"
Expand Down
7 changes: 2 additions & 5 deletions docker/services/testnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM node:16
WORKDIR /app

RUN npm install -g ganache
FROM ghcr.io/foundry-rs/foundry:latest

COPY ./services/testnet/state state

CMD ["ganache", "--chain.chainId", "5", "--host", "0.0.0.0", "--database.dbPath", "/app/state", "--chain.allowUnlimitedInitCodeSize", "--wallet.seed", "1234"]
ENTRYPOINT anvil --chain-id 5 --state ./state --mnemonic "fame elevator saddle renew match guilt seat duck seven buyer true smoke" --host 0.0.0.0 --block-time 2
1 change: 1 addition & 0 deletions docker/services/testnet/state

Large diffs are not rendered by default.

Binary file removed docker/services/testnet/state/000005.ldb
Binary file not shown.
Binary file removed docker/services/testnet/state/000006.log
Binary file not shown.
1 change: 0 additions & 1 deletion docker/services/testnet/state/CURRENT

This file was deleted.

Empty file removed docker/services/testnet/state/LOCK
Empty file.
5 changes: 0 additions & 5 deletions docker/services/testnet/state/LOG

This file was deleted.

1 change: 0 additions & 1 deletion docker/services/testnet/state/LOG.old

This file was deleted.

Binary file removed docker/services/testnet/state/MANIFEST-000004
Binary file not shown.
28 changes: 14 additions & 14 deletions src/e2e-tests/top-up-create-stream.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ describe('app', async () => {

await page.type(
'label:has-text("Token contract address*")',
'0xefbF81372aBC3723463746a89CEb42080563684C',
'0x27aa1eEDF2F775e949f1D01d886400E5a019fe7B',
);

await page.locator('button', { hasText: 'Add custom token' }).click();
await page.locator('button', { hasText: 'Got it' }).click();
});

it('displays the custom mock erc-20 token', async () => {
// Testcoin item in the list-select component
// Test token item in the list-select component
const testcoin = page.locator(
'data-testid=item-0xefbF81372aBC3723463746a89CEb42080563684C',
'data-testid=item-0x27aa1eEDF2F775e949f1D01d886400E5a019fe7B',
); //
await testcoin.click();

const topUpButton = page.locator('text=Add Testcoin');
const topUpButton = page.locator('text=Add Test token');
await topUpButton.click();
});

Expand All @@ -124,10 +124,10 @@ describe('app', async () => {
});

it('shows the topped-up amount on the funds page', async () => {
await page.locator('text=Got it').click({ timeout: 10000 });
await page.locator('text=Got it').click({ timeout: 30000 });
await page.waitForTimeout(2000);
await page.reload();
}, 10000);
}, 50000);
});

describe('create stream flow', () => {
Expand All @@ -140,7 +140,7 @@ describe('app', async () => {
});

it('allows selecting the available outbound TEST balance', async () => {
await page.locator('.label:has-text("Testcoin")').click();
await page.locator('.label:has-text("Test token")').click();
});

it('allows submitting the create stream flow', async () => {
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('app', async () => {
});

it('displays the incoming balance', async () => {
await expect(page.locator('text=Testcoin')).toHaveCount(1);
await expect(page.locator('text=Test token')).toHaveCount(1);
});
});

Expand All @@ -186,7 +186,7 @@ describe('app', async () => {
});

it('displays the outgoing balance', async () => {
await expect(page.locator('text=Testcoin')).toHaveCount(1);
await expect(page.locator('text=Test token')).toHaveCount(1);
});

it('switches to recipient funds dashboard', async () => {
Expand All @@ -206,7 +206,7 @@ describe('app', async () => {
});

it('displays the incoming balance', async () => {
await expect(page.locator('text=Testcoin')).toHaveCount(1);
await expect(page.locator('text=Test token')).toHaveCount(1);
});
});

Expand All @@ -231,7 +231,7 @@ describe('app', async () => {
await page.keyboard.type('Test');

await expect(
page.locator('.account-menu-item-wrapper', { hasText: 'Testcoin' }),
page.locator('.account-menu-item-wrapper', { hasText: 'Test token' }),
).toHaveCount(1);

await page.keyboard.press('Escape');
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('app', async () => {
it('opens the collect flow', async () => {
await page.goto('http://127.0.0.1:3001/app/funds');

await page.locator('text=Testcoin').click();
await page.locator('text=Test token').click();
await page.locator('data-testid=token-page-collect-button').click();

await expect(page.locator('h1', { hasText: 'Collect TEST' })).toHaveCount(1);
Expand All @@ -416,7 +416,7 @@ describe('app', async () => {
await page.locator('button', { hasText: 'Got it' }).click();
});

it('shows an incoming balance of zero for Testcoin after squeezing', async () => {
it('shows an incoming balance of zero for Test token after squeezing', async () => {
await expect(page.locator('data-testid=incoming-balance')).toHaveText('0.00');
});
});
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('app', async () => {
});

it('selects the test token to stream', async () => {
await page.locator('data-testid=item-0xefbF81372aBC3723463746a89CEb42080563684C').click();
await page.locator('data-testid=item-0x27aa1eEDF2F775e949f1D01d886400E5a019fe7B').click();
});

it('enters a monthly stream rate', async () => {
Expand Down
Loading