-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathtest_user_permissions.py
More file actions
86 lines (68 loc) · 2.3 KB
/
Copy pathtest_user_permissions.py
File metadata and controls
86 lines (68 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
from playwright.sync_api import Page, expect
from e2e_tests.helpers import navigate_to_default_course, login
def test_teacher_permissions(page: Page):
page.goto("http://localhost:8010/?hl=en")
login(page, "teacher", "teacher")
navigate_to_default_course(page)
left_sidebar = page.locator("#main-course-menu")
expect(left_sidebar).to_contain_text("Course staff")
expected_links = [
"Participants",
"Groups",
"All results",
"Visualizations",
"Pseudonymize",
"Edit news",
"Edit course",
"Deadline deviations",
"Submission deviations",
"All submissions",
]
for link in expected_links:
expect(left_sidebar.get_by_role("link", name=link)).to_be_visible()
left_sidebar.get_by_role("link", name="Edit course").click()
expect(page).to_have_title("Edit course | Def. Course | A+")
def test_assistant_permissions(page: Page):
page.goto("http://localhost:8010/?hl=en")
login(page, "assistant", "assistant")
navigate_to_default_course(page)
left_sidebar = page.locator("#main-course-menu")
expect(left_sidebar).to_contain_text("Course staff")
expected_links = [
"Participants",
"Groups",
"Pseudonymize",
]
unexpected_links = [
"All results",
"Visualizations",
"Edit news",
"Edit course",
"Deadline deviations",
"Submission deviations",
"All submissions",
]
for link in expected_links:
expect(left_sidebar.get_by_role("link", name=link)).to_be_visible()
for link in unexpected_links:
expect(left_sidebar.get_by_role("link", name=link)).not_to_be_visible()
def test_student_permissions(page: Page):
page.goto("http://localhost:8010/?hl=en")
login(page, "student", "student")
navigate_to_default_course(page)
left_sidebar = page.locator("#main-course-menu")
expect(left_sidebar).not_to_contain_text("Course staff")
unexpected_links = [
"Participants",
"Groups",
"All results",
"Visualizations",
"Pseudonymize",
"Edit news",
"Edit course",
"Deadline deviations",
"Submission deviations",
"All submissions",
]
for link in unexpected_links:
expect(left_sidebar.get_by_role("link", name=link)).not_to_be_visible()