chore: combine tests for community screens to reduce total run time

This commit is contained in:
Anastasiya Semenkevich 2023-12-29 17:35:38 +03:00 committed by Anastasiya
parent 9ea888891c
commit 8321066a63
5 changed files with 102 additions and 123 deletions

View File

@ -44,28 +44,28 @@ class LeftPanel(QObject):
def open_overview(self) -> 'OverviewView':
if not self._overview_button.is_selected:
self._overview_button.click()
return OverviewView().wait_until_appears()
return OverviewView()
@allure.step('Open community members')
def open_members(self) -> 'MembersView':
if not self._members_button.is_selected:
self._members_button.click()
return MembersView().wait_until_appears()
return MembersView()
@allure.step('Open permissions')
def open_permissions(self) -> 'PermissionsIntroView':
self._permissions_button.click()
return PermissionsIntroView().wait_until_appears()
return PermissionsIntroView()
@allure.step('Open tokens')
def open_tokens(self) -> 'TokensView':
self._tokens_button.click()
return TokensView().wait_until_appears()
return TokensView()
@allure.step('Open airdrops')
def open_airdrops(self) -> 'AirdropsView':
self._airdrops_button.click()
return AirdropsView().wait_until_appears()
return AirdropsView()
class OverviewView(QObject):
@ -247,9 +247,9 @@ class TokensView(QObject):
self._mint_owner_token_button = Button('mint_Owner_Tokens_StatusButton')
@property
@allure.step('Get mint token button visibility state')
def is_mint_token_button_visible(self) -> bool:
return self._mint_token_button.is_visible
@allure.step('Get mint token button enable state')
def is_mint_token_button_present(self) -> bool:
return self._mint_token_button.exists
@property
@allure.step('Get tokens welcome image path')
@ -303,9 +303,9 @@ class AirdropsView(QObject):
self._mint_owner_token_button = Button('mint_Owner_token_Airdrops_StatusButton')
@property
@allure.step('Get new airdrop button visibility state')
def is_new_airdrop_button_visible(self) -> bool:
return self._new_airdrop_button.is_visible
@allure.step('Get new airdrop button enable state')
def is_new_airdrop_button_present(self) -> bool:
return self._new_airdrop_button.exists
@property
@allure.step('Get airdrops welcome image path')
@ -381,7 +381,12 @@ class PermissionsIntroView(QObject):
@allure.step('Click add new permission button')
def add_new_permission(self) -> 'PermissionsSettingsView':
self._add_new_permission_button.click()
return PermissionsSettingsView().wait_until_appears()
return PermissionsSettingsView()
@property
@allure.step('Is add new permission button visible')
def is_add_new_permission_button_present(self) -> bool:
return self._add_new_permission_button.exists
class PermissionsSettingsView(QObject):

View File

@ -1,42 +0,0 @@
import allure
import pytest
from allure_commons._allure import step
from . import marks
import constants
from constants.community_settings import AirdropsElements
from constants.images_paths import AIRDROPS_WELCOME_IMAGE_PATH
from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703200',
'Manage community: Manage Airdrops screen overview')
@pytest.mark.case(703200)
@pytest.mark.parametrize('params', [constants.community_params])
def test_airdrops_screen(main_screen: MainWindow, params):
with step('Create community'):
main_screen.create_community(params)
with step('Open airdrops view from community settings'):
community_screen = main_screen.left_panel.select_community(params['name'])
community_setting = community_screen.left_panel.open_community_settings()
airdrops_screen = community_setting.left_panel.open_airdrops()
with step('Verify all elements on airdrops screen'):
with step('New airdrop button is present'):
assert airdrops_screen.is_airdrops_owner_token_button_visible is True
with step('Airdrops welcome image source path is correct'):
assert AIRDROPS_WELCOME_IMAGE_PATH == airdrops_screen.airdrops_welcome_image_path
with step('Airdrops welcome title is correct'):
assert airdrops_screen.airdrops_welcome_title == AirdropsElements.WELCOME_TITLE.value
with step('Airdrops welcome subtitle is correct'):
assert airdrops_screen.airdrops_welcome_subtitle == AirdropsElements.WELCOME_SUBTITLE.value
with step('Airdrops welcome checklist is correct'):
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_1.value == airdrops_screen.airdrops_checklist[0]
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_2.value == airdrops_screen.airdrops_checklist[1]
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_3.value == airdrops_screen.airdrops_checklist[2]
with step('Airdrops infobox title and text are correct and button Mint Owner Token is visible'):
assert airdrops_screen.airdrops_infobox_title == AirdropsElements.INFOBOX_TITLE.value
assert airdrops_screen.airdrops_infobox_text == AirdropsElements.INFOBOX_TEXT.value
assert airdrops_screen.is_airdrops_owner_token_button_visible is True

