diff --git a/docs/components_derived/dialog_user_settings.md b/docs/components_derived/dialog_user_settings.md new file mode 100644 index 0000000..43998cf --- /dev/null +++ b/docs/components_derived/dialog_user_settings.md @@ -0,0 +1,6 @@ +# UserSettingsDialogWindow + +::: components_derived.dialog_user_settings + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/modal_add_AD_user.md b/docs/components_derived/modal_add_AD_user.md new file mode 100644 index 0000000..ce3c322 --- /dev/null +++ b/docs/components_derived/modal_add_AD_user.md @@ -0,0 +1,6 @@ +# AddADUserModalWindow + +::: components_derived.modal_add_AD_user + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/modal_add_local_user.md b/docs/components_derived/modal_add_local_user.md new file mode 100644 index 0000000..97aa5b6 --- /dev/null +++ b/docs/components_derived/modal_add_local_user.md @@ -0,0 +1,6 @@ +# AddLocalUserModalWindow + +::: components_derived.modal_add_local_user + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/modal_change_password.md b/docs/components_derived/modal_change_password.md new file mode 100644 index 0000000..883550e --- /dev/null +++ b/docs/components_derived/modal_change_password.md @@ -0,0 +1,6 @@ +# ChangePasswordModalWindow + +::: components_derived.modal_change_password + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/modal_edit_user.md b/docs/components_derived/modal_edit_user.md new file mode 100644 index 0000000..0321fbc --- /dev/null +++ b/docs/components_derived/modal_edit_user.md @@ -0,0 +1,6 @@ +# EditUserModalWindow + +::: components_derived.modal_edit_user + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/modal_view_template.md b/docs/components_derived/modal_view_template.md new file mode 100644 index 0000000..f5140e3 --- /dev/null +++ b/docs/components_derived/modal_view_template.md @@ -0,0 +1,6 @@ +# ViewTemplateModalWindow + +::: components_derived.modal_view_template + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/components_derived/user_card.md b/docs/components_derived/user_card.md new file mode 100644 index 0000000..ac03db9 --- /dev/null +++ b/docs/components_derived/user_card.md @@ -0,0 +1,6 @@ +# UserCard + +::: components_derived.user_card + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/derived_components/modal_add_AD_user.md b/docs/derived_components/modal_add_AD_user.md deleted file mode 100644 index a8d29d5..0000000 --- a/docs/derived_components/modal_add_AD_user.md +++ /dev/null @@ -1,6 +0,0 @@ -# AddADUserModalWindow - -::: derived_components.modal_add_AD_user - handler: python - options: - show_source: true \ No newline at end of file diff --git a/docs/derived_components/modal_add_local_user.md b/docs/derived_components/modal_add_local_user.md deleted file mode 100644 index 4ca2875..0000000 --- a/docs/derived_components/modal_add_local_user.md +++ /dev/null @@ -1,6 +0,0 @@ -# AddLocalUserModalWindow - -::: derived_components.modal_add_local_user - handler: python - options: - show_source: true \ No newline at end of file diff --git a/docs/derived_components/modal_edit_user.md b/docs/derived_components/modal_edit_user.md deleted file mode 100644 index fd5f1a1..0000000 --- a/docs/derived_components/modal_edit_user.md +++ /dev/null @@ -1,6 +0,0 @@ -# EditUserModalWindow - -::: derived_components.modal_edit_user - handler: python - options: - show_source: true \ No newline at end of file diff --git a/docs/elements/icon_element.md b/docs/elements/icon_element.md new file mode 100644 index 0000000..e245844 --- /dev/null +++ b/docs/elements/icon_element.md @@ -0,0 +1,6 @@ +# Icon + +::: elements.icon_element + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/locators/text_input_locators.md b/docs/locators/text_input_locators.md new file mode 100644 index 0000000..890d0e2 --- /dev/null +++ b/docs/locators/text_input_locators.md @@ -0,0 +1,6 @@ +# TextInputLocators + +::: locators.text_input_locators + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/locators/user_card_locators.md b/docs/locators/user_card_locators.md new file mode 100644 index 0000000..143887c --- /dev/null +++ b/docs/locators/user_card_locators.md @@ -0,0 +1,6 @@ +# UserCardLocators + +::: locators.user_card_locators + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/pages/templates_tab.md b/docs/pages/templates_tab.md new file mode 100644 index 0000000..05aa282 --- /dev/null +++ b/docs/pages/templates_tab.md @@ -0,0 +1,6 @@ +# TemplatesTab + +::: pages.templates_tab + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/tests/e2e/test_templates_tab.md b/docs/tests/e2e/test_templates_tab.md new file mode 100644 index 0000000..71b344e --- /dev/null +++ b/docs/tests/e2e/test_templates_tab.md @@ -0,0 +1,6 @@ +# TestTemplatesTab + +::: tests.e2e.test_templates_tab + handler: python + options: + show_source: true \ No newline at end of file diff --git a/docs/tests/e2e/test_user_card.md b/docs/tests/e2e/test_user_card.md new file mode 100644 index 0000000..24a6cfd --- /dev/null +++ b/docs/tests/e2e/test_user_card.md @@ -0,0 +1,6 @@ +# TestUserCard + +::: tests.e2e.test_user_card + handler: python + options: + show_source: true \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 30a65cc..51ca3e4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -24,6 +24,7 @@ nav: - BaseElement: elements/base_element.md - Button: elements/button_element.md - Checkbox: elements/checkbox_element.md + - Icon: elements/icon_element.md #new - TabButton: elements/tab_button_element.md - Text: elements/text_element.md - TextInput: elements/text_input_element.md @@ -40,10 +41,14 @@ nav: - NavigationPanelComponent: components/navbar_component.md - TableComponent: components/table_component.md - ToolbarComponent: components/toolbar_component.md - - Производные компоненты UI: - - AddADUserModalWindow: derived_components/modal_add_AD_user.md - - AddLocalUserModalWindow: derived_components/modal_add_local_user.md - - EditUserModalWindow: derived_components/modal_edit_user.md + - Компоненты производные UI: + - UserSettingsDialogWindow: components_derived/dialog_user_settings.md #new + - AddADUserModalWindow: components_derived/modal_add_AD_user.md + - AddLocalUserModalWindow: components_derived/modal_add_local_user.md + - ChangePasswordModalWindow: components_derived/modal_change_password.md #new + - EditUserModalWindow: components_derived/modal_edit_user.md + - ViewTemplateModalWindow: components_derived/modal_view_template.md #new + - UserCard: components_derived/user_card.md #new - Локаторы: - ButtonLocators: locators/button_locators.md - ConfirmLocators: locators/confirm_locators.md @@ -53,8 +58,10 @@ nav: - ModalWindowLocators: locators/modal_window_locators.md - NavigationPanelLocators: locators/navigation_panel_locators.md - TableLocators: locators/table_locators.md + - TextInputLocators: locators/text_input_locators.md #new - TextLocators: locators/text_locators.md - ToolbarLocators: locators/toolbar_locators.md + - UserCardLocators: locators/user_card_locators.md #new - Страницы приложения: - BasePage: pages/base_page.md - LicenseTab: pages/license_tab.md @@ -62,15 +69,18 @@ nav: - MainPage: pages/main_page.md - ServiceStatusTab: pages/service_status_tab.md - SessionTab: pages/session_tab.md + - TemplatesTab: pages/templates_tab.md #new - UsersTab: pages/users_tab.md - Тесты: - End-to-End: - - TestEventPanel: tests/e2e/test_event_panel.md # добавлено + - TestEventPanel: tests/e2e/test_event_panel.md - TestNavigationPanel: tests/e2e/test_expand_navigation_panel.md - TestLicenseTab: tests/e2e/test_license_tab.md - TestLogin: tests/e2e/test_login.md - TestServiceStatusTab: tests/e2e/test_service_status_tab.md - TestSessionTab: tests/e2e/test_sessions_tab.md + - TestTemplatesTab: tests/e2e/test_templates_tab.md #new + - TestUserCard: tests/e2e/test_user_card.md #new - TestUsersTab: tests/e2e/test_users_tab.md - Компоненты: - TestJsonContainer: tests/components/test_json_container.md diff --git a/site/404.html b/site/404.html index bc2a881..fa3922c 100644 --- a/site/404.html +++ b/site/404.html @@ -469,6 +469,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -848,7 +869,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -858,7 +879,7 @@ @@ -1141,6 +1246,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1177,6 +1303,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1351,6 +1498,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1575,6 +1743,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/alert_component/index.html b/site/components/alert_component/index.html index a994cb6..b1363f8 100644 --- a/site/components/alert_component/index.html +++ b/site/components/alert_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -977,7 +998,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -987,7 +1008,7 @@ @@ -1270,6 +1375,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1306,6 +1432,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1480,6 +1627,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1704,6 +1872,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/base_component/index.html b/site/components/base_component/index.html index 5792c96..b8a99a1 100644 --- a/site/components/base_component/index.html +++ b/site/components/base_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -699,6 +720,15 @@ +
  • + +
  • + + + check_absence + + +
  • @@ -1004,7 +1034,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -1014,7 +1044,7 @@ @@ -1297,6 +1411,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1333,6 +1468,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1507,6 +1663,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1731,6 +1908,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2129,6 +2348,15 @@ +
  • + +
  • + + + check_absence + + +
  • @@ -2447,7 +2675,21 @@ 175 176 177 -178
    class BaseComponent:
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    class BaseComponent:
         """Базовый компонент для работы с элементами страницы.
     
         Предоставляет общие методы для взаимодействия с элементами:
    @@ -2497,6 +2739,20 @@
         #     return elements
     
         # Проверки:
    +    def check_absence(self, locator: str | Locator, msg: str) -> None:
    +        """Проверка отсутствия элемента на странице.
    +
    +        Args:
    +            locator: локатор элемента (строка или объект Locator).
    +            msg: сообщение об ошибке при неудачной проверке.
    +
    +        Raises:
    +            AssertionError: если элемент виден на странице.
    +        """
    +
    +        loc = self.get_locator(locator)
    +        expect(loc).to_be_hidden(timeout=12000), msg
    +
         def check_visibility(self, locator: str | Locator, msg: str) -> None:
             """Проверка видимости элемента на странице.
     
    @@ -2700,6 +2956,123 @@
     
    +

    + check_absence(locator, msg) + +

    + + +
    + +

    Проверка отсутствия элемента на странице.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + locator + + str | Locator + +
    +

    локатор элемента (строка или объект Locator).

    +
    +
    + required +
    + msg + + str + +
    +

    сообщение об ошибке при неудачной проверке.

    +
    +
    + required +
    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    если элемент виден на странице.

    +
    +
    + + +
    + Source code in components\base_component.py +
    62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    def check_absence(self, locator: str | Locator, msg: str) -> None:
    +    """Проверка отсутствия элемента на странице.
    +
    +    Args:
    +        locator: локатор элемента (строка или объект Locator).
    +        msg: сообщение об ошибке при неудачной проверке.
    +
    +    Raises:
    +        AssertionError: если элемент виден на странице.
    +    """
    +
    +    loc = self.get_locator(locator)
    +    expect(loc).to_be_hidden(timeout=12000), msg
    +
    +
    +
    + +
    + +
    + +

    check_visibility(locator, msg) @@ -2783,19 +3156,19 @@
    Source code in components\base_component.py -
    62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    def check_visibility(self, locator: str | Locator, msg: str) -> None:
    +              
    76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    def check_visibility(self, locator: str | Locator, msg: str) -> None:
         """Проверка видимости элемента на странице.
     
         Args:
    @@ -3020,18 +3393,18 @@
     
                 
    Source code in components\base_component.py -
     89
    - 90
    - 91
    - 92
    - 93
    - 94
    - 95
    - 96
    - 97
    - 98
    - 99
    -100
    def is_scrollable_horizontally(self, locator: str | Locator) -> bool:
    +              
    103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    def is_scrollable_horizontally(self, locator: str | Locator) -> bool:
         """Проверка возможности горизонтальной прокрутки элемента.
     
         Args:
    @@ -3119,18 +3492,18 @@
     
                 
    Source code in components\base_component.py -
    76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    def is_scrollable_vertically(self, locator: str | Locator) -> bool:
    +              
     90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    def is_scrollable_vertically(self, locator: str | Locator) -> bool:
         """Проверка возможности вертикальной прокрутки элемента.
     
         Args:
    @@ -3218,23 +3591,23 @@
     
                 
    Source code in components\base_component.py -
    121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    +              
    135
     136
    -137
    def scroll_down(self, locator: str | Locator) -> None:
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    def scroll_down(self, locator: str | Locator) -> None:
         """Прокрутка элемента вниз.
     
         Args:
    @@ -3327,25 +3700,25 @@
     
                 
    Source code in components\base_component.py -
    139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    +              
    153
     154
     155
     156
    -157
    def scroll_left(self, locator: str | Locator) -> None:
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    def scroll_left(self, locator: str | Locator) -> None:
         """Прокрутка элемента влево.
     
         Args:
    @@ -3440,26 +3813,26 @@
     
                 
    Source code in components\base_component.py -
    159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    +              
    173
     174
     175
     176
     177
    -178
    def scroll_right(self, locator: str | Locator) -> None:
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    def scroll_right(self, locator: str | Locator) -> None:
         """Прокрутка элемента вправо.
     
         Args:
    @@ -3555,23 +3928,23 @@
     
                 
    Source code in components\base_component.py -
    103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    +              
    117
     118
    -119
    def scroll_up(self, locator: str | Locator) -> None:
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    def scroll_up(self, locator: str | Locator) -> None:
         """Прокрутка элемента вверх.
     
         Args:
    diff --git a/site/components/card_component/index.html b/site/components/card_component/index.html
    index cdc7016..8ff6636 100644
    --- a/site/components/card_component/index.html
    +++ b/site/components/card_component/index.html
    @@ -478,6 +478,27 @@
       
       
       
    +    
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -941,7 +962,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -951,7 +972,7 @@ @@ -1234,6 +1339,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1270,6 +1396,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1444,6 +1591,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1668,6 +1836,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/confirm_component/index.html b/site/components/confirm_component/index.html index f48e7e7..acb11e1 100644 --- a/site/components/confirm_component/index.html +++ b/site/components/confirm_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -1040,7 +1061,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -1050,7 +1071,7 @@ @@ -1333,6 +1438,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1369,6 +1495,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1543,6 +1690,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1767,6 +1935,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/dropdown_list_component/index.html b/site/components/dropdown_list_component/index.html index 949dd50..41e9d12 100644 --- a/site/components/dropdown_list_component/index.html +++ b/site/components/dropdown_list_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -977,7 +998,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -987,7 +1008,7 @@ @@ -1270,6 +1375,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1306,6 +1432,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1480,6 +1627,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1704,6 +1872,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/eventbar_component/index.html b/site/components/eventbar_component/index.html index 7b454dc..957a9d5 100644 --- a/site/components/eventbar_component/index.html +++ b/site/components/eventbar_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -801,6 +822,15 @@ +
  • + +
  • + + + check_user_card_content + + +
  • @@ -819,6 +849,15 @@ +
  • + +
  • + + + click_user_button + + +
  • @@ -1040,7 +1079,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -1050,7 +1089,7 @@ @@ -1333,6 +1456,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1369,6 +1513,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1543,6 +1708,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1767,6 +1953,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2183,6 +2411,15 @@ +
  • + +
  • + + + check_user_card_content + + +
  • @@ -2201,6 +2438,15 @@ +
  • + +
  • + + + click_user_button + + +
  • @@ -2486,7 +2732,18 @@ 148 149 150 -151
  • class EventPanelComponent(BaseComponent):
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    class EventPanelComponent(BaseComponent):
         """Компонент панели событий. Предоставляет методы для взаимодействия с ней."""
     
         def __init__(self, page: Page):
    @@ -2513,7 +2770,7 @@
             self.search_button = Button(page, buttons_service_locators[0], "search_button")
             self.user_button = Button(page, buttons_service_locators[1], "user_button")
     
    -        self.user_card = CardComponent(page)
    +        self.user_card = UserCard(page)
     
         # Действия:
         def click_expand_less_button(self) -> None:
    @@ -2530,12 +2787,18 @@
                              get_by_role("button").filter(has_text='expand_more')
             button_locator.click()
     
    -    def do_logout(self) -> None:
    -        """Выполняет выход из системы."""
    +    def click_user_button(self) -> UserCard:
    +        """Выполняет нажатие кнопки пользователя."""
     
             self.should_be_user_button()
             self.user_button.click()
    -        self.user_card.click_logout_button()
    +        return self.user_card
    +
    +    def do_logout(self) -> None:
    +        """Выполняет выход из системы."""
    +
    +        user_card = self.click_user_button()
    +        user_card.click_logout_button()
     
         def get_event_tooltip_texts(self) -> []:
             """Возвращает список текстов всплывающих подсказок кнопок счетчиков событий."""
    @@ -2597,6 +2860,11 @@
                 return False
             return True
     
    +    def check_user_card_content(self):
    +        """Проверяет наличие и корректность элементов карточки пользователя."""
    +
    +        self.user_card.check_content()
    +
         def should_be_user_button(self) -> None:
             """Проверяет наличие кнопки пользователя."""
     
    @@ -2733,7 +3001,7 @@
         self.search_button = Button(page, buttons_service_locators[0], "search_button")
         self.user_button = Button(page, buttons_service_locators[1], "user_button")
     
    -    self.user_card = CardComponent(page)
    +    self.user_card = UserCard(page)
     
    @@ -2756,15 +3024,15 @@
    Source code in components\eventbar_component.py -
    106
    -107
    -108
    -109
    -110
    -111
    -112
    +              
    112
     113
    -114
    def check_expand_less_button(self) -> bool:
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    def check_expand_less_button(self) -> bool:
         """Проверяет наличие кнопки галочка вверх."""
     
         try:
    @@ -2795,15 +3063,15 @@
     
                 
    Source code in components\eventbar_component.py -
    116
    -117
    -118
    -119
    -120
    -121
    -122
    +              
    122
     123
    -124
    def check_expand_more_button(self) -> bool:
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    def check_expand_more_button(self) -> bool:
         """Проверяет наличие кнопки галочка вниз"""
     
         try:
    @@ -2821,6 +3089,35 @@
     
    +

    + check_user_card_content() + +

    + + +
    + +

    Проверяет наличие и корректность элементов карточки пользователя.

    + + +
    + Source code in components\eventbar_component.py +
    132
    +133
    +134
    +135
    def check_user_card_content(self):
    +    """Проверяет наличие и корректность элементов карточки пользователя."""
    +
    +    self.user_card.check_content()
    +
    +
    +
    + +
    + +
    + +

    click_expand_less_button() @@ -2887,6 +3184,39 @@
    +

    + click_user_button() + +

    + + +
    + +

    Выполняет нажатие кнопки пользователя.

    + + +
    + Source code in components\eventbar_component.py +
    59
    +60
    +61
    +62
    +63
    +64
    def click_user_button(self) -> UserCard:
    +    """Выполняет нажатие кнопки пользователя."""
    +
    +    self.should_be_user_button()
    +    self.user_button.click()
    +    return self.user_card
    +
    +
    +
    + +
    + +
    + +

    do_logout() @@ -2900,17 +3230,15 @@
    Source code in components\eventbar_component.py -
    59
    -60
    -61
    -62
    -63
    -64
    def do_logout(self) -> None:
    +              
    66
    +67
    +68
    +69
    +70
    def do_logout(self) -> None:
         """Выполняет выход из системы."""
     
    -    self.should_be_user_button()
    -    self.user_button.click()
    -    self.user_card.click_logout_button()
    +    user_card = self.click_user_button()
    +    user_card.click_logout_button()
     
    @@ -2933,17 +3261,17 @@
    Source code in components\eventbar_component.py -
    78
    -79
    -80
    -81
    -82
    -83
    -84
    +              
    84
     85
     86
     87
    -88
    def get_event_button_values(self) -> {}:
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    def get_event_button_values(self) -> {}:
         """Возвращает набор значений кнопок счетчиков событий."""
     
         event_buttons_texts = {}
    @@ -2976,17 +3304,17 @@
     
                 
    Source code in components\eventbar_component.py -
    66
    -67
    -68
    -69
    -70
    -71
    -72
    +              
    72
     73
     74
     75
    -76
    def get_event_tooltip_texts(self) -> []:
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    def get_event_tooltip_texts(self) -> []:
         """Возвращает список текстов всплывающих подсказок кнопок счетчиков событий."""
     
         tooltip_texts = []
    @@ -3019,20 +3347,20 @@
     
                 
    Source code in components\eventbar_component.py -
     90
    - 91
    - 92
    - 93
    - 94
    - 95
    - 96
    +              
     96
      97
      98
      99
     100
     101
     102
    -103
    def get_panel_position(self) -> str:
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    def get_panel_position(self) -> str:
         """Возвращает текущее положение панели событий относительно страницы: "top", "center","bottom"."""
     
         style_attr = self.page.locator(EventPanelLocators.AREA_EVENTS).get_attribute("style")
    @@ -3068,13 +3396,13 @@
     
                 
    Source code in components\eventbar_component.py -
    145
    -146
    -147
    -148
    -149
    -150
    -151
    def should_be_event_buttons(self) -> None:
    +              
    156
    +157
    +158
    +159
    +160
    +161
    +162
    def should_be_event_buttons(self) -> None:
         """Проверяет наличие блока кнопок-счетчиков событий."""
     
         self.unknown_reason_button.check_visibility("Unknown reason event button is missing on event panel")
    @@ -3103,10 +3431,10 @@
     
                 
    Source code in components\eventbar_component.py -
    131
    -132
    -133
    -134
    def should_be_search_button(self) -> None:
    +              
    142
    +143
    +144
    +145
    def should_be_search_button(self) -> None:
         """Проверяет наличие кнопки поиска."""
     
         self.search_button.check_visibility("Search button is missing on event panel")
    @@ -3132,14 +3460,14 @@
     
                 
    Source code in components\eventbar_component.py -
    136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    def should_be_tab_buttons(self) -> None:
    +              
    147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    def should_be_tab_buttons(self) -> None:
         """Проверяет наличие блока tab-кнопок Состояния, Действия, События, Обслуживание, Системный журнал."""
     
         self.states_tab.check_have_text('Состояния', "Tab button with text Состояния is missing on event panel")
    @@ -3169,10 +3497,10 @@
     
                 
    Source code in components\eventbar_component.py -
    126
    -127
    -128
    -129
    def should_be_user_button(self) -> None:
    +              
    137
    +138
    +139
    +140
    def should_be_user_button(self) -> None:
         """Проверяет наличие кнопки пользователя."""
     
         self.user_button.check_visibility("User button is missing on event panel")
    diff --git a/site/components/json_container_component/index.html b/site/components/json_container_component/index.html
    index 0bae0e0..45bed76 100644
    --- a/site/components/json_container_component/index.html
    +++ b/site/components/json_container_component/index.html
    @@ -478,6 +478,27 @@
       
       
       
    +    
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -813,6 +834,15 @@ +
  • + +
  • + + + format_json_string + + +
  • @@ -950,7 +980,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -960,7 +990,7 @@ @@ -1243,6 +1357,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1279,6 +1414,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1453,6 +1609,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1677,6 +1854,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2084,6 +2303,15 @@ +
  • + +
  • + + + format_json_string + + +
  • @@ -2173,8 +2401,7 @@
    Source code in components\json_container_component.py -
     17
    - 18
    +                
     18
      19
      20
      21
    @@ -2263,14 +2490,116 @@
     104
     105
     106
    -107
    class JsonContainerComponent(BaseComponent):
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    class JsonContainerComponent(BaseComponent):
         """Компонент для работы с JSON-данными на странице.
     
         Предоставляет методы чтения и проверки JSON-данных в контейнерах.
     
         """
     
    -    def __init__(self, page: Page):
    +    def __init__(self, page: Page) -> None:
             """Инициализирует JSON-контейнер.
     
             Args:
    @@ -2279,7 +2608,128 @@
     
             super().__init__(page)
     
    +
         # Действия:
    +    def format_json_string(self, json_string: str) -> str:
    +        """Форматирует строку JSON для корректного парсинга.
    +
    +        Args:
    +            json_string: Сырая строка с JSON-данными.
    +
    +        Returns:
    +            str: Отформатированная строка JSON.
    +        """
    +
    +        lines = json_string.splitlines()
    +        formatted_lines = []
    +        stack = []  # Стек для отслеживания вложенности
    +        current_indent = 0
    +
    +        for line in lines:
    +            line = line.strip()
    +            if not line:
    +                continue
    +
    +            # Определяем тип текущей строки
    +            if line in ['{', '[']:
    +                # Начало объекта или массива
    +                formatted_lines.append('  ' * current_indent + line)
    +                stack.append(line)
    +                current_indent += 1
    +            elif line in ['}', ']']:
    +                # Конец объекта или массива
    +                current_indent -= 1
    +                if stack and stack[-1] in ['{', '[']:
    +                    stack.pop()
    +                formatted_lines.append('  ' * current_indent + line)
    +            elif re.match(r'^\d+:\{', line):
    +                # Элемент массива с индексом (0:{, 1:{, etc.)
    +                # Убираем индекс и оставляем только {
    +                formatted_lines.append('  ' * current_indent + '{')
    +                stack.append('{')
    +                current_indent += 1
    +            elif ':' in line:
    +                # Пара ключ:значение
    +                key, value = line.split(':', 1)
    +                key = key.strip()
    +                value = value.strip()
    +
    +                # Добавляем кавычки к ключу если их нет (включая $)
    +                if not (key.startswith('"') and key.endswith('"')):
    +                    key = f'"{key}"'
    +
    +                # Обработка значений
    +                if value in ['{', '[']:
    +                    # Значение - начало объекта или массива
    +                    formatted_line = f'{key}: {value}'
    +                    formatted_lines.append('  ' * current_indent + formatted_line)
    +                    stack.append(value)
    +                    current_indent += 1
    +                elif value in ['}', ']']:
    +                    # Не должно происходить, но на всякий случай
    +                    current_indent -= 1
    +                    formatted_line = f'{key}: {value}'
    +                    formatted_lines.append('  ' * current_indent + formatted_line)
    +                    if stack:
    +                        stack.pop()
    +                else:
    +                    # Простое значение
    +                    # Добавляем кавычки к строковым значениям если их нет
    +                    if (value and
    +                        not value.isdigit() and
    +                        not value.replace('.', '', 1).isdigit() and  # Для чисел с точкой
    +                        value not in ['true', 'false', 'null'] and
    +                        not value.startswith('"') and not value.endswith('"') and
    +                        not value.startswith('{') and not value.startswith('[')):
    +                        value = f'"{value}"'
    +
    +                    formatted_line = f'{key}: {value}'
    +                    formatted_lines.append('  ' * current_indent + formatted_line)
    +            else:
    +                # Простая строка (скорее всего значение в массиве)
    +                formatted_lines.append('  ' * current_indent + line)
    +
    +        # Добавляем запятые где необходимо
    +        result = []
    +        for i, current_line in enumerate(formatted_lines):
    +
    +            # Проверяем, нужно ли добавить запятую
    +            if i < len(formatted_lines) - 1:
    +                next_line = formatted_lines[i + 1]
    +
    +                # Определяем, находимся ли мы внутри массива
    +                in_array = any(bracket == '[' for bracket in stack)
    +
    +                # Не добавляем запятую если:
    +                # - текущая строка это { или [
    +                # - следующая строка это } или ]
    +                # - текущая строка уже заканчивается запятой
    +                # - следующая строка начинается с } или ] (для элементов массива)
    +                should_add_comma = (
    +                    not current_line.endswith('{') and
    +                    not current_line.endswith('[') and
    +                    not current_line.endswith(',') and
    +                    not next_line.strip().endswith('}') and
    +                    not next_line.strip().endswith(']') and
    +                    not next_line.strip().startswith('}') and
    +                    not next_line.strip().startswith(']') and
    +                    not (in_array and next_line.strip() == ']')  # Не добавлять запятую перед закрытием массива
    +                )
    +
    +                # Для элементов массива (объектов) добавляем запятую после }
    +                if (in_array and
    +                    current_line.strip() == '}' and
    +                    next_line.strip() != ']' and
    +                    not next_line.strip().startswith('}')):
    +                    should_add_comma = True
    +
    +                if should_add_comma:
    +                    current_line += ','
    +
    +            result.append(current_line)
    +
    +        return '\n'.join(result)
    +
         def read_data(self, locator: Any) -> Dict:
             """Читает и форматирует JSON-данные из указанного локатора.
     
    @@ -2293,51 +2743,31 @@
                 json.JSONDecodeError: Если данные не могут быть преобразованы в JSON.
             """
     
    -        def format_json_string(json_string):
    -            """Форматирует строку JSON для корректного парсинга.
    -
    -            Args:
    -                json_string: Сырая строка с JSON-данными.
    -
    -            Returns:
    -                str: Отформатированная строка JSON.
    -            """
    -
    -            substrings = json_string.splitlines()
    -            formatted_string_list = []
    -            last_substring = substrings.pop()
    -
    -            for substring in substrings:
    -                if substring.find(':') == -1:
    -                    if substring == '{':
    -                        formatted_string_list.append(substring)
    -                    elif substring == '}':
    -                        s1 = formatted_string_list.pop()
    -                        formatted_string_list.append(s1.rstrip(','))
    -                        formatted_string_list.append(substring + ',')
    -                    else:
    -                        formatted_string_list.append(substring + ',')
    -                    continue
    -
    -                key, value = substring.split(':')
    -                s = ':'.join(['"' + key + '" ', " " + value])
    -
    -                if value == '{':
    -                    formatted_string_list.append(s)
    -                else:
    -                    formatted_string_list.append(s + ',')
    -
    -            s2 = formatted_string_list.pop()
    -            formatted_string_list.append(s2.rstrip(','))
    -            formatted_string_list.append(last_substring)
    -
    -            return " ".join(formatted_string_list)
    -
             # Чтение JSON-содержимого из рабочей области
             loc = self.get_locator(locator)
             json_string = loc.inner_text()
    -        formatted_json_string = format_json_string(json_string)
    -        return json.loads(formatted_json_string)
    +
    +        # Сохранение исходной JSON строки в файл
    +        with open('json_string.txt', 'w', encoding='utf-8') as f:
    +            f.write(json_string)
    +        logger.info("Исходная JSON строка сохранена в файл: json_string.txt")
    +
    +        formatted_json_string = self.format_json_string(json_string)
    +
    +        # Сохранение отформатированной JSON строки в файл
    +        with open('formatted_json_string.txt', 'w', encoding='utf-8') as f:
    +            f.write(formatted_json_string)
    +        logger.info("Отформатированная JSON строка сохранена в файл: formatted_json_string.txt")
    +
    +        try:
    +            data = json.loads(formatted_json_string)
    +        except json.JSONDecodeError as e:
    +            # Дополнительная отладка
    +            logger.error(f"JSON decode error: {e}")
    +            logger.error(f"Formatted JSON: {formatted_json_string}")
    +            assert False, f"Invalid json content. Error: {e}"
    +
    +        return data
     
         # Проверки:
         def check_json_equals(self, actual: Any, expected: Any, msg: str) -> None:
    @@ -2416,14 +2846,14 @@
     
                 
    Source code in components\json_container_component.py -
    24
    -25
    +              
    25
     26
     27
     28
     29
     30
    -31
    def __init__(self, page: Page):
    +31
    +32
    def __init__(self, page: Page) -> None:
         """Инициализирует JSON-контейнер.
     
         Args:
    @@ -2539,20 +2969,20 @@
     
                 
    Source code in components\json_container_component.py -
     94
    - 95
    - 96
    - 97
    - 98
    - 99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    def check_json_equals(self, actual: Any, expected: Any, msg: str) -> None:
    +              
    196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    def check_json_equals(self, actual: Any, expected: Any, msg: str) -> None:
         """Сравнивает JSON-объекты на идентичность.
     
         Args:
    @@ -2575,6 +3005,319 @@
     
    +

    + format_json_string(json_string) + +

    + + +
    + +

    Форматирует строку JSON для корректного парсинга.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + json_string + + str + +
    +

    Сырая строка с JSON-данными.

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    Отформатированная строка JSON.

    +
    +
    + + +
    + Source code in components\json_container_component.py +
     36
    + 37
    + 38
    + 39
    + 40
    + 41
    + 42
    + 43
    + 44
    + 45
    + 46
    + 47
    + 48
    + 49
    + 50
    + 51
    + 52
    + 53
    + 54
    + 55
    + 56
    + 57
    + 58
    + 59
    + 60
    + 61
    + 62
    + 63
    + 64
    + 65
    + 66
    + 67
    + 68
    + 69
    + 70
    + 71
    + 72
    + 73
    + 74
    + 75
    + 76
    + 77
    + 78
    + 79
    + 80
    + 81
    + 82
    + 83
    + 84
    + 85
    + 86
    + 87
    + 88
    + 89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    def format_json_string(self, json_string: str) -> str:
    +    """Форматирует строку JSON для корректного парсинга.
    +
    +    Args:
    +        json_string: Сырая строка с JSON-данными.
    +
    +    Returns:
    +        str: Отформатированная строка JSON.
    +    """
    +
    +    lines = json_string.splitlines()
    +    formatted_lines = []
    +    stack = []  # Стек для отслеживания вложенности
    +    current_indent = 0
    +
    +    for line in lines:
    +        line = line.strip()
    +        if not line:
    +            continue
    +
    +        # Определяем тип текущей строки
    +        if line in ['{', '[']:
    +            # Начало объекта или массива
    +            formatted_lines.append('  ' * current_indent + line)
    +            stack.append(line)
    +            current_indent += 1
    +        elif line in ['}', ']']:
    +            # Конец объекта или массива
    +            current_indent -= 1
    +            if stack and stack[-1] in ['{', '[']:
    +                stack.pop()
    +            formatted_lines.append('  ' * current_indent + line)
    +        elif re.match(r'^\d+:\{', line):
    +            # Элемент массива с индексом (0:{, 1:{, etc.)
    +            # Убираем индекс и оставляем только {
    +            formatted_lines.append('  ' * current_indent + '{')
    +            stack.append('{')
    +            current_indent += 1
    +        elif ':' in line:
    +            # Пара ключ:значение
    +            key, value = line.split(':', 1)
    +            key = key.strip()
    +            value = value.strip()
    +
    +            # Добавляем кавычки к ключу если их нет (включая $)
    +            if not (key.startswith('"') and key.endswith('"')):
    +                key = f'"{key}"'
    +
    +            # Обработка значений
    +            if value in ['{', '[']:
    +                # Значение - начало объекта или массива
    +                formatted_line = f'{key}: {value}'
    +                formatted_lines.append('  ' * current_indent + formatted_line)
    +                stack.append(value)
    +                current_indent += 1
    +            elif value in ['}', ']']:
    +                # Не должно происходить, но на всякий случай
    +                current_indent -= 1
    +                formatted_line = f'{key}: {value}'
    +                formatted_lines.append('  ' * current_indent + formatted_line)
    +                if stack:
    +                    stack.pop()
    +            else:
    +                # Простое значение
    +                # Добавляем кавычки к строковым значениям если их нет
    +                if (value and
    +                    not value.isdigit() and
    +                    not value.replace('.', '', 1).isdigit() and  # Для чисел с точкой
    +                    value not in ['true', 'false', 'null'] and
    +                    not value.startswith('"') and not value.endswith('"') and
    +                    not value.startswith('{') and not value.startswith('[')):
    +                    value = f'"{value}"'
    +
    +                formatted_line = f'{key}: {value}'
    +                formatted_lines.append('  ' * current_indent + formatted_line)
    +        else:
    +            # Простая строка (скорее всего значение в массиве)
    +            formatted_lines.append('  ' * current_indent + line)
    +
    +    # Добавляем запятые где необходимо
    +    result = []
    +    for i, current_line in enumerate(formatted_lines):
    +
    +        # Проверяем, нужно ли добавить запятую
    +        if i < len(formatted_lines) - 1:
    +            next_line = formatted_lines[i + 1]
    +
    +            # Определяем, находимся ли мы внутри массива
    +            in_array = any(bracket == '[' for bracket in stack)
    +
    +            # Не добавляем запятую если:
    +            # - текущая строка это { или [
    +            # - следующая строка это } или ]
    +            # - текущая строка уже заканчивается запятой
    +            # - следующая строка начинается с } или ] (для элементов массива)
    +            should_add_comma = (
    +                not current_line.endswith('{') and
    +                not current_line.endswith('[') and
    +                not current_line.endswith(',') and
    +                not next_line.strip().endswith('}') and
    +                not next_line.strip().endswith(']') and
    +                not next_line.strip().startswith('}') and
    +                not next_line.strip().startswith(']') and
    +                not (in_array and next_line.strip() == ']')  # Не добавлять запятую перед закрытием массива
    +            )
    +
    +            # Для элементов массива (объектов) добавляем запятую после }
    +            if (in_array and
    +                current_line.strip() == '}' and
    +                next_line.strip() != ']' and
    +                not next_line.strip().startswith('}')):
    +                should_add_comma = True
    +
    +            if should_add_comma:
    +                current_line += ','
    +
    +        result.append(current_line)
    +
    +    return '\n'.join(result)
    +
    +
    +
    + +
    + +
    + +

    read_data(locator) @@ -2665,64 +3408,44 @@
    Source code in components\json_container_component.py -
    34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    def read_data(self, locator: Any) -> Dict:
    +              
    156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    def read_data(self, locator: Any) -> Dict:
         """Читает и форматирует JSON-данные из указанного локатора.
     
         Args:
    @@ -2735,51 +3458,31 @@
             json.JSONDecodeError: Если данные не могут быть преобразованы в JSON.
         """
     
    -    def format_json_string(json_string):
    -        """Форматирует строку JSON для корректного парсинга.
    -
    -        Args:
    -            json_string: Сырая строка с JSON-данными.
    -
    -        Returns:
    -            str: Отформатированная строка JSON.
    -        """
    -
    -        substrings = json_string.splitlines()
    -        formatted_string_list = []
    -        last_substring = substrings.pop()
    -
    -        for substring in substrings:
    -            if substring.find(':') == -1:
    -                if substring == '{':
    -                    formatted_string_list.append(substring)
    -                elif substring == '}':
    -                    s1 = formatted_string_list.pop()
    -                    formatted_string_list.append(s1.rstrip(','))
    -                    formatted_string_list.append(substring + ',')
    -                else:
    -                    formatted_string_list.append(substring + ',')
    -                continue
    -
    -            key, value = substring.split(':')
    -            s = ':'.join(['"' + key + '" ', " " + value])
    -
    -            if value == '{':
    -                formatted_string_list.append(s)
    -            else:
    -                formatted_string_list.append(s + ',')
    -
    -        s2 = formatted_string_list.pop()
    -        formatted_string_list.append(s2.rstrip(','))
    -        formatted_string_list.append(last_substring)
    -
    -        return " ".join(formatted_string_list)
    -
         # Чтение JSON-содержимого из рабочей области
         loc = self.get_locator(locator)
         json_string = loc.inner_text()
    -    formatted_json_string = format_json_string(json_string)
    -    return json.loads(formatted_json_string)
    +
    +    # Сохранение исходной JSON строки в файл
    +    with open('json_string.txt', 'w', encoding='utf-8') as f:
    +        f.write(json_string)
    +    logger.info("Исходная JSON строка сохранена в файл: json_string.txt")
    +
    +    formatted_json_string = self.format_json_string(json_string)
    +
    +    # Сохранение отформатированной JSON строки в файл
    +    with open('formatted_json_string.txt', 'w', encoding='utf-8') as f:
    +        f.write(formatted_json_string)
    +    logger.info("Отформатированная JSON строка сохранена в файл: formatted_json_string.txt")
    +
    +    try:
    +        data = json.loads(formatted_json_string)
    +    except json.JSONDecodeError as e:
    +        # Дополнительная отладка
    +        logger.error(f"JSON decode error: {e}")
    +        logger.error(f"Formatted JSON: {formatted_json_string}")
    +        assert False, f"Invalid json content. Error: {e}"
    +
    +    return data
     
    diff --git a/site/components/modal_window_component/index.html b/site/components/modal_window_component/index.html index bf493da..a5743bf 100644 --- a/site/components/modal_window_component/index.html +++ b/site/components/modal_window_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -1085,7 +1106,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -1095,7 +1116,7 @@ @@ -1378,6 +1483,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1414,6 +1540,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1588,6 +1735,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1812,6 +1980,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2580,7 +2790,7 @@ def add_toolbar_button(self, locator: str, name: str) -> None: """Добавляет кнопку в панель инструментов модального окна.""" - self.toolbar.add_button(locator, name) + self.toolbar.add_tooltip_button(locator, name) def add_button(self, locator: str, name: str) -> None: """Добавляет кнопку в модальное окно.""" @@ -2756,7 +2966,7 @@ 43
  • def add_toolbar_button(self, locator: str, name: str) -> None:
         """Добавляет кнопку в панель инструментов модального окна."""
     
    -    self.toolbar.add_button(locator, name)
    +    self.toolbar.add_tooltip_button(locator, name)
     

    diff --git a/site/components/navbar_component/index.html b/site/components/navbar_component/index.html index e0ffacd..857ad33 100644 --- a/site/components/navbar_component/index.html +++ b/site/components/navbar_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -977,7 +998,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -987,7 +1008,7 @@ @@ -1270,6 +1375,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1306,6 +1432,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1480,6 +1627,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1704,6 +1872,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/table_component/index.html b/site/components/table_component/index.html index b7ecb66..ea413a5 100644 --- a/site/components/table_component/index.html +++ b/site/components/table_component/index.html @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -977,7 +998,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -987,7 +1008,7 @@ @@ -1270,6 +1375,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1306,6 +1432,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1480,6 +1627,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1704,6 +1872,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • diff --git a/site/components/toolbar_component/index.html b/site/components/toolbar_component/index.html index 027fb3a..6ea22d3 100644 --- a/site/components/toolbar_component/index.html +++ b/site/components/toolbar_component/index.html @@ -12,7 +12,7 @@ - + @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -897,6 +918,15 @@ +
  • + +
  • + + + add_tab_button + + +
  • @@ -906,6 +936,15 @@ +
  • + +
  • + + + add_tooltip_button + + +
  • @@ -1013,7 +1052,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -1023,7 +1062,7 @@ @@ -1306,6 +1429,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1342,6 +1486,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1516,6 +1681,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1740,6 +1926,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2147,6 +2375,15 @@ +
  • + +
  • + + + add_tab_button + + +
  • @@ -2156,6 +2393,15 @@ +
  • + +
  • + + + add_tooltip_button + + +
  • @@ -2347,9 +2593,7 @@
    Source code in components\toolbar_component.py -
     18
    - 19
    - 20
    +                
     20
      21
      22
      23
    @@ -2489,7 +2733,29 @@
     157
     158
     159
    -160
    class ToolbarComponent(BaseComponent):
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    class ToolbarComponent(BaseComponent):
         """Компонент тулбара. Предоставляет методы для работы с панелью инструментов.
     
         Args:
    @@ -2513,6 +2779,26 @@
     
             self.title = title
     
    +    def add_tooltip_button(self, locator: Locator, name: str) -> None:
    +        """Добавляет кнопку с подсказкой в тулбар.
    +
    +        Args:
    +            locator (Locator): Локатор кнопки
    +            name (str): Уникальное имя кнопки
    +        """
    +
    +        self.buttons.append(TooltipButton(self.page, locator, name))
    +
    +    def add_tab_button(self, locator: Locator, name: str) -> None:
    +        """Добавляет кнопку типа v-tab в тулбар.
    +
    +        Args:
    +            locator (Locator): Локатор кнопки
    +            name (str): Уникальное имя кнопки
    +        """
    +
    +        self.buttons.append(TabButton(self.page, locator, name))
    +
         def add_button(self, locator: Locator, name: str) -> None:
             """Добавляет кнопку в тулбар.
     
    @@ -2521,7 +2807,7 @@
                 name (str): Уникальное имя кнопки
             """
     
    -        self.buttons.append(TooltipButton(self.page, locator, name))
    +        self.buttons.append(Button(self.page, locator, name))
     
         def get_button_by_name(self, name: str) -> TooltipButton | None:
             """Возвращает кнопку по имени.
    @@ -2663,12 +2949,12 @@
     
                 
    Source code in components\toolbar_component.py -
    26
    -27
    -28
    +              
    28
     29
     30
    -31
    def __init__(self, page: Page, title: str):
    +31
    +32
    +33
    def __init__(self, page: Page, title: str):
         """Инициализирует компонент тулбара с указанным заголовком."""
     
         super().__init__(page)
    @@ -2743,15 +3029,15 @@
     
                 
    Source code in components\toolbar_component.py -
    42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    def add_button(self, locator: Locator, name: str) -> None:
    +              
    64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    def add_button(self, locator: Locator, name: str) -> None:
         """Добавляет кнопку в тулбар.
     
         Args:
    @@ -2759,7 +3045,93 @@
             name (str): Уникальное имя кнопки
         """
     
    -    self.buttons.append(TooltipButton(self.page, locator, name))
    +    self.buttons.append(Button(self.page, locator, name))
    +
    + +
    + + + +
    + + +

    + add_tab_button(locator, name) + +

    + + +
    + +

    Добавляет кнопку типа v-tab в тулбар.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + locator + + Locator + +
    +

    Локатор кнопки

    +
    +
    + required +
    + name + + str + +
    +

    Уникальное имя кнопки

    +
    +
    + required +
    + + +
    + Source code in components\toolbar_component.py +
    54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    def add_tab_button(self, locator: Locator, name: str) -> None:
    +    """Добавляет кнопку типа v-tab в тулбар.
    +
    +    Args:
    +        locator (Locator): Локатор кнопки
    +        name (str): Уникальное имя кнопки
    +    """
    +
    +    self.buttons.append(TabButton(self.page, locator, name))
     
    @@ -2813,14 +3185,14 @@
    Source code in components\toolbar_component.py -
    33
    -34
    -35
    +              
    35
     36
     37
     38
     39
    -40
    def add_title(self, title: str) -> None:
    +40
    +41
    +42
    def add_title(self, title: str) -> None:
         """Устанавливает новый заголовок тулбара.
     
         Args:
    @@ -2837,6 +3209,92 @@
     
    +

    + add_tooltip_button(locator, name) + +

    + + +
    + +

    Добавляет кнопку с подсказкой в тулбар.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + locator + + Locator + +
    +

    Локатор кнопки

    +
    +
    + required +
    + name + + str + +
    +

    Уникальное имя кнопки

    +
    +
    + required +
    + + +
    + Source code in components\toolbar_component.py +
    44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    def add_tooltip_button(self, locator: Locator, name: str) -> None:
    +    """Добавляет кнопку с подсказкой в тулбар.
    +
    +    Args:
    +        locator (Locator): Локатор кнопки
    +        name (str): Уникальное имя кнопки
    +    """
    +
    +    self.buttons.append(TooltipButton(self.page, locator, name))
    +
    +
    +
    + +
    + +
    + +

    check_button_tooltip(name, tooltip) @@ -2920,21 +3378,21 @@
    Source code in components\toolbar_component.py -
    146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    def check_button_tooltip(self, name: str, tooltip: str) -> None:
    +              
    168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    def check_button_tooltip(self, name: str, tooltip: str) -> None:
         """Проверяет текст подсказки кнопки.
     
         Args:
    @@ -3025,23 +3483,23 @@
     
                 
    Source code in components\toolbar_component.py -
    128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    def check_button_visibility(self, name: str) -> None:
    +              
    150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    def check_button_visibility(self, name: str) -> None:
         """Проверяет наличие и видимость кнопки с предварительной прокруткой к элементу.
     
             Args:
    @@ -3111,15 +3569,15 @@
     
                 
    Source code in components\toolbar_component.py -
    118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    def check_toolbar_presence(self, message: str) -> None:
    +              
    140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    def check_toolbar_presence(self, message: str) -> None:
         """Проверяет видимость тулбара.
     
         Args:
    @@ -3204,20 +3662,20 @@
     
                 
    Source code in components\toolbar_component.py -
    67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    def click_button(self, name: str) -> None:
    +              
     89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    def click_button(self, name: str) -> None:
         """Кликает по кнопке тулбара.
     
         Args:
    @@ -3307,20 +3765,20 @@
     
                 
    Source code in components\toolbar_component.py -
    52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    def get_button_by_name(self, name: str) -> TooltipButton | None:
    +              
    74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    def get_button_by_name(self, name: str) -> TooltipButton | None:
         """Возвращает кнопку по имени.
     
         Args:
    @@ -3433,23 +3891,23 @@
     
                 
    Source code in components\toolbar_component.py -
    100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    def is_button_not_present(self, name: str) -> bool:
    +              
    122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    def is_button_not_present(self, name: str) -> bool:
         """Проверяет отсутствие кнопки.
     
         Args:
    @@ -3565,23 +4023,23 @@
     
                 
    Source code in components\toolbar_component.py -
    82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    def is_button_present(self, name: str) -> bool:
    +              
    104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    def is_button_present(self, name: str) -> bool:
         """Проверяет наличие кнопки.
     
         Args:
    diff --git a/site/components_derived/dialog_user_settings/index.html b/site/components_derived/dialog_user_settings/index.html
    new file mode 100644
    index 0000000..f005ed2
    --- /dev/null
    +++ b/site/components_derived/dialog_user_settings/index.html
    @@ -0,0 +1,3650 @@
    +
    +
    +
    +  
    +    
    +      
    +      
    +      
    +      
    +      
    +      
    +        
    +      
    +      
    +        
    +      
    +      
    +      
    +      
    +    
    +    
    +      
    +        UserSettingsDialogWindow - Документация тестов eNODE-Мониторинг
    +      
    +    
    +    
    +      
    +      
    +      
    +
    +
    +    
    +    
    +      
    +    
    +    
    +      
    +        
    +        
    +        
    +        
    +        
    +      
    +    
    +    
    +      
    +    
    +    
    +    
    +      
    +
    +    
    +    
    +    
    +  
    +  
    +  
    +    
    +  
    +    
    +    
    +    
    +    
    +    
    +    
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    UserSettingsDialogWindow

    + + +
    + + + + +
    + +

    Модуль диалогового окна просмотра сессионных данных пользователя.

    +

    Содержит класс для работы с диалоговым окном просмотра +сессионных данных пользователя через Playwright.

    + + + + + + + + + +
    + + + + + + + + +
    + + + +

    + UserSettingsDialogWindow + + +

    + + +
    +

    + Bases: BaseComponent

    + + +

    Компонент диалоговое окно просмотра сессионных данных пользователя.

    +

    Предоставляет методы для взаимодействия с элементами +диалогового окна просмотра сессионных данных пользовател.

    + + + + + + + +
    + Source code in components_derived\dialog_user_settings.py +
     19
    + 20
    + 21
    + 22
    + 23
    + 24
    + 25
    + 26
    + 27
    + 28
    + 29
    + 30
    + 31
    + 32
    + 33
    + 34
    + 35
    + 36
    + 37
    + 38
    + 39
    + 40
    + 41
    + 42
    + 43
    + 44
    + 45
    + 46
    + 47
    + 48
    + 49
    + 50
    + 51
    + 52
    + 53
    + 54
    + 55
    + 56
    + 57
    + 58
    + 59
    + 60
    + 61
    + 62
    + 63
    + 64
    + 65
    + 66
    + 67
    + 68
    + 69
    + 70
    + 71
    + 72
    + 73
    + 74
    + 75
    + 76
    + 77
    + 78
    + 79
    + 80
    + 81
    + 82
    + 83
    + 84
    + 85
    + 86
    + 87
    + 88
    + 89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    class UserSettingsDialogWindow(BaseComponent):
    +    """Компонент диалоговое окно просмотра сессионных данных пользователя.
    +
    +    Предоставляет методы для взаимодействия с элементами
    +    диалогового окна просмотра сессионных данных пользовател.
    +    """
    +
    +    def __init__(self, page: Page):
    +        """Инициализирует компонент диалоговое окно просмотра сессионных данных пользовател.
    +
    +        Args:
    +            page: Экземпляр страницы Playwright.
    +        """
    +
    +        super().__init__(page)
    +
    +        dialog_window_locator = page.locator(UserCardLocators.DIALOG_USER_SETTINGS)
    +
    +        self.dialog_window_title = Text(page,
    +                                        dialog_window_locator.\
    +                                        locator(UserCardLocators.TITLE_DIALOG_USER_SETTINGS),
    +                                        "dialog window title")
    +        self.close_button = Button(page,
    +                                   dialog_window_locator.\
    +                                   locator(UserCardLocators.HEADER_DIALOG_USER_SETTINGS). \
    +                                   get_by_role("button"),
    +                                   "close button")
    +
    +        self.user_settings_table = TableComponent(page)
    +
    +    # Действия:
    +    def click_close_button(self):
    +        """Нажимает кнопку закрытия окна.
    +
    +        Выполняет клик по кнопке 'Закрыть' на строке с заголовком окна.
    +        """
    +
    +        self.close_button.click()
    +
    +    def get_delete_button_from_row(self, row_index: int) -> TooltipButton:
    +        """Возвращает кнопку удаления сеанса для указанной строки.
    +
    +        Args:
    +            row_index: Индекс строки в таблице.
    +
    +        Returns:
    +            TooltipButton: Кнопка с подсказкой.
    +
    +        Raises:
    +            AssertionError: Если строка не найдена.
    +        """
    +
    +        row_locator = self.user_settings_table.get_row_locator(
    +            UserCardLocators.TABLE_WORK_AREA,
    +            row_index
    +        )
    +        assert isinstance(row_locator, Locator), f"Row with index {row_index} is missing"
    +
    +        button_locator = row_locator.get_by_role("button")
    +        return TooltipButton(self.page, button_locator, "delete_button")
    +
    +    # Проверки:
    +    def check_content(self) -> None:
    +        """Проверяет содержимое окно просмотра сессионных данных пользователя."""
    +
    +        self.dialog_window_title.check_have_text("Настройки", \
    +                                                 "Title 'Настройки' is missing on user settings window top")
    +        self.close_button.check_visibility("Close button is missing on user settings window top")
    +
    +        self.should_be_user_settings_table()
    +        self.check_user_settings_table_content()
    +
    +    def check_window_absence(self) -> None:
    +        """Проверка отсутствия окна на странице.
    +
    +        Raises:
    +            AssertionError: если окнo присутствует на странице.
    +        """
    +
    +        self.check_absence(UserCardLocators.DIALOG_USER_SETTINGS, \
    +                           "User settings dialog window is present")
    +
    +    def check_window_visibility(self) -> None:
    +        """Проверка видимости окна на странице.
    +
    +        Raises:
    +            AssertionError: если окнo отсутствует на странице.
    +        """
    +
    +        self.check_visibility(UserCardLocators.DIALOG_USER_SETTINGS, \
    +                              "User settings dialog window is missing")
    +
    +
    +    def check_user_settings_table_content(self) -> None:
    +        """Проверяет содержимое таблицы сессионных данных пользователя.
    +
    +
    +        Raises:
    +            AssertionError: Если таблица пуста или заголовки неверны.
    +        """
    +
    +        expected_headers = [
    +            'ПОЛЬЗОВАТЕЛЬ',
    +            'IP АДРЕС',
    +            'ВРЕМЯ НАЧАЛА СЕССИИ',
    +            'ДЕЙСТВИЯ'
    +        ]
    +
    +        table_content = self.user_settings_table.read(UserCardLocators.TABLE_WORK_AREA)
    +        len_table_content = len(table_content)
    +
    +        if len_table_content == 0:
    +            assert False, "The contents of the table are missing"
    +
    +        actual_headers = table_content[0]
    +
    +        assert actual_headers == expected_headers,\
    +               f"Expected table headers {expected_headers} are not equal {actual_headers}"
    +
    +        if len_table_content == 1:
    +            assert False, "Table body is missing"
    +
    +        for index in range(len_table_content - 1):
    +            self.should_be_delete_button_on_user_settings_table_row(index, "Удалить")
    +
    +    def should_be_user_settings_table(self) -> None:
    +        """Проверяет наличие таблицы сессионных данных пользователя.
    +
    +        Raises:
    +            AssertionError: Если таблица отсутствует.
    +        """
    +
    +        self.user_settings_table.check_visibility(
    +                            UserCardLocators.TABLE_WORK_AREA,
    +                            "User settings table is missing")
    +
    +    def should_be_delete_button_on_user_settings_table_row(self,
    +                                                                row_index: int,
    +                                                                tooltip: str
    +                                                               ) -> None:
    +        """Проверяет наличие кнопки удаления в строке таблицы.
    +
    +        Args:
    +            row_index: Индекс проверяемой строки.
    +            tooltip: Ожидаемый текст подсказки.
    +
    +        Raises:
    +            AssertionError: Если кнопка отсутствует или подсказка неверна.
    +        """
    +
    +        delete_button = self.get_delete_button_from_row(row_index)
    +
    +        # Ожидаем исчезновения предыдущих подсказок перед проверкой
    +        delete_button.wait_for_tooltip_to_disappear()
    +
    +        delete_button.check_visibility(
    +            f"Delete session button is missing on {row_index} row"
    +        )
    +        delete_button.check_tooltip_with_text(tooltip)
    +
    +        # Ожидаем исчезновения подсказки после проверки
    +        delete_button.wait_for_tooltip_to_disappear()
    +
    +
    + + + +
    + + + + + + + + + +
    + + +

    + __init__(page) + +

    + + +
    + +

    Инициализирует компонент диалоговое окно просмотра сессионных данных пользовател.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + page + + Page + +
    +

    Экземпляр страницы Playwright.

    +
    +
    + required +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    def __init__(self, page: Page):
    +    """Инициализирует компонент диалоговое окно просмотра сессионных данных пользовател.
    +
    +    Args:
    +        page: Экземпляр страницы Playwright.
    +    """
    +
    +    super().__init__(page)
    +
    +    dialog_window_locator = page.locator(UserCardLocators.DIALOG_USER_SETTINGS)
    +
    +    self.dialog_window_title = Text(page,
    +                                    dialog_window_locator.\
    +                                    locator(UserCardLocators.TITLE_DIALOG_USER_SETTINGS),
    +                                    "dialog window title")
    +    self.close_button = Button(page,
    +                               dialog_window_locator.\
    +                               locator(UserCardLocators.HEADER_DIALOG_USER_SETTINGS). \
    +                               get_by_role("button"),
    +                               "close button")
    +
    +    self.user_settings_table = TableComponent(page)
    +
    +
    +
    + +
    + +
    + + +

    + check_content() + +

    + + +
    + +

    Проверяет содержимое окно просмотра сессионных данных пользователя.

    + + +
    + Source code in components_derived\dialog_user_settings.py +
    81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    def check_content(self) -> None:
    +    """Проверяет содержимое окно просмотра сессионных данных пользователя."""
    +
    +    self.dialog_window_title.check_have_text("Настройки", \
    +                                             "Title 'Настройки' is missing on user settings window top")
    +    self.close_button.check_visibility("Close button is missing on user settings window top")
    +
    +    self.should_be_user_settings_table()
    +    self.check_user_settings_table_content()
    +
    +
    +
    + +
    + +
    + + +

    + check_user_settings_table_content() + +

    + + +
    + +

    Проверяет содержимое таблицы сессионных данных пользователя.

    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    Если таблица пуста или заголовки неверны.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    def check_user_settings_table_content(self) -> None:
    +    """Проверяет содержимое таблицы сессионных данных пользователя.
    +
    +
    +    Raises:
    +        AssertionError: Если таблица пуста или заголовки неверны.
    +    """
    +
    +    expected_headers = [
    +        'ПОЛЬЗОВАТЕЛЬ',
    +        'IP АДРЕС',
    +        'ВРЕМЯ НАЧАЛА СЕССИИ',
    +        'ДЕЙСТВИЯ'
    +    ]
    +
    +    table_content = self.user_settings_table.read(UserCardLocators.TABLE_WORK_AREA)
    +    len_table_content = len(table_content)
    +
    +    if len_table_content == 0:
    +        assert False, "The contents of the table are missing"
    +
    +    actual_headers = table_content[0]
    +
    +    assert actual_headers == expected_headers,\
    +           f"Expected table headers {expected_headers} are not equal {actual_headers}"
    +
    +    if len_table_content == 1:
    +        assert False, "Table body is missing"
    +
    +    for index in range(len_table_content - 1):
    +        self.should_be_delete_button_on_user_settings_table_row(index, "Удалить")
    +
    +
    +
    + +
    + +
    + + +

    + check_window_absence() + +

    + + +
    + +

    Проверка отсутствия окна на странице.

    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    если окнo присутствует на странице.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    def check_window_absence(self) -> None:
    +    """Проверка отсутствия окна на странице.
    +
    +    Raises:
    +        AssertionError: если окнo присутствует на странице.
    +    """
    +
    +    self.check_absence(UserCardLocators.DIALOG_USER_SETTINGS, \
    +                       "User settings dialog window is present")
    +
    +
    +
    + +
    + +
    + + +

    + check_window_visibility() + +

    + + +
    + +

    Проверка видимости окна на странице.

    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    если окнo отсутствует на странице.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    def check_window_visibility(self) -> None:
    +    """Проверка видимости окна на странице.
    +
    +    Raises:
    +        AssertionError: если окнo отсутствует на странице.
    +    """
    +
    +    self.check_visibility(UserCardLocators.DIALOG_USER_SETTINGS, \
    +                          "User settings dialog window is missing")
    +
    +
    +
    + +
    + +
    + + +

    + click_close_button() + +

    + + +
    + +

    Нажимает кнопку закрытия окна.

    +

    Выполняет клик по кнопке 'Закрыть' на строке с заголовком окна.

    + + +
    + Source code in components_derived\dialog_user_settings.py +
    50
    +51
    +52
    +53
    +54
    +55
    +56
    def click_close_button(self):
    +    """Нажимает кнопку закрытия окна.
    +
    +    Выполняет клик по кнопке 'Закрыть' на строке с заголовком окна.
    +    """
    +
    +    self.close_button.click()
    +
    +
    +
    + +
    + +
    + + +

    + get_delete_button_from_row(row_index) + +

    + + +
    + +

    Возвращает кнопку удаления сеанса для указанной строки.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + row_index + + int + +
    +

    Индекс строки в таблице.

    +
    +
    + required +
    + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    TooltipButton + TooltipButton + +
    +

    Кнопка с подсказкой.

    +
    +
    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    Если строка не найдена.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    def get_delete_button_from_row(self, row_index: int) -> TooltipButton:
    +    """Возвращает кнопку удаления сеанса для указанной строки.
    +
    +    Args:
    +        row_index: Индекс строки в таблице.
    +
    +    Returns:
    +        TooltipButton: Кнопка с подсказкой.
    +
    +    Raises:
    +        AssertionError: Если строка не найдена.
    +    """
    +
    +    row_locator = self.user_settings_table.get_row_locator(
    +        UserCardLocators.TABLE_WORK_AREA,
    +        row_index
    +    )
    +    assert isinstance(row_locator, Locator), f"Row with index {row_index} is missing"
    +
    +    button_locator = row_locator.get_by_role("button")
    +    return TooltipButton(self.page, button_locator, "delete_button")
    +
    +
    +
    + +
    + +
    + + +

    + should_be_delete_button_on_user_settings_table_row(row_index, tooltip) + +

    + + +
    + +

    Проверяет наличие кнопки удаления в строке таблицы.

    + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    + row_index + + int + +
    +

    Индекс проверяемой строки.

    +
    +
    + required +
    + tooltip + + str + +
    +

    Ожидаемый текст подсказки.

    +
    +
    + required +
    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    Если кнопка отсутствует или подсказка неверна.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    def should_be_delete_button_on_user_settings_table_row(self,
    +                                                            row_index: int,
    +                                                            tooltip: str
    +                                                           ) -> None:
    +    """Проверяет наличие кнопки удаления в строке таблицы.
    +
    +    Args:
    +        row_index: Индекс проверяемой строки.
    +        tooltip: Ожидаемый текст подсказки.
    +
    +    Raises:
    +        AssertionError: Если кнопка отсутствует или подсказка неверна.
    +    """
    +
    +    delete_button = self.get_delete_button_from_row(row_index)
    +
    +    # Ожидаем исчезновения предыдущих подсказок перед проверкой
    +    delete_button.wait_for_tooltip_to_disappear()
    +
    +    delete_button.check_visibility(
    +        f"Delete session button is missing on {row_index} row"
    +    )
    +    delete_button.check_tooltip_with_text(tooltip)
    +
    +    # Ожидаем исчезновения подсказки после проверки
    +    delete_button.wait_for_tooltip_to_disappear()
    +
    +
    +
    + +
    + +
    + + +

    + should_be_user_settings_table() + +

    + + +
    + +

    Проверяет наличие таблицы сессионных данных пользователя.

    + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + AssertionError + +
    +

    Если таблица отсутствует.

    +
    +
    + + +
    + Source code in components_derived\dialog_user_settings.py +
    144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    def should_be_user_settings_table(self) -> None:
    +    """Проверяет наличие таблицы сессионных данных пользователя.
    +
    +    Raises:
    +        AssertionError: Если таблица отсутствует.
    +    """
    +
    +    self.user_settings_table.check_visibility(
    +                        UserCardLocators.TABLE_WORK_AREA,
    +                        "User settings table is missing")
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/site/derived_components/modal_add_AD_user/index.html b/site/components_derived/modal_add_AD_user/index.html similarity index 97% rename from site/derived_components/modal_add_AD_user/index.html rename to site/components_derived/modal_add_AD_user/index.html index 13771a8..524b4b1 100644 --- a/site/derived_components/modal_add_AD_user/index.html +++ b/site/components_derived/modal_add_AD_user/index.html @@ -9,7 +9,7 @@ - + @@ -478,6 +478,27 @@ +
  • + + + + + Icon + + + + +
  • + + + + + + + + + +
  • @@ -859,7 +880,7 @@ - Производные компоненты UI + Компоненты производные UI @@ -869,7 +890,7 @@ @@ -1288,6 +1393,27 @@ +
  • + + + + + TextInputLocators + + + + +
  • + + + + + + + + + +
  • @@ -1324,6 +1450,27 @@ + + + + + + +
  • + + + + + UserCardLocators + + + + +
  • + + + + @@ -1498,6 +1645,27 @@ +
  • + + + + + TemplatesTab + + + + +
  • + + + + + + + + + +
  • @@ -1722,6 +1890,48 @@ +
  • + + + + + TestTemplatesTab + + + + +
  • + + + + + + + + + + +
  • + + + + + TestUserCard + + + + +
  • + + + + + + + + + +
  • @@ -2095,7 +2305,7 @@