2017-08-28 10:02:20 +00:00
|
|
|
import asyncio
|
2018-01-26 11:07:09 +00:00
|
|
|
import logging
|
2018-01-03 09:34:40 +00:00
|
|
|
from datetime import datetime
|
2020-11-11 15:37:27 +00:00
|
|
|
import os
|
|
|
|
import json
|
2018-11-07 12:26:32 +00:00
|
|
|
from support.appium_container import AppiumContainer
|
2018-04-28 09:02:39 +00:00
|
|
|
from support.test_data import TestSuiteData
|
2023-03-26 18:56:29 +00:00
|
|
|
import functools
|
2018-04-28 09:02:39 +00:00
|
|
|
|
2022-04-01 04:44:31 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
|
2021-09-20 15:23:06 +00:00
|
|
|
async def start_threads(quantity: int, func: type, returns: dict, *args):
|
2017-08-28 10:02:20 +00:00
|
|
|
loop = asyncio.get_event_loop()
|
2023-02-02 11:16:34 +00:00
|
|
|
# from tests.conftest import sauce
|
|
|
|
# for _ in range(60):
|
|
|
|
# if 16 - len([job for job in sauce.jobs.get_user_jobs() if job['status'] == 'in progress']) < quantity:
|
|
|
|
# time.sleep(10)
|
2018-01-26 11:07:09 +00:00
|
|
|
for i in range(quantity):
|
|
|
|
returns[i] = loop.run_in_executor(None, func, *args)
|
|
|
|
for k in returns:
|
2021-09-20 15:23:06 +00:00
|
|
|
returns[k] = await returns[k]
|
2018-01-26 11:07:09 +00:00
|
|
|
return returns
|
|
|
|
|
|
|
|
|
2022-11-29 05:19:01 +00:00
|
|
|
async def run_in_parallel(funcs):
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
res = []
|
|
|
|
returns = []
|
|
|
|
for func in funcs:
|
|
|
|
try:
|
2023-03-26 18:56:29 +00:00
|
|
|
res.append(loop.run_in_executor(None, functools.partial(func[0], **func[1])))
|
2022-11-29 05:19:01 +00:00
|
|
|
except IndexError:
|
|
|
|
res.append(loop.run_in_executor(None, func[0]))
|
|
|
|
for k in res:
|
|
|
|
returns.append(await k)
|
|
|
|
return returns
|
|
|
|
|
|
|
|
|
2018-01-26 11:07:09 +00:00
|
|
|
def get_current_time():
|
|
|
|
return datetime.now().strftime('%-m%-d%-H%-M%-S')
|
|
|
|
|
|
|
|
|
2018-04-28 09:02:39 +00:00
|
|
|
def debug(text: str):
|
2018-08-13 12:09:53 +00:00
|
|
|
logging.debug(text)
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2021-04-30 09:31:39 +00:00
|
|
|
appium_root_project_path = os.path.join(os.sep.join(__file__.split(os.sep)[:-1]), '../')
|
|
|
|
|
2019-11-29 11:48:07 +00:00
|
|
|
pytest_config_global = dict()
|
2018-02-26 23:38:56 +00:00
|
|
|
test_suite_data = TestSuiteData()
|
2018-11-07 12:26:32 +00:00
|
|
|
appium_container = AppiumContainer()
|
2017-09-26 10:50:34 +00:00
|
|
|
|
2018-06-01 16:37:44 +00:00
|
|
|
common_password = 'qwerty'
|
2018-08-23 13:50:19 +00:00
|
|
|
unique_password = 'unique' + get_current_time()
|
2020-05-14 10:41:09 +00:00
|
|
|
pin = '121212'
|
|
|
|
puk = '000000000000'
|
|
|
|
pair_code= '000000'
|
2021-08-09 11:16:02 +00:00
|
|
|
background_service_message = 'Background service for notifications'
|
2018-07-19 09:57:45 +00:00
|
|
|
|
2020-02-24 11:30:45 +00:00
|
|
|
bootnode_address = "enode://a8a97f126f5e3a340cb4db28a1187c325290ec08b2c9a6b1f19845ac86c46f9fac2ba13328822590" \
|
|
|
|
"fd3de3acb09cc38b5a05272e583a2365ad1fa67f66c55b34@167.99.210.203:30404"
|
2022-07-17 12:37:46 +00:00
|
|
|
# referred to https://github.com/status-im/status-mobile/blob/develop/resources/config/fleets.json
|
2022-03-23 16:27:58 +00:00
|
|
|
mailserver_address = 'enode://b74859176c9751d314aeeffc26ec9f866a412752e7ddec91b19018a18e7cca8d637cfe2cedcb972f8eb64d81' \
|
2022-06-28 15:54:14 +00:00
|
|
|
'6fbd5b4e89c7e8c7fd7df8a1329fa43db80b0bfe@47.52.90.156:443'
|
2020-01-21 13:59:01 +00:00
|
|
|
staging_fleet = 'eth.staging'
|
|
|
|
prod_fleet = 'eth.prod'
|
2020-06-29 10:42:14 +00:00
|
|
|
# This fleet is used in the tests
|
|
|
|
used_fleet = staging_fleet
|
|
|
|
|
2020-01-21 13:59:01 +00:00
|
|
|
mailserver_ams = 'mail-01.do-ams3'
|
2020-07-06 13:04:39 +00:00
|
|
|
mailserver_hk = 'mail-01.ac-cn-hongkong-c'
|
2020-01-21 13:59:01 +00:00
|
|
|
mailserver_gc = 'mail-01.gc-us-central1-a'
|
2019-10-18 13:23:36 +00:00
|
|
|
|
2020-10-14 09:34:53 +00:00
|
|
|
test_dapp_web_url = "status-im.github.io/dapp"
|
2022-07-29 07:46:04 +00:00
|
|
|
test_dapp_url = 'https://simpledapp.status.im/'
|
|
|
|
test_dapp_name = 'simpledapp.status.im'
|
2020-08-14 16:05:41 +00:00
|
|
|
|
2023-01-09 13:46:24 +00:00
|
|
|
emojis = {'thumbs-up': 2, 'thumbs-down': 3, 'love': 1, 'laugh': 4, 'angry': 6, 'sad': 5}
|
2020-11-11 15:37:27 +00:00
|
|
|
|
2020-11-03 16:15:14 +00:00
|
|
|
|
2020-11-11 15:37:27 +00:00
|
|
|
with open(os.sep.join(__file__.split(os.sep)[:-1]) + '/../../../translations/en.json') as json_file:
|
|
|
|
transl = json.load(json_file)
|