Skip to content

Commit

Permalink
e2e: update libs for Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
churik committed Sep 5, 2022
1 parent ccd26dc commit 7e94f53
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
13 changes: 7 additions & 6 deletions test/appium/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
aiohttp==3.8.0
aiohttp==3.8.1
allpairspy==2.5.0
apipkg==1.5
Appium-Python-Client==1.0.2
PyGithub==1.55
async-timeout==4.0.1
certifi==2020.11.8
chardet==3.0.4
cycler==0.10.0
cytoolz==0.11.0
cytoolz==0.12.0
emoji==0.5.0
eth-hash==0.3.2
eth-keys==0.3.3
eth-keys
eth-utils==1.10.0
ethereum==2.3.2
execnet==1.7.1
Expand All @@ -21,7 +22,7 @@ lxml==4.6.5
matplotlib==3.3.3
multidict==5.0.2
namedlist==1.8
numpy==1.19.4
numpy==1.23.0
pbkdf2==1.3
Pillow==8.1.0
py==1.10.0
Expand All @@ -30,7 +31,7 @@ pycryptodome==3.9.9
pyethash==0.1.27
pyparsing==2.4.7
pysha3==1.0.2
pytest==6.2.0
pytest==6.2.5
pytest-forked==1.3.0
pytest-xdist==2.5.0
python-dateutil==2.8.1
Expand All @@ -47,5 +48,5 @@ urllib3==1.26.3
yarl==1.6.3
docker==4.4.0
influxdb==5.3.1
web3==5.25.0
web3==5.30.0
imagehash
29 changes: 19 additions & 10 deletions test/appium/support/api/network_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,25 @@ def get_latest_block_number(self) -> int:
method = self.network_url + 'module=proxy&action=eth_blockNumber'
return int(requests.request('GET', url=method).json()['result'], 0)

def find_transaction_by_hash(self,transaction_hash: str):
transaction = w3.transaction_status(transaction_hash)
if not transaction['blockHash']:
self.log("TX %s is still pending" %transaction_hash)
def find_transaction_by_hash(self, transaction_hash: str):
method = self.network_url + 'module=transaction&action=gettxreceiptstatus&txhash=%s&apikey=%s' % (
transaction_hash, self.api_key)
try:
transactions_response = requests.request('GET', url=method, headers=self.headers).json()
if transactions_response:
result = True
if transactions_response['result']['status'] == '1':
self.log("TX %s is found and confirmed: " % transaction_hash)
elif transactions_response['result']['status'] == '0':
self.log("TX %s is found and failed: " % transaction_hash)
else:
result = False
self.log("TX %s is not found!" % transaction_hash)
return result
except TypeError as e:
self.log("Check response from etherscan API. Returned values do not match expected. %s" % str(e))
except JSONDecodeError as e:
self.log("No valid JSON response from Etherscan: %s " % str(e))

def find_transaction_by_unique_amount(self, address, amount, token=False, decimals=18, wait_time=300):
additional_info = 'token transactions' if token else 'ETH transactions'
Expand Down Expand Up @@ -104,12 +119,6 @@ def find_transaction_by_unique_amount(self, address, amount, token=False, decima
for transaction in transactions:
if float(int(transaction['value']) / 10 ** decimals) == float(amount):
self.log("Tx is found: %s (etherscan API)" % transaction['hash'])
try:
w3.transaction_status(transaction['hash'])
self.log("Tx is found (web3 API)")
except TransactionNotFound:
self.log("Tx is not found (web3 API)")
continue
return transaction
except TypeError as e:
self.log("Failed iterate transactions(Etherscan unexpected error): " + str(e))
Expand Down

0 comments on commit 7e94f53

Please sign in to comment.