chore: fix community channel tests in test mode
This commit is contained in:
parent
bce460abf8
commit
01382bd16e
|
@ -34,7 +34,7 @@ class CommunityScreen(QObject):
|
|||
def create_channel(self, name: str, description: str, emoji: str = None):
|
||||
self.left_panel.open_create_channel_popup().create(name, description, emoji)
|
||||
|
||||
@allure.step('Create channel')
|
||||
@allure.step('Edit channel')
|
||||
def edit_channel(self, channel, name: str, description: str, emoji: str = None):
|
||||
self.left_panel.select_channel(channel)
|
||||
self.tool_bar.open_edit_channel_popup().edit(name, description, emoji)
|
||||
|
@ -218,9 +218,9 @@ class LeftPanel(QObject):
|
|||
|
||||
@allure.step('Get channel params')
|
||||
def get_channel_parameters(self, name) -> UserChannel:
|
||||
for channal in self.channels:
|
||||
if channal.name == name:
|
||||
return channal
|
||||
for channel in self.channels:
|
||||
if channel.name == name:
|
||||
return channel
|
||||
raise LookupError(f'Channel not found in {self.channels}')
|
||||
|
||||
@allure.step('Open community settings')
|
||||
|
@ -243,10 +243,16 @@ class LeftPanel(QObject):
|
|||
raise LookupError('Channel not found')
|
||||
|
||||
@allure.step('Open create category popup')
|
||||
def open_create_category_popup(self) -> NewCategoryPopup:
|
||||
def open_create_category_popup(self, attempts: int = 2) -> NewCategoryPopup:
|
||||
self._channel_or_category_button.click()
|
||||
self._create_category_menu_item.click()
|
||||
return NewCategoryPopup().wait_until_appears()
|
||||
try:
|
||||
self._create_category_menu_item.click()
|
||||
return NewCategoryPopup().wait_until_appears()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_create_category_popup(attempts-1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
@allure.step('Open join community popup')
|
||||
def open_welcome_community_popup(self):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import time
|
||||
import typing
|
||||
|
||||
import allure
|
||||
|
@ -86,10 +87,16 @@ class OverviewView(QObject):
|
|||
return self._description_text_label.text
|
||||
|
||||
@allure.step('Open edit community view')
|
||||
def open_edit_community_view(self) -> 'EditCommunityView':
|
||||
def open_edit_community_view(self, attempts: int = 2) -> 'EditCommunityView':
|
||||
time.sleep(0.5)
|
||||
self._edit_button.click()
|
||||
return EditCommunityView().wait_until_appears()
|
||||
|
||||
try:
|
||||
return EditCommunityView()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_edit_community_view(attempts-1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
class EditCommunityView(QObject):
|
||||
|
||||
|
|
|
@ -39,9 +39,15 @@ class LeftPanel(QObject):
|
|||
return MessagingSettingsView()
|
||||
|
||||
@allure.step('Open communities settings')
|
||||
def open_communities_settings(self) -> 'CommunitiesSettingsView':
|
||||
def open_communities_settings(self, attempts: int = 2) -> 'CommunitiesSettingsView':
|
||||
self._open_settings('12-AppMenuItem')
|
||||
return CommunitiesSettingsView()
|
||||
try:
|
||||
return CommunitiesSettingsView()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_communities_settings(attempts-1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
@allure.step('Open wallet settings')
|
||||
def open_wallet_settings(self) -> WalletSettingsView:
|
||||
|
|
|
@ -29,6 +29,7 @@ class CommunitiesSettingsView(QObject):
|
|||
@property
|
||||
@allure.step('Get communities')
|
||||
def communities(self) -> typing.List[UserCommunityInfo]:
|
||||
time.sleep(0.5)
|
||||
_communities = []
|
||||
for obj in driver.findAllObjects(self._community_item.real_name):
|
||||
container = driver.objectMap.realName(obj)
|
||||
|
|
|
@ -32,10 +32,11 @@ def test_create_community_channel(main_screen: MainWindow, channel_name, channel
|
|||
[('Channel', 'Description', 'sunglasses', None, '#4360df')])
|
||||
def test_edit_community_channel(main_screen, channel_name, channel_description, channel_emoji, channel_emoji_image,
|
||||
channel_color):
|
||||
main_screen.create_community(constants.community_params)
|
||||
community_screen = CommunityScreen()
|
||||
with step('Create simple community'):
|
||||
main_screen.create_community(constants.community_params)
|
||||
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
||||
|
||||
with step('Verify General channel'):
|
||||
with step('Verify General channel is present for recently created community'):
|
||||
community_screen.verify_channel(
|
||||
'general',
|
||||
'General channel for the community',
|
||||
|
@ -43,14 +44,15 @@ def test_edit_community_channel(main_screen, channel_name, channel_description,
|
|||
channel_color
|
||||
)
|
||||
|
||||
community_screen.edit_channel('general', channel_name, channel_description, channel_emoji)
|
||||
with step('Edit general channel'):
|
||||
community_screen.edit_channel('general', channel_name, channel_description, channel_emoji)
|
||||
|
||||
with step('Channel is correct in channels list'):
|
||||
with step('Verify edited channel details are correct in channels list'):
|
||||
channel = community_screen.left_panel.get_channel_parameters(channel_name)
|
||||
assert channel.name == channel_name
|
||||
assert channel.selected
|
||||
|
||||
with step('Channel is correct in community toolbar'):
|
||||
with step('Verify edited channel details are correct in community toolbar'):
|
||||
assert community_screen.tool_bar.channel_name == channel_name
|
||||
assert community_screen.tool_bar.channel_description == channel_description
|
||||
assert community_screen.tool_bar.channel_emoji == '😎 '
|
||||
|
@ -60,10 +62,13 @@ def test_edit_community_channel(main_screen, channel_name, channel_description,
|
|||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703051', 'Delete community channel')
|
||||
@pytest.mark.case(703051)
|
||||
def test_delete_community_channel(main_screen):
|
||||
main_screen.create_community(constants.community_params)
|
||||
|
||||
with step('Create simple community'):
|
||||
main_screen.create_community(constants.community_params)
|
||||
community_screen = main_screen.left_panel.select_community(constants.community_params['name'])
|
||||
|
||||
with step('Delete channel'):
|
||||
CommunityScreen().delete_channel('general')
|
||||
community_screen.delete_channel('general')
|
||||
|
||||
with step('Verify channel is not exists'):
|
||||
assert not CommunityScreen().left_panel.channels
|
||||
assert not community_screen.left_panel.channels
|
||||
|
|
Loading…
Reference in New Issue