e2e: xfail mark

This commit is contained in:
Churikova Tetiana 2022-06-14 16:02:48 +02:00
parent 2325f6f59e
commit a141c75634
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
18 changed files with 223 additions and 29 deletions

View File

@ -4,6 +4,7 @@ import hmac
import os
from hashlib import md5
from sauceclient import SauceException
import re
from support.test_data import SingleTestData
@ -42,7 +43,10 @@ class BaseTestReport:
if geth:
geth_paths = self.save_geth(geth)
else:
geth_paths = test.geth_paths
if hasattr(test, 'geth_paths'):
geth_paths = test.geth_paths
else:
geth_paths = ''
file_path = self.get_test_report_file_path(test.name)
test_dict = {
'testrail_case_id': test.testrail_case_id,
@ -67,7 +71,8 @@ class BaseTestReport:
steps=testrun_data['steps'],
jobs=testrun_data['jobs'],
error=testrun_data['error'],
first_commands=testrun_data['first_commands']))
first_commands=testrun_data['first_commands'],
xfail=testrun_data['xfail']))
tests.append(SingleTestData(name=test_data['name'],
geth_paths=test_data['geth_paths'],
testruns=testruns,
@ -120,4 +125,16 @@ class BaseTestReport:
@staticmethod
def is_test_successful(test):
# Test passed if last testrun has passed
return test.testruns[-1].error is None
return test.testruns[-1].error is None
@staticmethod
def separate_xfail_error(error):
issue_id_list = re.findall(r'#\d+', error)
main_error, no_code_error_str, issue_id = error, '', ''
if issue_id_list:
issue_id = issue_id_list[0]
xfail_error = re.findall(r'\[\[.*\]\]', error)
if xfail_error:
no_code_error_str = xfail_error[0]
main_error = error.replace(no_code_error_str, '')
return (main_error, no_code_error_str, issue_id)

View File

@ -1,6 +1,7 @@
import os
from support.base_test_report import BaseTestReport
from support.testrail_report import TestrailReport
import re
class GithubHtmlReport(BaseTestReport):
@ -109,6 +110,7 @@ class GithubHtmlReport(BaseTestReport):
for step in last_testrun.steps:
test_steps_html.append("<div>%s</div>" % step)
if last_testrun.error:
error = last_testrun.error[:255]
if test_steps_html:
html += "<p>"
html += "<blockquote>"
@ -116,7 +118,12 @@ class GithubHtmlReport(BaseTestReport):
html += "%s" % ''.join(test_steps_html[-2:])
html += "</blockquote>"
html += "</p>"
html += "<code>%s</code>" % last_testrun.error[:255]
(code_error, no_code_error_str, issue_id) = self.separate_xfail_error(error)
if no_code_error_str:
html += "<code>%s</code>" % code_error
html += no_code_error_str
else:
html += "<code>%s</code>" % error
html += "<br/><br/>"
if test.group_name:
html += "<p><b>Class: %s</b></p>" % test.group_name

View File

@ -10,14 +10,15 @@ class SingleTestData(object):
self.group_name = grop_name
class TestRunData(object):
def __init__(self, steps, jobs, error, first_commands: Dict[str, int]):
def __init__(self, steps, jobs, error, first_commands: Dict[str, int], xfail):
self.steps = steps
self.jobs = jobs
self.error = error
self.first_commands = first_commands
self.xfail = xfail
def create_new_testrun(self):
self.testruns.append(SingleTestData.TestRunData(list(), dict(), None, dict()))
self.testruns.append(SingleTestData.TestRunData(list(), dict(), None, dict(), xfail=''))
class TestSuiteData(object):

View File

@ -182,7 +182,14 @@ class TestrailReport(BaseTestReport):
if test.group_name:
comment += "# Class: %s \n" % test.group_name
if last_testrun.error:
comment += '%s' % ('# Error: \n %s \n' % emoji.demojize(last_testrun.error)) + devices + test_steps
full_error = last_testrun.error
(code_error, no_code_error_str, issue_id) = self.separate_xfail_error(full_error)
if issue_id:
test_rail_xfail = self.make_error_with_gh_issue_link(no_code_error_str, issue_id)
error = "%s %s" % (code_error, test_rail_xfail)
else:
error = full_error
comment += '%s' % ('# Error: \n %s \n' % emoji.demojize(error)) + devices + test_steps
else:
comment += devices + test_steps
data.append(
@ -246,7 +253,13 @@ class TestrailReport(BaseTestReport):
case_title += '-------\n'
case_title += "## %s) ID %s: [%s](%s) \n" % (
i + 1, test.testrail_case_id, test.name, test_rail_link)
error = "```%s```\n" % last_testrun.error[:255]
full_error = last_testrun.error[:255]
(code_error, no_code_error_str, issue_id) = self.separate_xfail_error(full_error)
if issue_id:
test_rail_xfail = self.make_error_with_gh_issue_link(no_code_error_str, issue_id)
error = "```%s```\n %s \n" % (code_error, test_rail_xfail)
else:
error = "```%s```\n" % full_error
for job_id, f in last_testrun.jobs.items():
if last_testrun.first_commands:
job_url = self.get_sauce_job_url(job_id=job_id,
@ -289,3 +302,8 @@ class TestrailReport(BaseTestReport):
def get_not_executed_tests(self, test_run_id):
results = self.get("get_tests/%s&status_id=3" % test_run_id)
return [result['case_id'] for result in results["tests"]]
@staticmethod
def make_error_with_gh_issue_link(error, issue_id):
return error.replace(issue_id, '[%s](https://github.com/status-im/status-react/issues/%s)' % (issue_id, issue_id[1:]))

View File

@ -302,7 +302,7 @@ def create_shared_drivers(quantity):
else:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
capabilities = {'maxDuration': 2700}
capabilities = {'maxDuration': 3600}
drivers = loop.run_until_complete(start_threads(quantity,
Driver,
drivers,

View File

@ -216,23 +216,50 @@ def should_save_device_stats(config):
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if "xdist_group" in item.keywords._markers and report.when == "setup" and report.failed:
test_suite_data.current_test.group_name = item.instance.__class__.__name__
def catch_error():
error = report.longreprtext
exception = re.findall('E.*Message:|E.*Error:|E.*Failed:', error)
failure_pattern = 'E.*Message:|E.*Error:|E.*Failed:'
exception = re.findall(failure_pattern, error)
if exception:
error = error.replace(re.findall('E.*Message:|E.*Error:|E.*Failed:', report.longreprtext)[0], '')
test_suite_data.current_test.testruns[-1].error = "Test setup failed: \n" + error
github_report.save_test(test_suite_data.current_test)
error = error.replace(re.findall(failure_pattern, report.longreprtext)[0], '')
return error
if report.when == 'setup':
error_intro, error = 'Test setup failed:', ''
final_error = '%s %s' % (error_intro, error)
if hasattr(report, 'wasxfail'):
if '[NOTRUN]' in report.wasxfail:
test_suite_data.set_current_test(item.name, testrail_case_id=get_testrail_case_id(item))
test_suite_data.current_test.create_new_testrun()
if "xdist_group" in item.keywords._markers:
test_suite_data.current_test.group_name = item.instance.__class__.__name__
error_intro, error = 'Test is not run, e2e blocker ', report.wasxfail
final_error = "%s [[%s]]" % (error_intro, error)
else:
if "xdist_group" in item.keywords._markers:
test_suite_data.current_test.group_name = item.instance.__class__.__name__
error = catch_error()
final_error = '%s %s [[%s]]' % (error_intro, error, report.wasxfail)
else:
if "xdist_group" in item.keywords._markers and report.failed:
test_suite_data.current_test.group_name = item.instance.__class__.__name__
error = catch_error()
final_error = '%s %s' % (error_intro, error)
if error:
test_suite_data.current_test.testruns[-1].error = final_error
github_report.save_test(test_suite_data.current_test)
if report.when == 'call':
is_sauce_env = item.config.getoption('env') == 'sauce'
current_test = test_suite_data.current_test
error = catch_error()
if report.failed:
error = report.longreprtext
exception = re.findall('E.*Message:|E.*Error:|E.*Failed:', error)
if exception:
error = error.replace(re.findall('E.*Message:|E.*Error:|E.*Failed:', report.longreprtext)[0], '')
current_test.testruns[-1].error = error
if hasattr(report, 'wasxfail'):
current_test.testruns[-1].xfail = report.wasxfail
if error:
current_test.testruns[-1].error = '%s [[%s]]' % (error, report.wasxfail)
if is_sauce_env:
update_sauce_jobs(current_test.name, current_test.testruns[-1].jobs, report.passed)
if item.config.getoption('docker'):

View File

@ -849,6 +849,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.errors.verify_no_errors()
@marks.testrail_id(702188)
@marks.xfail(reason="flaky; issue when sometimes history is not fetched from offline for public chat, needs investigation")
def test_cellular_settings_on_off_public_chat_fetching_history(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat'
@ -1132,6 +1133,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.home_1.just_fyi('Install free sticker pack and use it in 1-1 chat on Ropsten')
self.home_1.get_chat(self.ens).click()
self.chat_1.install_sticker_pack_by_name('Status Cat')
self.chat_1.chat_message_input.clear()
self.chat_1.sticker_icon.click()
if not self.chat_1.sticker_message.is_element_displayed():
self.errors.append('Sticker was not sent')

View File

@ -77,6 +77,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(700731)
@marks.xfail(reason="test may fail as sometimes message 'Hey admin' is not delivered; needs investigation")
def test_group_chat_join_send_text_messages_push(self):
message_to_admin = self.message_to_admin
[self.homes[i].home_button.double_click() for i in range(3)]
@ -123,6 +124,7 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(3998)
@marks.xfail(reason="mysterious issue when PNs are not fetched from offline, can not reproduce on real devices; needs investigation")
def test_group_chat_offline_pn(self):
[self.homes[i].home_button.double_click() for i in range(3)]
chat_name = 'for_offline_pn'

View File

@ -253,6 +253,7 @@ class TestWalletManagementDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(700762)
@marks.xfail(reason="flaky; on e2e builds when switching on rinkeby sometimes no collectibles")
def test_wallet_add_account_seed_phrase_collectibles_rinkeby_set_as_profile_image(self):
user = wallet_users['E']
self.wallet.driver.set_network_connection(6)

View File

@ -8,3 +8,4 @@ medium = pytest.mark.medium
flaky = pytest.mark.flaky
upgrade = pytest.mark.upgrade
skip = pytest.mark.skip
xfail = pytest.mark.xfail

View File

@ -161,7 +161,7 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Device1 joins Group chat 3")
group_chat_1 = self.home_1.get_chat(self.group_chat_name_3).click()
group_chat_1.join_chat_button.click()
group_chat_1.join_chat_button.click_if_shown()
group_chat_1.home_button.double_click()
self.home_2.just_fyi("Device2 mentions Device1 in Group chat 3")

View File

@ -315,7 +315,7 @@ class TestChatMediumMultipleDevice(MultipleSharedDeviceTestCase):
cls.new_group_chat_name = "GroupChat after rename"
cls.group_chat_1 = cls.home_1.create_group_chat(user_names_to_add=[cls.default_username_2], group_chat_name=cls.initial_group_chat_name)
cls.group_chat_2 = cls.home_2.get_chat(cls.initial_group_chat_name).click()
cls.group_chat_2.join_chat_button.click()
cls.group_chat_2.join_chat_button.click_if_shown()
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.home_1.just_fyi("Creating public chats")
@ -329,6 +329,7 @@ class TestChatMediumMultipleDevice(MultipleSharedDeviceTestCase):
cls.message_1, cls.message_2, cls.message_3, cls.message_4 = "Message1", "Message2", "Message3", "Message4"
@marks.testrail_id(702066)
@marks.xfail(reason="may fail on setup with remote disconnected error, needs investigation")
def test_chat_1_1_push_and_reaction_for_messages_sticker_audio_image(self):
# methods with steps to use later in loop
@ -631,7 +632,7 @@ class TestChatMediumMultipleDevice(MultipleSharedDeviceTestCase):
chat_1.home_button.click()
chat_1 = self.home_1.create_group_chat([full_ens], group_name)
chat_2 = self.home_2.get_chat(group_name).click()
chat_2.join_chat_button.click()
chat_2.join_chat_button.click_if_shown()
self.home_1.just_fyi('Check ENS and in group chat and suggestions list')
chat_1.element_by_text_part(full_ens).wait_for_visibility_of_element(60)
@ -842,6 +843,7 @@ class TestChatKeycardMentionsMediumMultipleDevice(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702295)
@marks.xfail(reason="mysterious issue when PNs are not fetched from offline, can not reproduce on real devices; needs investigation")
def test_keycard_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline_opened_from_push(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_1.get_chat(self.sender['username']).click()

View File

@ -37,6 +37,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
cls.channel_before_1.send_message(cls.message)
cls.home_1.home_button.double_click()
cls.device_3.put_app_to_background_and_back()
cls.device_2.put_app_to_background_and_back()
cls.device_1.just_fyi('Edit profile picture')
cls.home_1.profile_button.double_click()
@ -45,11 +46,10 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
cls.device_1.just_fyi('Add contact, start group chat')
cls.home_1.home_button.click()
cls.home_1.add_contact(cls.public_key_3)
cls.device_2.put_app_to_background_and_back()
cls.home_1.get_back_to_home_view()
cls.chat_1 = cls.home_1.create_group_chat([cls.username_3], cls.group_chat_name)
cls.chat_3 = cls.home_3.get_chat(cls.group_chat_name).click()
cls.chat_3.join_chat_button.click()
cls.chat_3.join_chat_button.click_if_shown()
cls.device_2.just_fyi("(secondary device): restore same multiaccount on another device")
cls.home_2 = cls.device_2.recover_access(passphrase=' '.join(cls.recovery_phrase.values()))
@ -67,6 +67,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
[device.home_button.double_click() for device in (cls.profile_1, cls.profile_2, cls.device_3)]
@marks.testrail_id(702269)
@marks.xfail(reason="too long setup, can fail with Remote end closed connection")
def test_pairing_sync_initial_community_send_message(self):
# Pricture sync is not implemented yet
self.device_2.just_fyi('check that created/joined community and profile details are updated')

View File

@ -1,8 +1,12 @@
import pytest
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from datetime import datetime
from tests.users import basic_user
import time
import base64
class TestPerformance(SingleDeviceTestCase):
@ -63,3 +67,92 @@ class TestPerformance(SingleDeviceTestCase):
"time between submitting a password and successful login is '%s' seconds, while baseline is '%s'!"
% (time_to_login, baseline_login))
self.errors.verify_no_errors()
@marks.skip
def test_genarate_db(self):
sign_in = SignInView(self.driver)
receiver = '0x0467d6ea67b28e017a33aa5d2dd627ce42180f9727e4fb33c8ac813cc9c2d2bf557ba245d70077c06ef31efe5cbb773244ee5fcc1ec89d2eab1b4922ec09babdbe'
sender_passphrase = 'high design enjoy small coconut notable corn quantum blind dish green glow'
home = sign_in.recover_access(sender_passphrase)
profile = home.profile_button.click()
profile.advanced_button.click()
profile.fleet_setting_button.click()
changed_fleet = 'eth.prod'
profile.element_by_text(changed_fleet).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
sign_in.sign_in()
long_message = '4096 Comunidade das Nações[1][2][3][4] (em inglês: Commonwealth of Nations, ou simplesmente ' \
'the Commonwealth[5] , "a Comunidade"), originalmente criada como Comunidade Britânica de Nações ' \
'(em inglês: British Commonwealth of Nations),[6] é uma organização intergovernamental composta por ' \
'53 países membros independentes. Todas as nações membros da organização, com exceção de Moçambique ' \
'(antiga colónia do Império Português) e Ruanda (antiga colónia dos impérios Alemão e Belga), faziam ' \
'parte do Império Britânico, do qual se separaram.[7] Os Estados-membros cooperam num quadro ' \
'de valores e objetivos comuns, conforme descrito na Declaração de Singapura. Estes incluem ' \
'a promoção da democracia, direitos humanos, boa governança, Estado de Direito, liberdade ' \
'individual, igualitarismo, livre comércio, multilateralismo e a paz mundial.[8] A ' \
'Commonwealth não é uma união política, mas uma organização intergovernamental através da qual' \
' os países com diversas origens sociais, políticas e econômicas são considerados como iguais' \
' em status. As atividades da Commonwealth são realizadas através do permanente Secretariado ' \
'da Commonwealth, chefiado pelo Secretário-Geral, e por reuniões bienais entre os Chefes de ' \
'Governo da Commonwealth. O símbolo da sua associação livre é o chefe da Commonwealth, que é ' \
'uma posição cerimonial atualmente ocupada pela rainha Isabel II. Isabel II é também a monarca, ' \
'separada e independentemente, de 16 membros da Commonwealth, que são conhecidos como os ' \
'"reinos da Commonwealth". A Commonwealth é um fórum para uma série de organizações não ' \
'governamentais, conhecidas coletivamente como a "família da Commonwealth", promovidas através ' \
'da intergovernamental Fundação Commonwealth. Os Jogos da Commonwealth, a atividade mais visível ' \
'da organização, são um produto de uma dessas entidades. Estas organizações fortalecem a cultura ' \
'compartilhada da Commonwealth, que se estende através do esporte comum, patrimônio literário e ' \
'práticas políticas e jurídicas. Devido a isso, os países da Commonwealth não são considerados ' \
'"estrangeiros" uns aos outros. Refletindo esta missão, missões diplomáticas entre os países da ' \
'Commonwealth são designadas como Altas Comissões, em vez de embaixadas. Índice Os primeiros-ministros' \
' de cinco membros da Commonwealth de 1944 em uma Conferência da Commonwealth Em 1884, ao visitar' \
' a Austrália, Lord Rosebery descreveu que o Império Britânico estava a mudar, após algumas de suas ' \
'colónias tornaram-se mais independentes.[9] As conferências dos britânicos e das suas colónias ' \
'ocorriam periodicamente, desde a primeiro em 1887, levando à criação das conferências imperiais em ' \
'1911.[10] A proposta concreta foi apresentada por Jan Christian Smuts em 1917 quando ele cunhou o termo ' \
'"Comunidade Britânica das Nações", e previu o "futuro das relações constitucionais e reajustes ' \
'no Império Britânico".[11] Smuts argumentou com sucesso que o império deve ser representado ' \
'na Conferência de Versalhes por delegados das colónias, assim como a Grã-Bretanha.[12][13]' \
' Na Declaração de Balfour na Conferência Imperial de 1926, a Grã-Bretanha e os seus domínios ' \
'concordaram que eles eram "iguais em status, em que ninguém os subordinava em qualquer aspecto ' \
'de seus assuntos internos ou externos, embora unidos pela fidelidade comum à Coroa, e livremente ' \
'associados como membros da Comunidade Britânica de Nações". Estes aspectos da relação foram ' \
'finalmente formalizada pelo Estatuto de Westminster em 1931. O estatuto foi aplicado ao Canadá ' \
'sem a necessidade de ratificação, entretanto, a Austrália, Nova Zelândia, e Terra Nova tinham que ' \
'ratificar o estatuto para que ela tivesse efeito. A atual província canadiana da Terra Nova ' \
'(Newfoundland) nunca retificou o estatuto, e em 16 de fevereiro de 1934, com o consentimento ' \
'do seu parlamento, o governo de Newfoundland voluntariamente deixou a organização. Newfoundland, ' \
'então, mais tarde tornou-se a décima província do Canadá, em 1949.[14] Austrália ratientão, mais tarde ' \
'tornou-se a décima província do Canadá, em 1949.[14] Austrália rati então, mais tarde tornou-se a décima' \
' província do Canadá, '
gh_link_message = 'https://github.com/status-im/status-react/issues'
gif = 'https://media.giphy.com/media/7GYHmjk6vlqY8/giphy.gif'
long_arabic_text = 'لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب ا' \
'لشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر' \
' عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل ال' \
'منال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي.'
text_emoji = '😀 😃 😄 😁 😆 😅 😂 🤣 🥲 ☺️ 😊 😇 🙂 🙃 😉 😌 😍 🥰 😘 😗 😙 😚 😋 😛 😝 😜 🤪 🤨 🧐 🤓 😎 🥸 ' \
'🤩 🥳 😏 😒 😞 😔 😟 😕 🙁 ☹️ 😣 😖 😫 😩 🥺 😢 😭 😤 😠 😡 🤬 🤯 😳 🥵 🥶 😱 😨 😰 😥 😓 🤗 🤔 ' \
'🤭 🤫 🤥 😶 😐 😑 😬 🙄 😯 😦 😧 😮 😲 🥱 😴 🤤 😪 😵 🤐 🥴 🤢 🤮 🤧 😷 🤒 🤕 🤑 🤠 😈 👿 👹 👺 ' \
'🤡 💩 👻 💀 ☠️ 👽 👾 🤖 🎃 😺 😸 😹 😻 😼 😽 🙀 😿 😾'
emoji = '😺'
chinese_text = '吉伊杰杰勒! 艾 诶开 艾艾勒开 西吉艾艾诶.... 娜勒开伊哦吉艾艾弗 诶比勒屁哦 西吉艾艾伊'
base_message = text_emoji
chat = home.add_contact(receiver)
base_message = long_arabic_text
for n in range(14116, 16500):
self.driver.info('Sending %s message' % str(n))
chat.send_message('%s message \n'
'with several \n'
'lines' % str(n))
if (n/100).is_integer():
chat.send_message("**Another 100 messages are sent**")
if (n/500).is_integer():
chat.send_message("__IT IS ALREADY %s IN THIS CHAT__" % str(n))
chat.send_message("Below are 1000 emoji cats")
base_message = emoji
for n in range(6000, 7000):
self.driver.info('Sending %s message' % str(n))
chat.send_message('%s' % base_message)
chat.send_message("Wohooo 7200 messages!")

View File

@ -17,7 +17,7 @@ class TestTranslations(NoDeviceTestCase):
with open(os.path.join(directory, 'translations/en.json'), 'r') as f:
data = set(json.load(f).keys())
result = []
paths = ['src/status_im', 'components/src']
paths = ['src/status_im', 'components/src', 'src']
for root, dirs, files in chain.from_iterable(os.walk(os.path.join(directory, path)) for path in paths):
dirs[:] = [d for d in dirs if d not in ['test', 'translations']]
for file in [file for file in files if file.endswith('.cljs')]:

View File

@ -349,7 +349,7 @@ class BaseView(object):
def click_system_back_button_until_element_is_shown(self, attempts=3, element='home'):
counter = 0
if element is 'home':
if element == 'home':
element = self.home_button
while not element.is_element_present(1) and counter <= attempts:
try:

View File

@ -153,7 +153,7 @@ class SendTransactionView(BaseView):
if self.element_by_text_part('Transaction failed').is_element_displayed():
self.driver.fail('Transaction failed')
self.driver.info("## Transaction is signed!", device=False)
self.ok_button.click()
self.ok_button.click_until_absense_of_element(self.ok_button)
return error_text
@staticmethod

View File

@ -3,7 +3,8 @@ import os
from tests import common_password, appium_root_project_path
from views.base_element import Button, EditBox, Text
from views.base_view import BaseView
import base64
from tests.base_test_case import AbstractTestCase
class MultiAccountButton(Button):
class Username(Text):
@ -262,7 +263,6 @@ class SignInView(BaseView):
self.sign_in()
def import_db(self, seed_phrase, import_db_folder_name, password=common_password):
from tests.base_test_case import AbstractTestCase
self.driver.info('## Importing database', device=False)
import_file_name = 'export.db'
home = self.recover_access(passphrase=seed_phrase, password=password)
@ -282,3 +282,25 @@ class SignInView(BaseView):
self.home_button.wait_for_element(40)
self.driver.info('## Importing database is finished!', device=False)
return self.get_home_view()
def export_db(self, seed_phrase, file_to_export='export.db', password=common_password):
self.driver.info('## Export database', device=False)
home = self.recover_access(passphrase=seed_phrase, password=password)
profile = home.profile_button.click()
full_path_to_file = os.path.join(appium_root_project_path, 'views/dbs/%s' % file_to_export)
profile.logout()
self.multi_account_on_login_button.wait_for_visibility_of_element(30)
self.get_multiaccount_by_position(1).click()
self.password_input.set_value(common_password)
self.options_button.click()
self.element_by_text('Export unencrypted').wait_and_click(40)
self.element_by_text('Export unencrypted').wait_for_invisibility_of_element(40)
file_base_64 = self.driver.pull_file('%s/export.db' % AbstractTestCase().app_path)
try:
with open(full_path_to_file, "wb") as f:
f.write(base64.b64decode(file_base_64))
except Exception as e:
print(str(e))
self.driver.info('## Exporting database is finished!', device=False)