e2e: updated tests with new communitites creation flow

This commit is contained in:
Yevheniia Berdnyk 2023-07-31 18:54:31 +03:00
parent 7ad378e9c8
commit e5b6378e15
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
6 changed files with 34 additions and 17 deletions

View File

@ -312,9 +312,9 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home = self.sign_in.create_user(username=self.username)
self.home.communities_tab.click_until_presence_of_element(self.home.plus_community_button)
self.community_name = self.home.get_random_chat_name()
self.channel_name = 'general'
self.community = self.home.create_community(name=self.community_name, description='test description')
self.community_name = "closed community"
self.channel_name = "cats"
self.community = self.home.create_community(community_type="closed")
self.home.get_chat(self.community_name, community=True).click()
self.community_view = self.home.get_community_view()
@ -538,9 +538,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
self.community_name = self.home_1.get_random_chat_name()
self.community_name = "open community"
self.channel_name = 'general'
self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False)
self.home_1.create_community(community_type="open")
self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(self.text_message)

View File

@ -161,9 +161,9 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
self.community_name = self.home_1.get_random_chat_name()
self.community_name = "open community"
self.channel_name = 'general'
self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False)
self.home_1.create_community(community_type="open")
self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(self.text_message)
@ -317,9 +317,9 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
community_name = 'commun_to_check_notif'
self.channel_name = self.home_1.get_random_chat_name()
self.home_1.create_community(name=community_name, description='community to test', require_approval=True)
community_name = 'closed community'
self.channel_name = "dogs"
self.home_1.create_community(community_type="closed")
self.home_1.reopen_app()
community_element = self.home_1.get_chat(community_name, community=True)
self.community_1.share_community(community_element, self.username_2)

View File

@ -313,7 +313,7 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase):
self.home.just_fyi('Create community chats')
community_name = 'test community'
community_description, community_pic = "test community description", 'sauce_logo.png'
self.home.create_community(community_name, community_description, set_image=True, file_name=community_pic)
self.home.create_community_e2e(community_name, community_description, set_image=True, file_name=community_pic)
self.home.home_button.double_click()
self.home.just_fyi('Add ENS-user to contacts')

View File

@ -38,7 +38,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.channel_after_sync, self.message_after_sync = 'chann-after-sync', 'sent after sync'
self.device_1.just_fyi('Create community, create group chat, edit user picture')
self.comm_before_1 = self.home_1.create_community(self.comm_before_sync_name)
self.comm_before_1 = self.home_1.create_community_e2e(self.comm_before_sync_name)
self.channel_before_1 = self.comm_before_1.add_channel(self.channel)
self.channel_before_1.send_message(self.message)
self.home_1.home_button.double_click()
@ -260,7 +260,7 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def test_pairing_sync_community_add_new(self):
self.device_3.put_app_to_background_and_back()
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_1.create_community(self.comm_after_sync_name)
self.home_1.create_community_e2e(self.comm_after_sync_name)
if not self.home_2.element_by_text(self.comm_after_sync_name).is_element_displayed(30):
self.errors.append('Added community was not appeared after initial sync')
self.errors.append("Leaving community was not synced!")

View File

@ -281,8 +281,8 @@ class TestProfileGapsCommunityMediumMultipleDevicesMerged(MultipleSharedDeviceTe
community_name, channel_name = "some name", "first_channel"
community_description, community_pic = "something in community", 'sauce_logo.png'
message, message_member = "message", "from member"
community_1 = self.home_1.create_community(community_name, community_description, set_image=True,
file_name=community_pic)
community_1 = self.home_1.create_community_e2e(community_name, community_description, set_image=True,
file_name=community_pic)
channel_1 = community_1.add_channel(channel_name)
channel_1.send_message(message)
self.home_1.home_button.double_click()

View File

@ -2,6 +2,7 @@ import time
from appium.webdriver.common.mobileby import MobileBy
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from typing_extensions import Literal
from tests import test_dapp_url
from views.base_element import Button, Text, BaseElement, SilentButton, CheckBox, EditBox
@ -235,6 +236,10 @@ class HomeView(BaseView):
self.my_profile_on_start_new_chat_button = Button(self.driver,
xpath="//*[@content-desc='current-account-photo']")
self.communities_button = ChatButton(self.driver, accessibility_id="create-community")
self.create_closed_community_button = ChatButton(self.driver, accessibility_id="create-closed-community")
self.create_open_community_button = ChatButton(self.driver, accessibility_id="create-open-community")
self.create_token_gated_community_button = ChatButton(self.driver,
accessibility_id="create-token-gated-community")
self.ens_banner_close_button = Button(self.driver, accessibility_id=":ens-banner-close-button")
# Notification centre
@ -425,8 +430,8 @@ class HomeView(BaseView):
chat.profile_add_to_contacts_button.click()
self.click_system_back_button_until_element_is_shown()
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png',
require_approval=True):
def create_community_e2e(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png',
require_approval=True):
self.driver.info("## Creating community '%s', set image is set to '%s'" % (name, str(set_image)), device=False)
self.plus_community_button.click()
chat_view = self.communities_button.click()
@ -448,6 +453,18 @@ class HomeView(BaseView):
self.driver.info("## Community is created successfully!", device=False)
return self.get_community_view()
def create_community(self, community_type: Literal["open", "closed", "token-gated"]):
self.driver.info("## Creating %s community" % community_type)
self.plus_community_button.click()
if community_type == "open":
self.create_open_community_button.click()
elif community_type == "closed":
self.create_closed_community_button.click()
elif community_type == "token-gated":
self.create_token_gated_community_button.click()
else:
raise ValueError("Incorrect community type is set")
def import_community(self, key):
self.driver.info("## Importing community")
import_button = Button(self.driver, translation_id="import")