Mercurial > libervia-backend
comparison tests/e2e/libervia-web/test_libervia-web.py @ 3703:de133b180941
tests (e2e/web): add basic tests for generic lists
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 05 Nov 2021 18:11:24 +0100 |
parents | 6c87c00b344a |
children | dfccc90cacc6 |
comparison
equal
deleted
inserted
replaced
3702:6f9f4674f997 | 3703:de133b180941 |
---|---|
19 import os | 19 import os |
20 import re | 20 import re |
21 import pytest | 21 import pytest |
22 from helium import ( | 22 from helium import ( |
23 go_to, write, press, click, drag_file, find_all, wait_until, S, Text, Link, Button, | 23 go_to, write, press, click, drag_file, find_all, wait_until, S, Text, Link, Button, |
24 get_driver, ENTER | 24 select, scroll_down, get_driver, ENTER |
25 ) | 25 ) |
26 | 26 |
27 | 27 |
28 if os.getenv("LIBERVIA_TEST_ENV_E2E_WEB") is None: | 28 if os.getenv("LIBERVIA_TEST_ENV_E2E_WEB") is None: |
29 pytest.skip( | 29 pytest.skip( |
176 def test_email_guest_can_access_album(self, nobody_logged_in, shared_data): | 176 def test_email_guest_can_access_album(self, nobody_logged_in, shared_data): |
177 go_to(shared_data["invitation_url"]) | 177 go_to(shared_data["invitation_url"]) |
178 click("test album") | 178 click("test album") |
179 wait_until(lambda: not S("#loading_screen").exists()) | 179 wait_until(lambda: not S("#loading_screen").exists()) |
180 assert len(find_all(S("img.is-photo-thumbnail"))) == 2 | 180 assert len(find_all(S("img.is-photo-thumbnail"))) == 2 |
181 | |
182 | |
183 class TestLists: | |
184 TEST_GENERIC_LIST_URL = ( | |
185 "https://libervia-web.test:8443/lists/view/account1@server1.test/" | |
186 "fdp%2Fsubmitted%2Forg.salut-a-toi.tickets%3A0_test-generic-list" | |
187 ) | |
188 | |
189 @pytest.mark.dependency(name="create_generic_list") | |
190 def test_user_can_create_generic(self, log_in_account1): | |
191 go_to("https://libervia-web.test:8443/lists/view") | |
192 click("create a list") | |
193 tickets_btn = S("//span[text()='Tickets']") | |
194 click(tickets_btn) | |
195 write("test-generic-list", "name of the list") | |
196 click("create list") | |
197 wait_until(Text("Success").exists) | |
198 | |
199 | |
200 @pytest.mark.dependency( | |
201 name="create_generic_list_item", depends=["create_generic_list"] | |
202 ) | |
203 def test_user_can_create_generic_list_item(self): | |
204 go_to(self.TEST_GENERIC_LIST_URL) | |
205 click("create") | |
206 write("test item", "title") | |
207 write("label 1, label 2", "labels") | |
208 select("type", "feature request") | |
209 write("this is a test body", "body") | |
210 scroll_down(600) | |
211 click("create list item") | |
212 wait_until(Text("Success").exists) | |
213 assert Link("create").exists() | |
214 assert Link("manage invitations").exists() | |
215 item = Link("test item") | |
216 assert item.exists() | |
217 labels_elt = item.web_element.find_element_by_class_name("xmlui_field__labels") | |
218 labels = [t.text for t in labels_elt.find_elements_by_tag_name("span")] | |
219 assert labels == ["label 1", "label 2"] | |
220 | |
221 @pytest.mark.dependency(depends=["create_generic_list_item"]) | |
222 def test_list_item_can_be_displayed(self): | |
223 go_to(self.TEST_GENERIC_LIST_URL) | |
224 item = Link("test item") | |
225 # FIXME: we can't click on the item created above with Selenium, looks like a | |
226 # Selenium bug, to be checked | |
227 go_to(item.href) | |
228 item_title = Text("test item") | |
229 assert item_title.exists() | |
230 item_body = Text("this is a test body") | |
231 assert item_body.exists() |