View File

@ -14,31 +14,6 @@ from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703198',
'Manage community: Manage Permissions screen overview')
@pytest.mark.case(703198)
@pytest.mark.parametrize('params', [constants.community_params])
def test_permissions_screen_overview(main_screen: MainWindow, params):
main_screen.create_community(params)
with step('Open permissions in community settings'):
community_screen = main_screen.left_panel.select_community(params['name'])
community_setting = community_screen.left_panel.open_community_settings()
permissions_settings = community_setting.left_panel.open_permissions()
with step('Verify all elements on permissions screen'):
with step('Permission welcome image source path is correct'):
assert PERMISSION_WELCOME_IMAGE_PATH == permissions_settings.permission_welcome_image_source
with step('Permission welcome title is correct'):
assert permissions_settings.permission_welcome_title == PermissionsElements.WELCOME_TITLE.value
with step('Permission welcome subtitle is correct'):
assert permissions_settings.permission_welcome_subtitle == PermissionsElements.WELCOME_SUBTITLE.value
with step('Permission welcome checklist is correct'):
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_1.value == permissions_settings.permission_checklist[0]
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_2.value == permissions_settings.permission_checklist[1]
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_3.value == permissions_settings.permission_checklist[2]
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703632',
'Manage community: Adding new permissions')
@pytest.mark.case(703632)

View File

@ -0,0 +1,85 @@
import allure
import pytest
from allure_commons._allure import step
from . import marks
import constants
from constants.community_settings import AirdropsElements, TokensElements, PermissionsElements
from constants.images_paths import AIRDROPS_WELCOME_IMAGE_PATH, TOKENS_WELCOME_IMAGE_PATH, PERMISSION_WELCOME_IMAGE_PATH
from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703200',
'Manage community: Manage Airdrops screen overview')
@pytest.mark.case(703200)
@pytest.mark.parametrize('params', [constants.community_params])
def test_manage_community_screens_overview(main_screen: MainWindow, params):
with step('Create community'):
main_screen.create_community(params)
with step('Open airdrops view from community settings'):
community_screen = main_screen.left_panel.select_community(params['name'])
community_setting = community_screen.left_panel.open_community_settings()
airdrops_screen = community_setting.left_panel.open_airdrops()
with step('Verify all elements on airdrops screen'):
with step('Verify New Airdrop button is disabled'):
assert airdrops_screen.is_new_airdrop_button_present is True, \
f'New airdrop button should be disabled by default'
with step('Airdrops welcome image source path is correct'):
assert AIRDROPS_WELCOME_IMAGE_PATH == airdrops_screen.airdrops_welcome_image_path
with step('Airdrops welcome title is correct'):
assert airdrops_screen.airdrops_welcome_title == AirdropsElements.WELCOME_TITLE.value
with step('Airdrops welcome subtitle is correct'):
assert airdrops_screen.airdrops_welcome_subtitle == AirdropsElements.WELCOME_SUBTITLE.value
with step('Airdrops welcome checklist is correct'):
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_1.value == airdrops_screen.airdrops_checklist[0]
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_2.value == airdrops_screen.airdrops_checklist[1]
assert AirdropsElements.WELCOME_CHECKLIST_ELEMENT_3.value == airdrops_screen.airdrops_checklist[2]
with step('Airdrops infobox title and text are correct and button Mint Owner Token is visible'):
assert airdrops_screen.airdrops_infobox_title == AirdropsElements.INFOBOX_TITLE.value
assert airdrops_screen.airdrops_infobox_text == AirdropsElements.INFOBOX_TEXT.value
assert airdrops_screen.is_airdrops_owner_token_button_visible is True
with step('Open tokens view from community settings'):
tokens_screen = community_setting.left_panel.open_tokens()
with step('Verify all elements on tokens screen'):
with step('Verify Mint token button is disabled'):
assert tokens_screen.is_mint_token_button_present is True, \
f'Mint token button should be present'
with step('Tokens welcome image path is correct'):
assert TOKENS_WELCOME_IMAGE_PATH == tokens_screen.tokens_welcome_image_path
with step('Tokens welcome title is correct'):
assert tokens_screen.tokens_welcome_title == TokensElements.WELCOME_TITLE.value
with step('Tokens welcome subtitle is correct'):
assert tokens_screen.tokens_welcome_subtitle == TokensElements.WELCOME_SUBTITLE.value
with step('Tokens welcome checklist is correct'):
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_1.value == tokens_screen.tokens_checklist[0]
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_2.value == tokens_screen.tokens_checklist[1]
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_3.value == tokens_screen.tokens_checklist[2]
with step('Tokens infobox title and text are correct and button Mint Owner Token is visible'):
assert tokens_screen.tokens_infobox_title == TokensElements.INFOBOX_TITLE.value
assert tokens_screen.tokens_infobox_text == TokensElements.INFOBOX_TEXT.value
assert tokens_screen.is_tokens_owner_token_button_visible is True, \
f'Mint token owner token button should be enabled'
with step('Open permissions in community settings'):
permissions_settings = community_setting.left_panel.open_permissions()
with step('Verify all elements on permissions screen'):
with step('Verify Add permission button is visible'):
assert permissions_settings.is_add_new_permission_button_present is True, \
f'Add new permission button should be visible'
with step('Permission welcome image source path is correct'):
assert PERMISSION_WELCOME_IMAGE_PATH == permissions_settings.permission_welcome_image_source
with step('Permission welcome title is correct'):
assert permissions_settings.permission_welcome_title == PermissionsElements.WELCOME_TITLE.value
with step('Permission welcome subtitle is correct'):
assert permissions_settings.permission_welcome_subtitle == PermissionsElements.WELCOME_SUBTITLE.value
with step('Permission welcome checklist is correct'):
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_1.value == permissions_settings.permission_checklist[0]
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_2.value == permissions_settings.permission_checklist[1]
assert PermissionsElements.WELCOME_CHECKLIST_ELEMENT_3.value == permissions_settings.permission_checklist[2]

