comparison tests/e2e/libervia-web/test_libervia-web.py @ 4305:4cd4922de876

tests: reformat tests using black.
author Goffi <goffi@goffi.org>
date Thu, 26 Sep 2024 16:11:56 +0200
parents dfccc90cacc6
children
comparison
equal deleted inserted replaced
4304:92a886f31581 4305:4cd4922de876
42 42
43 43
44 if os.getenv("LIBERVIA_TEST_ENV_E2E_WEB") is None: 44 if os.getenv("LIBERVIA_TEST_ENV_E2E_WEB") is None:
45 pytest.skip( 45 pytest.skip(
46 "skipping end-to-end tests, we are not in a test environment for Libervia", 46 "skipping end-to-end tests, we are not in a test environment for Libervia",
47 allow_module_level=True 47 allow_module_level=True,
48 ) 48 )
49 49
50 pytestmark = pytest.mark.usefixtures("test_profiles", "screenshot_on_failure") 50 pytestmark = pytest.mark.usefixtures("test_profiles", "screenshot_on_failure")
51 51
52 52
109 wait_until(album_link.exists) 109 wait_until(album_link.exists)
110 click(album_link) 110 click(album_link)
111 wait_until(lambda: S("#file_drop").exists()) 111 wait_until(lambda: S("#file_drop").exists())
112 wait_until(lambda: not S("#loading_screen").exists()) 112 wait_until(lambda: not S("#loading_screen").exists())
113 drag_file("/src/libervia-backend/tests/_files/test_1.jpg", "drop photos here") 113 drag_file("/src/libervia-backend/tests/_files/test_1.jpg", "drop photos here")
114 wait_until(lambda: len(find_all(S("div.progress_finished")))==1) 114 wait_until(lambda: len(find_all(S("div.progress_finished"))) == 1)
115 drag_file("/src/libervia-backend/tests/_files/test_2.jpg", "drop photos here") 115 drag_file("/src/libervia-backend/tests/_files/test_2.jpg", "drop photos here")
116 wait_until(lambda: len(find_all(S("div.progress_finished")))==2) 116 wait_until(lambda: len(find_all(S("div.progress_finished"))) == 2)
117 assert S('img[alt="test_1.jpg"]').exists() 117 assert S('img[alt="test_1.jpg"]').exists()
118 assert S('img[alt="test_2.jpg"]').exists() 118 assert S('img[alt="test_2.jpg"]').exists()
119 119
120 @pytest.mark.dependency(depends=["create_album"]) 120 @pytest.mark.dependency(depends=["create_album"])
121 def test_user_can_slideshow(self, log_in_account1): 121 def test_user_can_slideshow(self, log_in_account1):
131 # it seems that Helium is re-using the selector, i.e. we get the other 131 # it seems that Helium is re-using the selector, i.e. we get the other
132 # slide in active_slide_1. 132 # slide in active_slide_1.
133 active_slide_1_elt = active_slide_1.web_element 133 active_slide_1_elt = active_slide_1.web_element
134 click(S(".swiper-button-next")) 134 click(S(".swiper-button-next"))
135 wait_until( 135 wait_until(
136 lambda: 136 lambda: "swiper-slide-active" not in active_slide_1_elt.get_attribute("class")
137 "swiper-slide-active" not in active_slide_1_elt.get_attribute("class")
138 ) 137 )
139 active_slide_2 = S("div.swiper-slide-active") 138 active_slide_2 = S("div.swiper-slide-active")
140 assert active_slide_2.exists() 139 assert active_slide_2.exists()
141 active_slide_2_elt = active_slide_2.web_element 140 active_slide_2_elt = active_slide_2.web_element
142 assert active_slide_1_elt != active_slide_2_elt 141 assert active_slide_1_elt != active_slide_2_elt
147 def test_external_user_cant_access_album(self, log_in_account1_s2): 146 def test_external_user_cant_access_album(self, log_in_account1_s2):
148 go_to(self.TEST_ALBUM_URL) 147 go_to(self.TEST_ALBUM_URL)
149 assert Text("Unauthorized").exists() 148 assert Text("Unauthorized").exists()
150 assert "Error" in get_driver().title 149 assert "Error" in get_driver().title
151 150
152 @pytest.mark.dependency(name="invite_ext_user", depends=["create_album", "ext_user_no_access"]) 151 @pytest.mark.dependency(
152 name="invite_ext_user", depends=["create_album", "ext_user_no_access"]
153 )
153 def test_invitation_of_external_user(self, log_in_account1): 154 def test_invitation_of_external_user(self, log_in_account1):
154 """User can invite somebody not in its roster by its full JID""" 155 """User can invite somebody not in its roster by its full JID"""
155 go_to(self.TEST_ALBUM_URL) 156 go_to(self.TEST_ALBUM_URL)
156 wait_until(lambda: not S("#loading_screen").exists()) 157 wait_until(lambda: not S("#loading_screen").exists())
157 click("manage invitations") 158 click("manage invitations")
209 tickets_btn = S("//span[text()='Tickets']") 210 tickets_btn = S("//span[text()='Tickets']")
210 click(tickets_btn) 211 click(tickets_btn)
211 write("test-generic-list", "name of the list") 212 write("test-generic-list", "name of the list")
212 click("create list") 213 click("create list")
213 wait_until(Text("Success").exists) 214 wait_until(Text("Success").exists)
214
215 215
216 @pytest.mark.dependency( 216 @pytest.mark.dependency(
217 name="create_generic_list_item", depends=["create_generic_list"] 217 name="create_generic_list_item", depends=["create_generic_list"]
218 ) 218 )
219 def test_user_can_create_generic_list_item(self): 219 def test_user_can_create_generic_list_item(self):