-
Notifications
You must be signed in to change notification settings - Fork 165
Fix Text Answer review redirect #2497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
ac7059f
c59b1d2
ad75ce2
cf26335
5ea36bb
63f02cf
f0fac43
ed588f2
ff3efdc
e054633
15435c7
a477cf7
00e86f1
08533d9
328ff7e
3d37fd0
bba37ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| Question, | ||
| Questionnaire, | ||
| Semester, | ||
| TextAnswer, | ||
| UserProfile, | ||
| ) | ||
| from evap.evaluation.tests.tools import LiveServerTest, classes_of_element | ||
|
|
@@ -174,3 +175,65 @@ def test_collapse_without_editor_approved(self) -> None: | |
|
|
||
| counter = card_header.find_element(By.CSS_SELECTOR, ".rounded-pill") | ||
| self.assertEqual(counter.text, "0") | ||
|
|
||
|
|
||
| class TextAnswerEditLiveTest(LiveServerTest): | ||
| def test_edit_textanswer_redirect(self): | ||
| """Regression test for #1696""" | ||
|
|
||
| responsible = baker.make(UserProfile) | ||
| evaluation = baker.make( | ||
| Evaluation, | ||
| course=baker.make(Course, programs=[baker.make(Program)], responsibles=[responsible]), | ||
| vote_start_datetime=datetime(2099, 1, 1, 0, 0), | ||
| vote_end_date=date(2099, 12, 31), | ||
| state=Evaluation.State.EVALUATED, | ||
| can_publish_text_results=True, | ||
| ) | ||
|
|
||
| question1 = baker.make( | ||
| Question, | ||
| ) | ||
geromequa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| general_questionnaire = baker.make(Questionnaire, questions=[question1]) | ||
| evaluation.general_contribution.questionnaires.set([general_questionnaire]) | ||
|
|
||
| contribution1 = baker.make( | ||
| Contribution, evaluation=evaluation, contributor=None, questionnaires=[general_questionnaire] | ||
| ) | ||
|
|
||
| textanswer1 = baker.make( | ||
| TextAnswer, | ||
| question=question1, | ||
| contribution=contribution1, | ||
| answer="this is answer will be edited", | ||
| original_answer=None, | ||
| review_decision=TextAnswer.ReviewDecision.UNDECIDED, | ||
| ) | ||
|
|
||
| baker.make( | ||
| TextAnswer, | ||
| question=question1, | ||
| contribution=contribution1, | ||
| answer="this is a dummy answer", | ||
| original_answer=None, | ||
| review_decision=TextAnswer.ReviewDecision.UNDECIDED, | ||
| ) | ||
|
|
||
| with self.enter_staff_mode(): | ||
| self.selenium.get(self.live_server_url + reverse("staff:evaluation_textanswer_edit", args=[textanswer1.pk])) | ||
geromequa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
geromequa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| textanswer_field = self.selenium.find_element(By.XPATH, "//textarea[@name='answer']") | ||
| submit_btn = self.selenium.find_element(By.ID, "textanswer-edit-submit-button") | ||
|
|
||
| textanswer_field.clear() | ||
| textanswer_field.send_keys("edited answer") | ||
|
|
||
| with self.enter_staff_mode(): | ||
| submit_btn.click() | ||
|
|
||
| answer = self.selenium.find_elements( | ||
| By.XPATH, "//div[@class='slider-item card-body active' and @data-layer='2']" | ||
| ) | ||
|
|
||
| self.assertEqual(str(answer[0].get_attribute("id")).split("-", 1)[1], str(textanswer1.pk)) | ||
|
||
Uh oh!
There was an error while loading. Please reload this page.