Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Maximilian Michal
grady
Merge requests
!176
Resolve "Sort updated comments chronoligically"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Sort updated comments chronoligically"
167-sort-updated-comments-chronoligically
into
master
Overview
0
Commits
4
Pipelines
6
Changes
1
Merged
Dominik Seeger
requested to merge
167-sort-updated-comments-chronoligically
into
master
5 years ago
Overview
0
Commits
4
Pipelines
6
Changes
1
Expand
Closes
#167 (closed)
Edited
5 years ago
by
robinwilliam.hundt
0
0
Merge request reports
Viewing commit
d3bc9db6
Prev
Next
Show latest version
1 file
+
4
−
5
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
d3bc9db6
wip on tests
· d3bc9db6
Dominik Seeger
authored
5 years ago
functional_tests/test_feedback_creation.py
+
71
−
1
Options
from
django.test
import
LiveServerTestCase
from
django.test
import
LiveServerTestCase
from
selenium
import
webdriver
from
selenium
import
webdriver
from
selenium.webdriver
import
ActionChains
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.common.by
import
By
from
core.models
import
UserAccount
,
Submission
,
FeedbackComment
from
core.models
import
UserAccount
,
Submission
,
FeedbackComment
from
functional_tests.util
import
(
login
,
create_browser
,
reset_browser_after_test
,
from
functional_tests.util
import
(
login
,
create_browser
,
reset_browser_after_test
,
go_to_subscription
,
wait_until_code_changes
,
go_to_subscription
,
wait_until_code_changes
,
reconstruct_submission_code
)
reconstruct_submission_code
,
wait_until_element_count_equals
)
from
util
import
factory_boys
as
fact
from
util
import
factory_boys
as
fact
@@ -223,6 +225,74 @@ class UntestedParent:
@@ -223,6 +225,74 @@ class UntestedParent:
self
.
assertEqual
(
0
,
submission_for_code
.
feedback
.
score
)
self
.
assertEqual
(
0
,
submission_for_code
.
feedback
.
score
)
self
.
assertEqual
(
1
,
submission_for_code
.
feedback
.
feedback_lines
.
count
())
self
.
assertEqual
(
1
,
submission_for_code
.
feedback
.
feedback_lines
.
count
())
def
test_comments_are_sorted_by_last_updated
(
self
):
self
.
_login
()
go_to_subscription
(
self
)
code
=
reconstruct_submission_code
(
self
)
self
.
browser
.
find_element_by_id
(
'
score-full
'
).
click
()
# give feedback on first line
self
.
write_comments_on_lines
([(
1
,
'
first ever comment
'
)])
submit_btn
=
self
.
browser
.
find_element_by_id
(
'
submit-feedback
'
)
submit_btn
.
click
()
WebDriverWait
(
self
.
browser
,
10
).
until
(
wait_until_code_changes
(
self
,
code
)
)
reset_browser_after_test
(
self
.
browser
,
self
.
live_server_url
)
# logs out user
user_snd
=
'
tutor_snd
'
password
=
'
p
'
fact
.
UserAccountFactory
(
username
=
user_snd
,
password
=
password
)
login
(
self
.
browser
,
self
.
live_server_url
,
user_snd
,
password
)
go_to_subscription
(
self
,
stage
=
'
validate
'
)
self
.
write_comments_on_lines
([(
1
,
'
the second comment
'
)])
self
.
browser
.
find_element_by_id
(
'
score-full
'
).
click
()
self
.
browser
.
find_element_by_class_name
(
'
final-checkbox
'
).
click
()
self
.
browser
.
find_element_by_id
(
'
submit-feedback
'
).
click
()
sub_url
=
'
subscription/
'
+
str
(
self
.
sub_type
.
pk
)
+
'
/ended
'
WebDriverWait
(
self
.
browser
,
10
).
until
(
ec
.
url_contains
(
sub_url
))
reset_browser_after_test
(
self
.
browser
,
self
.
live_server_url
)
# logs out user
self
.
_login
()
# goto history
self
.
browser
.
find_element_by_id
(
'
feedback
'
).
click
()
feedback_entry
=
self
.
browser
.
find_element_by_class_name
(
'
feedback-row
'
)
ActionChains
(
self
.
browser
).
move_to_element
(
feedback_entry
).
click
().
perform
()
# validate that second comment is under the first comment
comments
=
self
.
browser
.
find_elements_by_class_name
(
'
dialog-box
'
)
first_text
=
comments
[
0
].
find_element_by_class_name
(
'
message
'
)
second_text
=
comments
[
1
].
find_element_by_class_name
(
'
message
'
)
self
.
assertEqual
(
len
(
comments
),
2
)
self
.
assertEqual
(
first_text
.
text
,
'
first ever comment
'
)
self
.
assertEqual
(
second_text
.
text
,
'
the second comment
'
)
# give feedback on first line
self
.
write_comments_on_lines
([(
1
,
'
first comment updated
'
)])
self
.
browser
.
find_element_by_id
(
'
score-full
'
).
click
()
self
.
browser
.
find_element_by_id
(
'
submit-feedback
'
).
click
()
WebDriverWait
(
self
.
browser
,
5
).
until
(
wait_until_element_count_equals
(
self
,
By
.
CLASS_NAME
,
"
dialog-box
"
,
2
)
)
# validate that the edited first comment is under the second comment
comments
=
self
.
browser
.
find_elements_by_class_name
(
'
dialog-box
'
)
first_text
=
comments
[
0
].
find_element_by_class_name
(
'
message
'
)
second_text
=
comments
[
1
].
find_element_by_class_name
(
'
message
'
)
self
.
assertEqual
(
first_text
.
text
,
'
the second comment
'
)
self
.
assertEqual
(
second_text
.
text
,
'
first comment updated
'
)
class
TestFeedbackCreationTutor
(
UntestedParent
.
TestFeedbackCreationGeneric
):
class
TestFeedbackCreationTutor
(
UntestedParent
.
TestFeedbackCreationGeneric
):
def
setUp
(
self
):
def
setUp
(
self
):
Loading