e2e: several fixes
Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
parent
505171cf87
commit
f3c85c1e7a
|
@ -84,8 +84,8 @@ class NetworkApi(object):
|
|||
'Transaction with amount %s is not found in list of %s, address is %s during %ss' %
|
||||
(amount, additional_info, address, wait_time))
|
||||
else:
|
||||
counter += 10
|
||||
time.sleep(10)
|
||||
counter += 30
|
||||
time.sleep(30)
|
||||
try:
|
||||
if token:
|
||||
transactions = self.get_token_transactions(address)
|
||||
|
@ -100,7 +100,8 @@ class NetworkApi(object):
|
|||
return transaction
|
||||
except TypeError as e:
|
||||
self.log("Failed iterate transactions: " + str(e))
|
||||
continue
|
||||
pytest.fail("No valid JSON response from Etherscan: %s " % str(e))
|
||||
# continue
|
||||
|
||||
def wait_for_confirmation_of_transaction(self, address, amount, confirmations=12, token=False):
|
||||
start_time = time.time()
|
||||
|
|
|
@ -137,7 +137,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
for message in messages:
|
||||
device_1_chat.send_message(message)
|
||||
device_2_chat = device_2_home.get_chat(default_username_1).click()
|
||||
sent_time = device_1_chat.convert_device_time_to_chat_timestamp()
|
||||
sent_time_variants = device_1_chat.convert_device_time_to_chat_timestamp()
|
||||
for message in messages:
|
||||
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
|
||||
self.errors.append("Message with test '%s' was not received" % message)
|
||||
|
@ -150,8 +150,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
for chat in device_1_chat, device_2_chat:
|
||||
chat.verify_message_is_under_today_text(timestamp_message, self.errors)
|
||||
timestamp = chat.chat_element_by_text(timestamp_message).timestamp_message.text
|
||||
if timestamp != sent_time:
|
||||
self.errors.append("Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time, timestamp))
|
||||
if timestamp not in sent_time_variants:
|
||||
self.errors.append("Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(","), timestamp))
|
||||
|
||||
device_2_home.just_fyi("Add user to contact and verify his default username")
|
||||
device_2_chat.add_to_contacts.click()
|
||||
|
|
|
@ -42,12 +42,12 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
|
|||
message = 'hello'
|
||||
chat_1.send_message(message)
|
||||
|
||||
sent_time = chat_1.convert_device_time_to_chat_timestamp()
|
||||
sent_time_variants = chat_1.convert_device_time_to_chat_timestamp()
|
||||
for chat in chat_1, chat_2:
|
||||
chat.verify_message_is_under_today_text(message, self.errors)
|
||||
timestamp = chat.chat_element_by_text(message).timestamp_message.text
|
||||
if timestamp != sent_time:
|
||||
self.errors.append("Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time, timestamp))
|
||||
if timestamp not in sent_time_variants:
|
||||
self.errors.append("Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(','), timestamp))
|
||||
if chat_2.chat_element_by_text(message).username.text != default_username_1:
|
||||
self.errors.append("Default username '%s' is not shown next to the received message" % default_username_1)
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ class EnterQRcodeEditBox(EditBox):
|
|||
def scan_qr(self, value):
|
||||
self.set_value(value)
|
||||
base_view = BaseView(self.driver)
|
||||
base_view.ok_button.click_until_absense_of_element(base_view.element_by_translation_id("scan-qr"))
|
||||
base_view.ok_button.click()
|
||||
|
||||
def click(self):
|
||||
self.wait_for_element().click()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
import dateutil.parser
|
||||
import time
|
||||
|
||||
|
@ -11,6 +11,15 @@ from views.base_view import BaseView, ProgressBar
|
|||
from views.profile_view import ProfilePictureElement
|
||||
|
||||
|
||||
class CommandsButton(Button):
|
||||
def __init__(self, driver):
|
||||
super().__init__(driver, accessibility_id="show-extensions-icon")
|
||||
|
||||
def click(self):
|
||||
self.click_until_presence_of_element(SendCommand(self.driver))
|
||||
return self.navigate()
|
||||
|
||||
|
||||
class SendCommand(Button):
|
||||
def __init__(self, driver):
|
||||
super().__init__(driver, translation_id="send-transaction")
|
||||
|
@ -74,6 +83,7 @@ class ViewProfileButton(Button):
|
|||
def navigate(self):
|
||||
return ChatView(self.driver)
|
||||
|
||||
|
||||
class ChatOptionsButton(Button):
|
||||
def __init__(self, driver):
|
||||
super().__init__(driver, accessibility_id="chat-menu-button")
|
||||
|
@ -347,7 +357,7 @@ class ChatView(BaseView):
|
|||
self.cancel_reply_button = Button(self.driver, accessibility_id="cancel-message-reply")
|
||||
self.chat_item = Button(self.driver, accessibility_id="chat-item")
|
||||
self.chat_name_editbox = EditBox(self.driver, accessibility_id="chat-name-input")
|
||||
self.commands_button = Button(self.driver, accessibility_id="show-extensions-icon")
|
||||
self.commands_button = CommandsButton(self.driver)
|
||||
self.send_command = SendCommand(self.driver)
|
||||
self.request_command = RequestCommand(self.driver)
|
||||
|
||||
|
@ -614,11 +624,15 @@ class ChatView(BaseView):
|
|||
self.nickname_input_field.send_keys(nickname)
|
||||
self.element_by_text('Done').click()
|
||||
|
||||
def convert_device_time_to_chat_timestamp(self):
|
||||
def convert_device_time_to_chat_timestamp(self) -> list:
|
||||
sent_time_object = dateutil.parser.parse(self.driver.device_time)
|
||||
timestamp = datetime.strptime("%s:%s" % (sent_time_object.hour, sent_time_object.minute), '%H:%M').strftime("%I:%M %p")
|
||||
timestamp = timestamp[1:] if timestamp[0] == '0' else timestamp
|
||||
return timestamp
|
||||
timestamp_obj = datetime.strptime(timestamp, '%I:%M %p')
|
||||
possible_timestamps_obj = [timestamp_obj + timedelta(0,0,0,0,1), timestamp_obj, timestamp_obj - timedelta(0,0,0,0,1)]
|
||||
timestamps = list(map(lambda x : x.strftime("%I:%M %p"), possible_timestamps_obj))
|
||||
final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
|
||||
return final_timestamps
|
||||
|
||||
|
||||
def set_new_status(self, status='something is happening', image=False):
|
||||
self.driver.info("**Setting new status:%s, image set is: %s**" % (status, str(image)))
|
||||
|
|
Loading…
Reference in New Issue