e2e: making 2 tests independent

This commit is contained in:
Yevheniia Berdnyk 2023-11-03 15:34:33 +02:00
parent aa6d44bee1
commit f1de077d9d
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
4 changed files with 23 additions and 15 deletions

View File

@ -18,6 +18,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}),
(self.device_2.create_user, {'username': self.username_2}))))
self.device_2_users_number = 1
self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view()
self.public_key_1 = self.home_1.get_public_key()
@ -90,7 +91,8 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.profile_button.click()
self.profile_2.logout()
new_username = "new user"
self.device_2.create_user(second_user=True, username=new_username)
self.device_2.create_user(username=new_username, user_number=self.device_2_users_number)
self.device_2_users_number += 1
self.device_2.just_fyi('Device2 sends a contact request to Device1 via Paste button and check user details')
self.home_2.driver.set_clipboard_text(self.public_key_1)
@ -142,7 +144,8 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.profile_button.click()
self.profile_2.logout()
new_username_2 = "test user 123"
self.device_2.create_user(third_user=True, username=new_username_2)
self.device_2.create_user(username=new_username_2, user_number=self.device_2_users_number)
self.device_2_users_number += 1
self.device_2.just_fyi('Device2 sends a contact request to Device1 using his profile link')
self.home_2.driver.set_clipboard_text("https://status.app/u#" + self.public_key_1)

View File

@ -1049,7 +1049,9 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
def test_community_join_when_node_owner_offline(self):
for home in self.homes:
home.navigate_back_to_home_view()
self.home_2.jump_to_messages_home()
self.home_2.jump_to_communities_home()
if self.home_2.get_chat(self.community_name, community=True).is_element_displayed():
CommunityView(self.home_2.driver).leave_community(self.community_name)
self.home_1.jump_to_communities_home()
self.home_1.just_fyi("Device 1 creates open community")
@ -1062,6 +1064,7 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
self.device_1.driver.terminate_app(app_package)
self.home_2.just_fyi("Device 2 requests to join the community")
self.home_2.jump_to_messages_home()
self.home_2.get_chat(self.username_1).click()
self.chat_2.chat_element_by_text(community_name).view_community_button.click()
self.community_2.join_community(open_community=False)

View File

@ -448,11 +448,14 @@ class CommunityView(HomeView):
self.get_chat(name).click()
return chat_view
def leave_community(self):
self.driver.info("Leaving community")
self.community_options_button.wait_and_click()
self.community_info_button.wait_and_click()
self.leave_community_button.scroll_and_click()
def leave_community(self, community_name: str):
self.driver.info("Leaving %s" % community_name)
home = self.get_home_view()
home.communities_tab.click()
community_element = home.get_chat(community_name, community=True)
community_element.long_press_until_element_is_shown(self.leave_community_button)
self.leave_community_button.click()
self.leave_community_button.click()
def get_channel_avatar(self, channel_name='general'):
return Button(self.driver, xpath='//*[@text="# %s"]/../*[@content-desc="channel-avatar"]' % channel_name)
@ -502,7 +505,6 @@ class CommunityView(HomeView):
home = self.get_home_view()
home.communities_tab.click()
community_element = home.get_chat(community_name, community=True)
# community_element.long_press_until_element_is_shown(self.view_members_button)
community_element.long_press_until_element_is_shown(self.share_community_button)
self.share_community_button.click()
for user_name in user_names_to_share:

View File

@ -218,21 +218,21 @@ class SignInView(BaseView):
if set_image:
pass
def create_user(self, password=common_password, keycard=False, enable_notifications=False, second_user=False,
third_user=False, username="test user"):
def create_user(self, password=common_password, keycard=False, enable_notifications=False,
username="test user", user_number=0):
self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s', enable_notification: '%s')" %
(password, str(keycard), str(enable_notifications)), device=False)
if self.element_by_text('CONTINUE').is_element_displayed(5):
self.element_by_text('CONTINUE').click()
if second_user:
if user_number == 0:
self.i_m_new_in_status_button.click_until_presence_of_element(self.generate_keys_button)
elif user_number == 1:
self.show_profiles_button.wait_and_click(20)
self.plus_profiles_button.click()
self.create_new_profile_button.click()
elif third_user:
else:
self.plus_profiles_button.click()
self.create_new_profile_button.click()
else:
self.i_m_new_in_status_button.click_until_presence_of_element(self.generate_keys_button)
self.generate_keys_button.click_until_presence_of_element(self.profile_your_name_edit_box)
self.set_profile(username)
self.set_password(password)