Skip to content

Commit 539bb86

Browse files
authored
feat: stabalize e2e test workflow (#90)
* first pass stabalizing e2e test workflow * feedback * linting * feedback
1 parent 7511ab1 commit 539bb86

File tree

2 files changed

+22
-27
lines changed

2 files changed

+22
-27
lines changed

.github/workflows/e2e_tests.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ on: [pull_request]
55
jobs:
66
test:
77
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
python: ["3.10", "3.11", "3.12"]
11-
128
steps:
139
- uses: actions/checkout@v3
1410

15-
- name: Set up Python ${{ matrix.python }}
11+
- name: Set up Python 3.10
1612
uses: actions/setup-python@v4
1713
with:
18-
python-version: ${{ matrix.python }}
14+
python-version: '3.10'
1915

2016
- name: Install Poetry
2117
uses: snok/install-poetry@v1
@@ -29,7 +25,7 @@ jobs:
2925
uses: actions/cache@v3
3026
with:
3127
path: ./.venv
32-
key: venv-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('poetry.lock') }}
28+
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
3329

3430
- name: Install dependencies
3531
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

tests/test_e2e.py

+19-20
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,25 @@ def test_wallet_import(wallet_data):
7070
@pytest.mark.e2e
7171
def test_wallet_transfer(imported_wallet):
7272
"""Test wallet transfer."""
73-
try:
74-
imported_wallet.faucet().wait()
75-
except FaucetLimitReachedError:
76-
print("Faucet limit reached, continuing...")
77-
7873
destination_wallet = Wallet.create()
7974

80-
initial_source_balance = Decimal(str(imported_wallet.balances().get("eth", 0)))
81-
initial_dest_balance = Decimal(str(destination_wallet.balances().get("eth", 0)))
75+
initial_source_balance = imported_wallet.balance("eth")
76+
initial_dest_balance = destination_wallet.balance("eth")
77+
78+
if initial_source_balance < 0.0001:
79+
try:
80+
imported_wallet.faucet().wait()
81+
except FaucetLimitReachedError:
82+
print("Faucet limit reached, continuing...")
8283

8384
transfer = imported_wallet.transfer(
8485
amount=Decimal("0.000000001"), asset_id="eth", destination=destination_wallet
85-
)
86-
87-
transfer.wait()
88-
time.sleep(2)
86+
).wait()
8987

90-
assert transfer is not None
9188
assert transfer.status.value == "complete"
9289

93-
final_source_balance = Decimal(str(imported_wallet.balances().get("eth", 0)))
94-
final_dest_balance = Decimal(str(destination_wallet.balances().get("eth", 0)))
90+
final_source_balance = imported_wallet.balance("eth")
91+
final_dest_balance = destination_wallet.balance("eth")
9592

9693
assert final_source_balance < initial_source_balance
9794
assert final_dest_balance > initial_dest_balance
@@ -100,15 +97,17 @@ def test_wallet_transfer(imported_wallet):
10097
@pytest.mark.e2e
10198
def test_transaction_history(imported_wallet):
10299
"""Test transaction history retrieval."""
103-
try:
104-
imported_wallet.faucet().wait()
105-
except FaucetLimitReachedError:
106-
print("Faucet limit reached, continuing...")
107-
108100
destination_wallet = Wallet.create()
109101

102+
initial_source_balance = imported_wallet.balance("eth")
103+
if initial_source_balance < 0.0001:
104+
try:
105+
imported_wallet.faucet().wait()
106+
except FaucetLimitReachedError:
107+
print("Faucet limit reached, continuing...")
108+
110109
transfer = imported_wallet.transfer(
111-
amount=Decimal("0.0001"), asset_id="eth", destination=destination_wallet
110+
amount=Decimal("0.000000001"), asset_id="eth", destination=destination_wallet
112111
).wait()
113112

114113
time.sleep(10)

0 commit comments

Comments
 (0)