chore: fleet change

This commit is contained in:
Valentina Novgorodtceva 2024-07-19 16:09:50 +07:00
parent 2501e04ccb
commit fe78d6f01f
10 changed files with 88 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import logging
import time
from datetime import datetime
import os
@ -10,6 +11,10 @@ from PIL import ImageGrab
import configs
from configs.system import get_platform
from fixtures.path import generate_test_info
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.splash_screen import SplashScreen
from gui.main_window import MainWindow
from gui.screens.onboarding import LoginView
from scripts.utils.system_path import SystemPath
# Send logs to pytest.log as well
@ -45,7 +50,8 @@ def setup_function_scope(
generate_test_data,
check_result,
application_logs,
keycard_controller
keycard_controller,
switch_to_status_staging
):
# FIXME: broken due to KeyError: <_pytest.stash.StashKey object at 0x7fd1ba6d78c0>
# caplog.set_level(configs.LOG_LEVEL)
@ -73,3 +79,17 @@ def pytest_exception_interact(node):
)
except FileNotFoundError:
print("Screenshot was not generated or saved")
@pytest.fixture
def switch_to_status_staging(aut, main_screen, user_account, request):
if request.module.marks.mark.name in ['communities', 'settings_messaging',
'messaging'] and 'tests-e2e-new' in str(configs.AUT_PATH):
LOG.info(f"Path is {str(request.path)}")
settings = main_screen.left_panel.open_settings()
settings.left_panel.open_advanced_settings().switch_fleet().choose_fleet('statusStagingOption').confirm()
aut.restart()
LoginView().log_in(user_account)
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE:
BetaConsentPopup().confirm()

View File

@ -102,6 +102,7 @@ class AUT:
f'--port={self.port}',
str(self.path),
f'--datadir={self.app_data}',
'--enable-fleet-selection',
f'--LOG_LEVEL={configs.testpath.LOG_LEVEL}',
]
try:

View File

@ -0,0 +1,30 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.objects_map import names
class FleetPopup(BasePopup):
def __init__(self):
super().__init__()
self._fleet_option_template = Button(names.fleet_option_template)
self._confirm_button = Button(names.confirm_change_fleet_statusButton)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._fleet_option_template.wait_until_appears(timeout_msec)
return self
@allure.step('Choose fleet')
def choose_fleet(self, fleet_object_name: str):
self._fleet_option_template.real_name['objectName'] = fleet_object_name
self._fleet_option_template.click()
return self
@allure.step('Confirm')
def confirm(self):
self._confirm_button.click(timeout=None)
self.wait_until_hidden()

View File

@ -1,6 +1,7 @@
import allure
import configs
from driver.toplevel_window import set_focus
from gui.elements.object import QObject
from gui.objects_map import names
@ -17,4 +18,5 @@ class SplashScreen(QObject):
@allure.step('Wait until hidden {0}')
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.APP_LOAD_TIMEOUT_MSEC):
self.click()
super().wait_until_hidden(timeout_msec)

View File

@ -7,7 +7,7 @@ mainWindow_StatusWindow = {"name": "mainWindow", "type": "StatusWindow", "visibl
statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type": "Overlay", "unnamed": 1, "visible": True}
statusDesktop_mainWindow_overlay_popup2 = {"container": statusDesktop_mainWindow_overlay, "occurrence": 2, "type": "PopupItem", "unnamed": 1, "visible": True}
scrollView_StatusScrollView = {"container": statusDesktop_mainWindow_overlay, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen"}
splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen", "visible": True}
mainWindow_LoadingAnimation = {"container": statusDesktop_mainWindow, "objectName": "loadingAnimation", "type": "LoadingAnimation", "visible": True}
# Common names
@ -438,6 +438,12 @@ mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage = {"container": "
# Confirm switch waku mode popup
iUnderstandStatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "confirmButton", "type": "StatusButton", "unnamed": 1, "visible": True}
# Fleet popup
fleet_option_template = {"container": statusDesktop_mainWindow_overlay, "objectName": "shardsTestOption", "type": "FleetRadioSelector", "visible": True}
shardsTestOption_FleetRadioSelector = {"container": statusDesktop_mainWindow_overlay, "objectName": "shardsTestOption", "type": "FleetRadioSelector", "visible": True}
statusStagingOption_FleetRadioSelector = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusStagingOption", "type": "FleetRadioSelector", "visible": True}
confirm_change_fleet_statusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "confirmButton", "type": "StatusButton", "unnamed": 1, "visible": True}
# Back up seed phrase banner
mainWindow_secureYourSeedPhraseBanner_ModuleWarning = {"container": statusDesktop_mainWindow, "objectName": "secureYourSeedPhraseBanner", "type": "ModuleWarning", "visible": True}
mainWindow_secureYourSeedPhraseBanner_Button = {"container": statusDesktop_mainWindow, "id": "button", "text": "Back up now", "type": "Button", "unnamed": 1, "visible": True}

View File

@ -179,3 +179,4 @@ manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWi
enableCreateCommunityButton_StatusSettingsLineButton = {"container": settingsContentBase_ScrollView, "objectName": "enableCreateCommunityButton", "type": "StatusSettingsLineButton", "visible": True}
settingsContentBaseScrollViewLightWakuModeBloomSelectorButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "lightWakuModeButton", "type": "BloomSelectorButton", "visible": True}
settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "relayWakuModeButton", "type": "BloomSelectorButton", "visible": True}
settingsContentBaseScrollView_fleetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "fleetButton", "type": "StatusSettingsLineButton", "visible": True}

View File

@ -1,6 +1,7 @@
import allure
from gui.components.settings.confirm_switch_waku_mode_popup import SwitchWakuModePopup
from gui.components.settings.fleet_popup import FleetPopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
@ -17,6 +18,7 @@ class AdvancedSettingsView(QObject):
self._enable_creation_community_button = Button(settings_names.enableCreateCommunityButton_StatusSettingsLineButton)
self._light_mode_button = Button(settings_names.settingsContentBaseScrollViewLightWakuModeBloomSelectorButton)
self._relay_mode_button = Button(settings_names.settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton)
self._fleet_button = Button(settings_names.settingsContentBaseScrollView_fleetButton_StatusSettingsLineButton)
@allure.step('Switch manage community on testnet option')
def switch_manage_on_community(self):
@ -46,3 +48,8 @@ class AdvancedSettingsView(QObject):
return self._light_mode_button.is_checked
elif mode == 'relay':
return self._relay_mode_button.is_checked
@allure.step('Switch fleet')
def switch_fleet(self):
self._fleet_button.click()
return FleetPopup().wait_until_appears()

View File

@ -0,0 +1,16 @@
import allure
import pytest
from . import marks
import constants
from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703630', 'Create community')
@pytest.mark.case(703630)
@pytest.mark.parametrize('params', [constants.community_params])
def test_switch_fleet(aut, user_account, main_screen: MainWindow, params, switch_to_status_staging):
pass

View File

@ -42,12 +42,14 @@ ModalPopup {
}
FleetRadioSelector {
objectName: "shardsTestOption"
advancedStore: popup.advancedStore
fleetName: Constants.shards_test
buttonGroup: fleetSettings
}
FleetRadioSelector {
objectName: "statusStagingOption"
advancedStore: popup.advancedStore
fleetName: Constants.status_staging
buttonGroup: fleetSettings

View File

@ -59,6 +59,7 @@ SettingsContentBase {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Fleet")
objectName: "fleetButton"
currentValue: root.advancedStore.fleet
onClicked: fleetModal.open()
visible: root.isFleetSelectionEnabled