e2e: update ci and made first group

This commit is contained in:
Churikova Tetiana 2021-12-29 17:10:22 +01:00
parent 44b8a4c0f4
commit 3499cdc123
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
10 changed files with 138 additions and 157 deletions

View File

@ -3,15 +3,15 @@ pipeline {
agent { label 'linux' }
parameters {
string(
name: 'NETWORK',
description: 'Name of test network to use.',
defaultValue: 'ropsten',
)
string(
name: 'APK_NAME',
description: 'Filename of APK uploaded to SauceLabs.',
)
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '',
)
}
options {
@ -56,8 +56,8 @@ pipeline {
--rerun_count=2 \
--testrail_report=True \
-m testrail_id \
-m "not upgrade" \
--network=${params.NETWORK} \
-m \"not upgrade\" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_NAME}
"""
}

View File

@ -8,15 +8,10 @@ pipeline {
description: 'Name of the branch to checkout and build.',
defaultValue: 'develop',
)
string(
name: 'NETWORK',
description: 'Name of test network to use.',
defaultValue: 'ropsten',
)
string(
name: 'TEST_MARKERS',
description: 'Marker expression for matching tests to run.',
defaultValue: 'critical or high',
defaultValue: '',
)
string(
name: 'APK_NAME',
@ -26,9 +21,14 @@ pipeline {
name: 'PR_ID',
description: 'ID of the Pull Request triggering this build.',
)
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '',
)
string(
name: 'TR_CASE_IDS',
description: 'IDs of the TestRail case, separated by a comma. (Optional)',
description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '',
)
}
@ -91,8 +91,8 @@ pipeline {
--numprocesses 15 \
--rerun_count=2 \
--testrail_report=True \
-m "${params.TEST_MARKERS}" \
--network=${params.NETWORK} \
-m \"${params.TEST_MARKERS}\" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_NAME} \
--build=PR-${params.PR_ID} \
--pr_number=${params.PR_ID} \

View File

@ -3,11 +3,6 @@ pipeline {
agent { label 'linux' }
parameters {
string(
name: 'NETWORK',
description: 'Name of test network to use',
defaultValue: 'ropsten',
)
string(
name: 'APK_NAME',
description: 'Filename of APK uploaded to SauceLabs (base for upgrade, usually release build)',
@ -16,6 +11,16 @@ pipeline {
name: 'APK_NAME_UPGRADE',
description: 'Filename of APK of upgraded application (installed on top of base)',
)
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
defaultValue: '',
)
string(
name: 'TR_CASE_IDS',
description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '',
)
}
options {
@ -32,7 +37,12 @@ pipeline {
} }
}
stage('Test') {
steps {
steps { script {
/* for managing optional arguments */
def extraPytestOpts = ''
if (params.TR_CASE_IDS != '') {
extraPytestOpts = "--run_testrail_ids='${params.TR_CASE_IDS}'"
}
withCredentials([
usernamePassword(
credentialsId: 'test-rail-api',
@ -56,18 +66,19 @@ pipeline {
dir('test/appium/tests') {
sh """
python3 -m pytest \
-m upgrade \
-m "upgrade" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--numprocesses 15 \
--rerun_count=2 \
--testrail_report=True \
--network=${params.NETWORK} \
--apk=${params.APK_NAME} \
--apk_upgrade=${params.APK_NAME_UPGRADE}
--apk_upgrade=${params.APK_NAME_UPGRADE} \
${extraPytestOpts}
"""
}
}
}
}
} }
}
post {

View File

@ -97,10 +97,11 @@ class TestrailReport(BaseTestReport):
def get_regression_cases(self):
test_cases = dict()
test_cases['critical'] = 734
test_cases['high'] = 735
test_cases['critical'] = 730
test_cases['medium'] = 736
test_cases['upgrade'] = 881
test_cases['public_chat'] = 50654
test_cases['one_to_one_chat'] = 50655
case_ids = list()
for arg in argv:
if "run_testrail_ids" in arg:
@ -108,7 +109,7 @@ class TestrailReport(BaseTestReport):
case_ids = value.split(',')
if len(case_ids) == 0:
if 'critical or high' in argv:
for case in self.get_cases([test_cases['critical'], test_cases['high']]):
for case in self.get_cases([test_cases['critical'], test_cases['public_chat'], test_cases['one_to_one_chat']]):
case_ids.append(case['id'])
elif 'upgrade' in argv and 'not upgrade' not in argv:
for case in self.get_cases([test_cases['upgrade']]):

View File

@ -45,7 +45,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_2 = home_2.get_chat(sender['username']).click()
receiver_message = chat_2.get_incoming_transaction(account_name)
timestamp_sender = sender_message.timestamp_message.text
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed():
self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
@ -68,7 +68,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
send_bottom_sheet = sender_message.sign_and_send.click()
send_bottom_sheet.next_button.click()
send_bottom_sheet.sign_transaction()
updated_timestamp_sender = sender_message.timestamp_message.text
updated_timestamp_sender = sender_message.timestamp_command_message.text
if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction")
chat_1.wallet_button.click()

View File

@ -40,7 +40,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_2 = home_2.get_chat(sender['username']).click()
receiver_message = chat_2.get_incoming_transaction()
timestamp_sender = sender_message.timestamp_message.text
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed():
self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
@ -63,7 +63,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
send_message = sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
updated_timestamp_sender = sender_message.timestamp_message.text
updated_timestamp_sender = sender_message.timestamp_command_message.text
if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction")

View File

@ -9,7 +9,6 @@ from dateutil import parser
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, create_shared_drivers, \
MultipleSharedDeviceTestCase
from views.home_view import HomeView
from views.sign_in_view import SignInView
@ -20,106 +19,102 @@ class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
device_1, device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
profile_1 = home_1.profile_button.click()
cls.home_1, cls.home_2 = device_1.create_user(), device_2.create_user()
profile_1 = cls.home_1.profile_button.click()
cls.username_1 = profile_1.default_username_text.text
profile_1.home_button.click()
home_2.home_button.click()
cls.home_2.home_button.click()
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1, cls.chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat(cls.public_chat_name)
@marks.testrail_id(5313)
@marks.critical
@marks.skip
#TODO: should be updated after https://github.com/status-im/status-react/issues/12936
def test_public_chat_messaging_emojis_timestamps(self):
home_1, home_2 = HomeView(self.drivers[0]), HomeView(self.drivers[1])
home_1.just_fyi("Check preselected chats, redirect to status chat")
home_1.plus_button.click_until_presence_of_element(home_1.join_public_chat_button)
home_1.join_public_chat_button.click()
preselected_chats = ['#status', '#chitchat', '#defi', '#crypto', '#markets', '#dap-ps']
for chat in preselected_chats:
if not home_1.element_by_text(chat).is_element_displayed():
self.errors.append("'%s' text is not in the list of preselected chats" % chat)
home_1.element_by_text(preselected_chats[0]).click()
status_chat = home_1.get_chat_view()
if not status_chat.user_name_text != preselected_chats[0]:
self.errors.append('No redirect to chat if tap on #status chat')
status_chat.home_button.click()
def test_public_chat_text_timestamps_while_on_different_tab(self):
message = 'hello'
self.chat_2.dapp_tab_button.click()
self.chat_1.send_message(message)
sent_time_variants = self.chat_1.convert_device_time_to_chat_timestamp()
timestamp = self.chat_1.chat_element_by_text(message).timestamp_on_tap
if timestamp not in sent_time_variants:
self.errors.append("Timestamp is not shown, expected: '%s', in fact: '%s'" % (sent_time_variants.join(','), timestamp))
self.chat_2.home_button.click(desired_view='chat')
for chat in self.chat_1, self.chat_2:
chat.verify_message_is_under_today_text(message, self.errors)
if self.chat_2.chat_element_by_text(message).username.text != self.username_1:
self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1)
self.errors.verify_no_errors()
public_chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name)
home_1.just_fyi("Check sending text messages, emojis, usernames and timestamps on messages")
@marks.testrail_id(700719)
@marks.critical
def test_public_emoji(self):
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
message, emoji_message = 'hello', emoji.emojize(emoji_name)
chat_1.send_message(message)
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 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 != self.username_1:
self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1)
chat_1.send_message(emoji_message)
for chat in chat_1, chat_2:
if not chat.chat_element_by_text(emoji_unicode).is_element_displayed():
emoji_message = emoji.emojize(emoji_name)
self.chat_1.send_message(emoji_message)
for chat in self.chat_1, self.chat_2:
if not chat.chat_element_by_text(emoji_unicode).is_element_displayed(30):
self.errors.append('Message with emoji was not sent or received in public chat')
self.chat_1.just_fyi("Can copy and paste emojis")
self.chat_1.element_by_text_part(emoji_unicode).long_press_element()
self.chat_1.element_by_text('Copy').click()
self.chat_1.chat_message_input.paste_text_from_clipboard()
if self.chat_1.chat_message_input.text != emoji_unicode:
self.errors.append('Emoji message was not copied')
self.chat_1.just_fyi("Can reply to emojis")
self.chat_2.quote_message(emoji_unicode)
message_text = 'test message'
self.chat_2.chat_message_input.send_keys(message_text)
self.chat_2.send_message_button.click()
chat_element_1 = self.chat_1.chat_element_by_text(message_text)
if not chat_element_1.is_element_displayed(sec=10) or chat_element_1.replied_message_text != emoji_unicode:
self.errors.append('Reply message was not received by the sender')
self.errors.verify_no_errors()
@marks.testrail_id(5360)
@marks.critical
def test_unread_messages_counter_public_chat(self):
home_1, home_2 = HomeView(self.drivers[0]), HomeView(self.drivers[1])
home_1.get_back_to_home_view()
home_2.get_back_to_home_view()
home_1.home_button.click()
home_2.home_button.click()
chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
chat_1.send_message('пиу')
chat_1.home_button.click()
message, message_2 = 'test message', 'test message2'
chat_2.send_message(message)
home_1.just_fyi(
"Check unread message indicator on home, on chat element and that it is not shown after reading messages")
if not home_1.home_button.public_unread_messages.is_element_displayed():
def test_public_unread_messages_counter(self):
self.chat_1.send_message('пиу')
home_1 = self.chat_1.home_button.click()
message = 'test message'
self.chat_2.send_message(message)
if not self.chat_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat('#' + chat_name)
chat_element = home_1.get_chat('#' + self.public_chat_name)
if not chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is not shown in public chat')
self.errors.verify_no_errors()
home_1.just_fyi("Check unread message counter when mentioned in public chat")
chat_2 = home_2.get_chat_view()
chat_2.select_mention_from_suggestion_list(self.username_1, self.username_1[:2])
chat_2.send_message_button.click()
@marks.testrail_id(700718)
@marks.critical
def test_public_unread_messages_counter_for_mentions_relogin(self):
message = 'test message2'
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
chat_element = self.home_1.get_chat('#' + self.public_chat_name)
self.home_2.get_chat('#' + self.public_chat_name).click()
self.chat_2.select_mention_from_suggestion_list(self.username_1, self.username_1[:2])
self.chat_2.send_message_button.click()
chat_element.new_messages_counter.wait_for_element(30)
chat_element.new_messages_counter.wait_for_element_text("1", 60)
chat_element.click()
home_1.home_button.double_click()
if home_1.home_button.public_unread_messages.is_element_displayed():
self.home_1.home_button.double_click()
if self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is shown on Home button')
if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in public chat while there are no unread messages')
[home.get_chat('#' + chat_name).click() for home in (home_1, home_2)]
chat_1.send_message(message_2)
chat_2.chat_element_by_text(message_2).wait_for_element(20)
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
self.chat_1.send_message(message)
self.chat_2.chat_element_by_text(message).wait_for_element(20)
home_2.just_fyi("Check that unread message indicator is not reappeared after relogin")
self.chat_2.just_fyi("Check that unread messages counter doesn't reappear after relogin")
driver_2 = self.drivers[1]
driver_2.close_app()
driver_2.launch_app()
SignInView(driver_2).sign_in()
chat_element = home_2.get_chat('#' + chat_name)
chat_element = self.home_2.get_chat('#' + self.public_chat_name)
if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is shown after relogin')
self.drivers[0].fail('New messages counter is shown after relogin')
self.errors.verify_no_errors()
@ -154,45 +149,6 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6275)
@marks.medium
def test_receive_message_while_in_different_tab_and_emoji_messages_long_press(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
public_chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name)
device_2.just_fyi("Switch to different tab out from chat")
device_2.dapp_tab_button.click()
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
chat_1.chat_message_input.send_keys(emoji.emojize(emoji_name))
chat_1.send_message_button.click()
device_1.just_fyi("Long press emoji message actions")
chat_1.element_by_text_part(emoji_unicode).long_press_element()
chat_1.element_by_text('Copy').click()
chat_1.chat_message_input.paste_text_from_clipboard()
if chat_1.chat_message_input.text != emoji_unicode:
self.errors.append('Emoji message was not copied')
home_2.home_button.click(desired_view='chat')
chat_element_2 = chat_2.element_by_text_part(emoji_unicode)
if not chat_element_2.is_element_displayed(sec=10):
self.errors.append('Message with emoji was not received in public chat by the recipient')
chat_2.quote_message(emoji_unicode)
message_text = 'test message'
chat_2.chat_message_input.send_keys(message_text)
chat_2.send_message_button.click()
chat_element_1 = chat_1.chat_element_by_text(message_text)
if not chat_element_1.is_element_displayed(sec=10) or chat_element_1.replied_message_text != emoji_unicode:
self.errors.append('Reply message was not received by the sender')
self.errors.verify_no_errors()
@marks.testrail_id(6342)
@marks.medium
def test_different_status_in_timeline(self):

View File

@ -91,6 +91,20 @@ class BaseElement(object):
self.driver.info('Tap on found: %s' % self.name)
return self.navigate()
def click_until_presence_of_element(self, desired_element, attempts=4):
counter = 0
self.driver.info("Click until '%s' by '%s': `%s` will be presented" % (
desired_element.name, desired_element.by, desired_element.locator))
while not desired_element.is_element_present(1) and counter <= attempts:
try:
self.find_element().click()
desired_element.wait_for_element(5)
return self.navigate()
except (NoSuchElementException, TimeoutException):
counter += 1
else:
self.driver.info("%s element not found" % desired_element.name)
def double_click(self):
self.driver.info('Double tap on: %s' % self.name)
[self.find_element().click() for _ in range(2)]
@ -352,19 +366,6 @@ class Button(BaseElement):
self.wait_for_visibility_of_element(sec)
self.click()
def click_until_presence_of_element(self, desired_element, attempts=4):
counter = 0
self.driver.info("Click until '%s' by '%s': `%s` will be presented" % (
desired_element.name, desired_element.by, desired_element.locator))
while not desired_element.is_element_present(1) and counter <= attempts:
try:
self.find_element().click()
desired_element.wait_for_element(5)
return self.navigate()
except (NoSuchElementException, TimeoutException):
counter += 1
else:
self.driver.info("%s element not found" % desired_element.name)
def click_until_absense_of_element(self, desired_element, attempts=3):
counter = 0

View File

@ -84,6 +84,7 @@ class HomeButton(TabButton):
return self.navigate()
class DappTabButton(TabButton):
def __init__(self, driver):
super().__init__(driver, xpath="//*[contains(@content-desc,'tab, 2 out of 5')]")

View File

@ -143,7 +143,7 @@ class ChatElementByText(Text):
return ''
@property
def timestamp_message(self):
def timestamp_command_message(self):
class TimeStampText(Button):
def __init__(self, driver, parent_locator: str):
@ -151,6 +151,17 @@ class ChatElementByText(Text):
return TimeStampText(self.driver, self.locator)
@property
def timestamp_on_tap(self):
timestamp_element = Text(self.driver, xpath="//*[@content-desc='message-timestamp']")
try:
self.sent_status_checkmark.wait_for_element(30)
except NoSuchElementException:
return ''
self.sent_status_checkmark.click_until_presence_of_element(timestamp_element)
return timestamp_element.text
@property
def member_photo(self):
class MemberPhoto(Button):