Skip to content

Commit ed24ce9

Browse files
committed
сhore(@e2e): fix test of editing links so its not changing occurrence property
1 parent 125a565 commit ed24ce9

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import time
22
import typing
3+
import copy
34

45
import allure
56

67
from gui.elements.button import Button
78
from gui.elements.object import QObject
89
from gui.elements.text_edit import TextEdit
9-
from .base_popup import BasePopup
10-
from ..objects_map import names
10+
from gui.objects_map import names
1111

1212

1313
class SocialLinksPopup(QObject):
@@ -24,21 +24,25 @@ def _get_list_item(self, index: int) -> QObject:
2424
self._add_social_link_list_item.real_name['index'] = index
2525
return self._add_social_link_list_item
2626

27-
@allure.step('Get social link field')
28-
def _get_text_field(self, occurrence: int) -> QObject:
29-
key = 'occurrence'
30-
if occurrence:
31-
self._social_link_text_field.real_name[key] = occurrence + 1
32-
else:
33-
if key in self._social_link_text_field.real_name:
34-
del self._social_link_text_field.real_name[key]
35-
return self._social_link_text_field
27+
@allure.step('Get social link field by index')
28+
def _get_text_field_by_index(self, index: int) -> TextEdit:
29+
"""Get text field by index without modifying the original real_name"""
30+
# Create a copy of the real_name to avoid modifying the original
31+
text_field_real_name = copy.deepcopy(self._social_link_text_field.real_name)
32+
33+
if index > 0:
34+
text_field_real_name['occurrence'] = index + 1
35+
36+
# Create a temporary TextEdit with the modified real_name
37+
temp_text_field = TextEdit(text_field_real_name)
38+
return temp_text_field
3639

3740
@allure.step('Add link to link field')
3841
def add_link(self, index: int, links: typing.List[str]):
3942
self._get_list_item(index).click()
4043
time.sleep(0.5)
41-
for occurrence, link in enumerate(links):
42-
self._get_text_field(occurrence).text = link
44+
for field_index, link in enumerate(links):
45+
text_field = self._get_text_field_by_index(field_index)
46+
text_field.text = link
4347
self._add_button.click()
4448
self.wait_until_hidden()

test/e2e/tests/settings/settings_profile/test_settings_profile_edit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
@pytest.mark.parametrize('bio, links', [pytest.param('This is my bio', constants.social_links)])
1919
@pytest.mark.smoke
2020
# TODO: add clicking Preview button and check data there
21-
@pytest.mark.skip(reason='https://github.com/status-im/status-desktop/issues/18462')
2221
def test_set_name_bio_social_links(main_screen: MainWindow, aut: AUT, user_account, bio, links):
2322
with step('Open profile settings and check name, bio and links'):
2423
profile_settings = main_screen.left_panel.open_settings().left_panel.open_profile_settings()
@@ -50,7 +49,6 @@ def test_set_name_bio_social_links(main_screen: MainWindow, aut: AUT, user_accou
5049
main_screen.authorize_user(user_account=UserAccount(name=new_user_name, password=user_account.password))
5150

5251
with step('Open profile settings and check new name, bio and links'):
53-
main_screen.home.open_from_dock(DockButtons.WALLET.value)
5452
profile_settings = main_screen.left_panel.open_settings().left_panel.open_profile_settings()
5553
assert profile_settings.get_display_name == new_user_name
5654
assert profile_settings.get_bio == bio

0 commit comments

Comments
 (0)