View File

@ -1,44 +0,0 @@
import allure
import pytest
from allure_commons._allure import step
from . import marks
import constants
from constants.community_settings import TokensElements
from constants.images_paths import TOKENS_WELCOME_IMAGE_PATH
from gui.main_window import MainWindow
from scripts.tools import image
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703199',
'Manage community: Manage Mint Tokens screen overview')
@pytest.mark.case(703199)
@pytest.mark.parametrize('params', [constants.community_params])
def test_tokens_screen(main_screen: MainWindow, params):
with step('Create community'):
main_screen.create_community(params)
with step('Open tokens view from community settings'):
community_screen = main_screen.left_panel.select_community(params['name'])
community_setting = community_screen.left_panel.open_community_settings()
tokens_screen = community_setting.left_panel.open_tokens()
with step('Verify all elements on tokens screen'):
with step('Mint token button is present'):
assert tokens_screen.is_tokens_owner_token_button_visible is True
with step('Tokens welcome image path is correct'):
assert TOKENS_WELCOME_IMAGE_PATH == tokens_screen.tokens_welcome_image_path
with step('Tokens welcome title is correct'):
assert tokens_screen.tokens_welcome_title == TokensElements.WELCOME_TITLE.value
with step('Tokens welcome subtitle is correct'):
assert tokens_screen.tokens_welcome_subtitle == TokensElements.WELCOME_SUBTITLE.value
with step('Tokens welcome checklist is correct'):
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_1.value == tokens_screen.tokens_checklist[0]
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_2.value == tokens_screen.tokens_checklist[1]
assert TokensElements.WELCOME_CHECKLIST_ELEMENT_3.value == tokens_screen.tokens_checklist[2]
with step('Tokens infobox title and text are correct and button Mint Owner Token is visible'):
assert tokens_screen.tokens_infobox_title == TokensElements.INFOBOX_TITLE.value
assert tokens_screen.tokens_infobox_text == TokensElements.INFOBOX_TEXT.value
assert tokens_screen.is_tokens_owner_token_button_visible is True