Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
b1fc977d
Commit
b1fc977d
authored
Sep 20, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tune tests so that they run on edx-solutions
parent
86307966
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
116 additions
and
110 deletions
+116
-110
tests/integration/test_answer.py
+15
-11
tests/integration/test_mcq.py
+66
-56
tests/integration/test_progression.py
+28
-34
tests/integration/test_table.py
+1
-1
tests/integration/xml/mcq_with_comments_1.xml
+3
-5
tests/integration/xml/progression_1.xml
+1
-1
tests/integration/xml/progression_2.xml
+1
-1
tests/integration/xml/progression_3.xml
+1
-1
No files found.
tests/integration/test_answer.py
View file @
b1fc977d
...
@@ -53,17 +53,19 @@ class AnswerBlockTest(MentoringBaseTest):
...
@@ -53,17 +53,19 @@ class AnswerBlockTest(MentoringBaseTest):
# Initial unsubmitted text
# Initial unsubmitted text
answer1
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer1
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
self
.
assertEqual
(
answer1
.
text
,
''
)
self
.
assertEqual
(
answer1
.
text
,
''
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
# TODO: progress indicator element not available
self
.
assertEqual
(
progress
.
text
,
''
)
#progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#self.assertEqual(progress.text, '')
#self.assertFalse(progress.find_elements_by_xpath('./*'))
# Submit without answer
# Submit without answer
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
self
.
assertEqual
(
answer1
.
get_attribute
(
'value'
),
''
)
self
.
assertEqual
(
answer1
.
get_attribute
(
'value'
),
''
)
# TODO: Cannot test rejection of partial answers, as partial answers
# TODO: Cannot test rejection of partial answers, as partial answers
# are allowed when dependencies are not enforced, even if the block
# are allowed when dependencies are not enforced, even if the block
# reports non-completion.
# reports non-completion.
# TODO: Besides, element no longer available
#self.assertEqual(progress.text, '(Not completed)')
#self.assertEqual(progress.text, '(Not completed)')
#self.assertFalse(progress.find_elements_by_xpath('./*'))
#self.assertFalse(progress.find_elements_by_xpath('./*'))
...
@@ -72,8 +74,9 @@ class AnswerBlockTest(MentoringBaseTest):
...
@@ -72,8 +74,9 @@ class AnswerBlockTest(MentoringBaseTest):
submit
.
click
()
submit
.
click
()
self
.
assertEqual
(
answer1
.
get_attribute
(
'value'
),
'This is the answer'
)
self
.
assertEqual
(
answer1
.
get_attribute
(
'value'
),
'This is the answer'
)
self
.
assertEqual
(
progress
.
text
,
''
)
# TODO: element no longer available
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
#self.assertEqual(progress.text, '')
#self.assertTrue(progress.find_elements_by_css_selector('img'))
# Answer content should show on a different instance with the same name
# Answer content should show on a different instance with the same name
mentoring
=
self
.
go_to_page
(
'Answer Edit 2'
)
mentoring
=
self
.
go_to_page
(
'Answer Edit 2'
)
...
@@ -90,12 +93,13 @@ class AnswerBlockTest(MentoringBaseTest):
...
@@ -90,12 +93,13 @@ class AnswerBlockTest(MentoringBaseTest):
mentoring
=
self
.
go_to_page
(
'Answer Blank Read Only'
)
mentoring
=
self
.
go_to_page
(
'Answer Blank Read Only'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'blockquote.answer.read_only'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'blockquote.answer.read_only'
)
self
.
assertEqual
(
answer
.
text
,
''
)
self
.
assertEqual
(
answer
.
text
,
''
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
# TODO: progress indicator element not available
self
.
assertEqual
(
progress
.
text
,
''
)
#progress = mentoring.find_element_by_css_selector('.progress > .indicator')
#self.assertEqual(progress.text, '')
# Submit should allow to complete
# Submit should allow to complete
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
#
self.assertTrue(progress.find_elements_by_css_selector('img'))
tests/integration/test_mcq.py
View file @
b1fc977d
...
@@ -33,29 +33,46 @@ from mentoring.test_base import MentoringBaseTest
...
@@ -33,29 +33,46 @@ from mentoring.test_base import MentoringBaseTest
class
MCQBlockTest
(
MentoringBaseTest
):
class
MCQBlockTest
(
MentoringBaseTest
):
def
_selenium_bug_workaround_scroll_to
(
self
,
mcq_legend
):
"""Workaround for selenium bug:
Some version of Selenium has a bug that prevents scrolling
to radiobuttons before being clicked. The click not taking
place, when it's outside the view.
Since the bug does not affect other content, asking Selenium
to click on the legend first, will properly scroll it.
"""
mcq_legend
.
click
()
def
_get_inputs
(
self
,
choices
):
return
[
choice
.
find_element_by_css_selector
(
'input'
)
for
choice
in
choices
]
def
test_mcq_choices_rating
(
self
):
def
test_mcq_choices_rating
(
self
):
"""
"""
Mentoring MCQ should display tips according to user choice
Mentoring MCQ should display tips according to user choice
"""
"""
# Initial MCQ status
# Initial MCQ status
mentoring
=
self
.
go_to_page
(
'M
CQ
1'
)
mentoring
=
self
.
go_to_page
(
'M
cq
1'
)
mcq1
=
mentoring
.
find_element_by_css_selector
(
'fieldset.choices'
)
mcq1
=
mentoring
.
find_element_by_css_selector
(
'fieldset.choices'
)
mcq2
=
mentoring
.
find_element_by_css_selector
(
'fieldset.rating'
)
mcq2
=
mentoring
.
find_element_by_css_selector
(
'fieldset.rating'
)
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
# TODO: progress indicator element not available
#progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
messages
.
text
,
''
)
self
.
assertEqual
(
messages
.
text
,
''
)
self
.
assertFalse
(
messages
.
find_elements_by_xpath
(
'./*'
))
self
.
assertFalse
(
messages
.
find_elements_by_xpath
(
'./*'
))
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#
self.assertFalse(progress.find_elements_by_xpath('./*'))
mcq1_legend
=
mcq1
.
find_element_by_css_selector
(
'legend'
)
mcq1_legend
=
mcq1
.
find_element_by_css_selector
(
'legend'
)
mcq2_legend
=
mcq2
.
find_element_by_css_selector
(
'legend'
)
mcq2_legend
=
mcq2
.
find_element_by_css_selector
(
'legend'
)
self
.
assertEqual
(
mcq1_legend
.
text
,
'Do you like this MCQ?'
)
self
.
assertEqual
(
mcq1_legend
.
text
,
'
QUESTION 1
\n
Do you like this MCQ?'
)
self
.
assertEqual
(
mcq2_legend
.
text
,
'How much do you rate this MCQ?'
)
self
.
assertEqual
(
mcq2_legend
.
text
,
'
QUESTION 2
\n
How much do you rate this MCQ?'
)
mcq1_choices
=
mcq1
.
find_elements_by_css_selector
(
'.choices .choice label'
)
mcq1_choices
=
mcq1
.
find_elements_by_css_selector
(
'.choices .choice label'
)
mcq2_choices
=
mcq2
.
find_elements_by_css_selector
(
'.
choices
.choice label'
)
mcq2_choices
=
mcq2
.
find_elements_by_css_selector
(
'.
rating
.choice label'
)
self
.
assertEqual
(
len
(
mcq1_choices
),
3
)
self
.
assertEqual
(
len
(
mcq1_choices
),
3
)
self
.
assertEqual
(
len
(
mcq2_choices
),
6
)
self
.
assertEqual
(
len
(
mcq2_choices
),
6
)
...
@@ -69,19 +86,9 @@ class MCQBlockTest(MentoringBaseTest):
...
@@ -69,19 +86,9 @@ class MCQBlockTest(MentoringBaseTest):
self
.
assertEqual
(
mcq2_choices
[
4
]
.
text
,
'5'
)
self
.
assertEqual
(
mcq2_choices
[
4
]
.
text
,
'5'
)
self
.
assertEqual
(
mcq2_choices
[
5
]
.
text
,
"I don't want to rate it"
)
self
.
assertEqual
(
mcq2_choices
[
5
]
.
text
,
"I don't want to rate it"
)
mcq1_choices_input
=
[
mcq1_choices_input
=
self
.
_get_inputs
(
mcq1_choices
)
mcq1_choices
[
0
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices_input
=
self
.
_get_inputs
(
mcq2_choices
)
mcq1_choices
[
1
]
.
find_element_by_css_selector
(
'input'
),
mcq1_choices
[
2
]
.
find_element_by_css_selector
(
'input'
),
]
mcq2_choices_input
=
[
mcq2_choices
[
0
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices
[
1
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices
[
2
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices
[
3
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices
[
4
]
.
find_element_by_css_selector
(
'input'
),
mcq2_choices
[
5
]
.
find_element_by_css_selector
(
'input'
),
]
self
.
assertEqual
(
mcq1_choices_input
[
0
]
.
get_attribute
(
'value'
),
'yes'
)
self
.
assertEqual
(
mcq1_choices_input
[
0
]
.
get_attribute
(
'value'
),
'yes'
)
self
.
assertEqual
(
mcq1_choices_input
[
1
]
.
get_attribute
(
'value'
),
'maybenot'
)
self
.
assertEqual
(
mcq1_choices_input
[
1
]
.
get_attribute
(
'value'
),
'maybenot'
)
self
.
assertEqual
(
mcq1_choices_input
[
2
]
.
get_attribute
(
'value'
),
'understand'
)
self
.
assertEqual
(
mcq1_choices_input
[
2
]
.
get_attribute
(
'value'
),
'understand'
)
...
@@ -93,82 +100,85 @@ class MCQBlockTest(MentoringBaseTest):
...
@@ -93,82 +100,85 @@ class MCQBlockTest(MentoringBaseTest):
self
.
assertEqual
(
mcq2_choices_input
[
5
]
.
get_attribute
(
'value'
),
'notwant'
)
self
.
assertEqual
(
mcq2_choices_input
[
5
]
.
get_attribute
(
'value'
),
'notwant'
)
# Submit without selecting anything
# Submit without selecting anything
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
time
.
sleep
(
1
)
# TODO: check that the button is not clickable
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
#
tips = messages.find_elements_by_xpath('./*')
self
.
assertEqual
(
len
(
tips
),
2
)
#
self.assertEqual(len(tips), 2)
self
.
assertEqual
(
tips
[
0
]
.
text
,
'To the question "Do you like this MCQ?", you have not provided an answer.'
)
#
self.assertEqual(tips[0].text, 'To the question "Do you like this MCQ?", you have not provided an answer.')
self
.
assertEqual
(
tips
[
1
]
.
text
,
'To the question "How much do you rate this MCQ?", you have not provided an answer.'
)
#
self.assertEqual(tips[1].text, 'To the question "How much do you rate this MCQ?", you have not provided an answer.')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#
self.assertFalse(progress.find_elements_by_xpath('./*'))
# Select only one option
# Select only one option
self
.
_selenium_bug_workaround_scroll_to
(
mcq1
)
mcq1_choices_input
[
1
]
.
click
()
mcq1_choices_input
[
1
]
.
click
()
time
.
sleep
(
1
)
submit
.
click
()
submit
.
click
()
# TODO: check that the button is not clickable
time
.
sleep
(
1
)
#
time.sleep(1)
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
#
tips = messages.find_elements_by_xpath('./*')
self
.
assertEqual
(
len
(
tips
),
2
)
#
self.assertEqual(len(tips), 2)
self
.
assertEqual
(
tips
[
0
]
.
text
,
'To the question "Do you like this MCQ?", you answered "Maybe not".
\n
Ah, damn.'
)
#
self.assertEqual(tips[0].text, 'To the question "Do you like this MCQ?", you answered "Maybe not".\nAh, damn.')
self
.
assertEqual
(
tips
[
1
]
.
text
,
'To the question "How much do you rate this MCQ?", you have not provided an answer.'
)
#
self.assertEqual(tips[1].text, 'To the question "How much do you rate this MCQ?", you have not provided an answer.')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#
self.assertFalse(progress.find_elements_by_xpath('./*'))
# One with only display tip, one with reject tip - should not complete
# One with only display tip, one with reject tip - should not complete
self
.
_selenium_bug_workaround_scroll_to
(
mcq1
)
mcq1_choices_input
[
0
]
.
click
()
mcq1_choices_input
[
0
]
.
click
()
mcq2_choices_input
[
2
]
.
click
()
mcq2_choices_input
[
2
]
.
click
()
time
.
sleep
(
1
)
submit
.
click
()
submit
.
click
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
self
.
assertEqual
(
len
(
tips
),
2
)
self
.
assertEqual
(
mcq1
.
find_element_by_css_selector
(
".feedback"
)
.
text
,
'Great!'
)
self
.
assertEqual
(
tips
[
0
]
.
text
,
'To the question "Do you like this MCQ?", you answered "Yes".
\n
Great!'
)
self
.
assertEqual
(
mcq2
.
find_element_by_css_selector
(
".feedback"
)
.
text
,
'Will do better next time...'
)
self
.
assertEqual
(
tips
[
1
]
.
text
,
'To the question "How much do you rate this MCQ?", you answered "3".
\n
Will do better next time...'
)
#self.assertEqual(progress.text, '')
self
.
assertEqual
(
progress
.
text
,
''
)
#self.assertFalse(progress.find_elements_by_xpath('./*'))
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
# Only display tips, to allow to complete
# Only display tips, to allow to complete
self
.
_selenium_bug_workaround_scroll_to
(
mcq1
)
mcq1_choices_input
[
0
]
.
click
()
mcq1_choices_input
[
0
]
.
click
()
mcq2_choices_input
[
3
]
.
click
()
mcq2_choices_input
[
3
]
.
click
()
submit
.
click
()
submit
.
click
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
tips
=
messages
.
find_elements_by_xpath
(
'./*'
)
self
.
assertEqual
(
len
(
tips
),
3
)
self
.
assertEqual
(
mcq1
.
find_element_by_css_selector
(
".feedback"
)
.
text
,
'Great!'
)
self
.
assertEqual
(
tips
[
0
]
.
text
,
'To the question "Do you like this MCQ?", you answered "Yes".
\n
Great!'
)
self
.
assertEqual
(
mcq2
.
find_element_by_css_selector
(
".feedback"
)
.
text
,
'I love good grades.'
)
self
.
assertEqual
(
tips
[
1
]
.
text
,
'To the question "How much do you rate this MCQ?", you answered "4".
\n
I love good grades.'
)
self
.
assertEqual
(
messages
.
text
,
'FEEDBACK
\n
All is good now...
\n
Congratulations!'
)
self
.
assertEqual
(
tips
[
2
]
.
text
,
'Congratulations!
\n
All is good now...'
)
# Includes child <html>
#self.assertEqual(progress.text, '')
self
.
assertEqual
(
progress
.
text
,
''
)
#self.assertTrue(progress.find_elements_by_css_selector('img'))
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
def
test_mcq_with_comments
(
self
):
def
test_mcq_with_comments
(
self
):
mentoring
=
self
.
go_to_page
(
'M
CQ
With Comments 1'
)
mentoring
=
self
.
go_to_page
(
'M
cq
With Comments 1'
)
mcq
=
mentoring
.
find_element_by_css_selector
(
'fieldset.choices'
)
mcq
=
mentoring
.
find_element_by_css_selector
(
'fieldset.choices'
)
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
# TODO: progress indicator element not available
#progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
messages
.
text
,
''
)
self
.
assertEqual
(
messages
.
text
,
''
)
self
.
assertFalse
(
messages
.
find_elements_by_xpath
(
'./*'
))
self
.
assertFalse
(
messages
.
find_elements_by_xpath
(
'./*'
))
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#
self.assertFalse(progress.find_elements_by_xpath('./*'))
mcq_legend
=
mcq
.
find_element_by_css_selector
(
'legend'
)
mcq_legend
=
mcq
.
find_element_by_css_selector
(
'legend'
)
self
.
assertEqual
(
mcq_legend
.
text
,
'
Do you like this MC
Q?'
)
self
.
assertEqual
(
mcq_legend
.
text
,
'
QUESTION
\n
What do you like in this MR
Q?'
)
mcq_choices
=
mcq
.
find_elements_by_css_selector
(
'.choices .choice label'
)
mcq_choices
=
mcq
.
find_elements_by_css_selector
(
'.choices .choice label'
)
self
.
assertEqual
(
len
(
mcq_choices
),
3
)
self
.
assertEqual
(
len
(
mcq_choices
),
4
)
self
.
assertEqual
(
mcq_choices
[
0
]
.
text
,
'Its elegance'
)
self
.
assertEqual
(
mcq_choices
[
0
]
.
text
,
'Its elegance'
)
self
.
assertEqual
(
mcq_choices
[
1
]
.
text
,
'Its beauty'
)
self
.
assertEqual
(
mcq_choices
[
1
]
.
text
,
'Its beauty'
)
self
.
assertEqual
(
mcq_choices
[
2
]
.
text
,
"Its gracefulness"
)
self
.
assertEqual
(
mcq_choices
[
2
]
.
text
,
"Its gracefulness"
)
self
.
assertEqual
(
mcq_choices
[
3
]
.
text
,
"Its bugs"
)
self
.
assertEqual
(
mcq_choices
[
3
]
.
text
,
"Its bugs"
)
mcq_choices_input
=
[
mcq_choices_input
=
self
.
_get_inputs
(
mcq_choices
)
mcq_choices
[
0
]
.
find_element_by_css_selector
(
'input'
),
mcq_choices
[
1
]
.
find_element_by_css_selector
(
'input'
),
mcq_choices
[
2
]
.
find_element_by_css_selector
(
'input'
),
]
self
.
assertEqual
(
mcq_choices_input
[
0
]
.
get_attribute
(
'value'
),
'elegance'
)
self
.
assertEqual
(
mcq_choices_input
[
0
]
.
get_attribute
(
'value'
),
'elegance'
)
self
.
assertEqual
(
mcq_choices_input
[
1
]
.
get_attribute
(
'value'
),
'beauty'
)
self
.
assertEqual
(
mcq_choices_input
[
1
]
.
get_attribute
(
'value'
),
'beauty'
)
self
.
assertEqual
(
mcq_choices_input
[
2
]
.
get_attribute
(
'value'
),
'gracefulness'
)
self
.
assertEqual
(
mcq_choices_input
[
2
]
.
get_attribute
(
'value'
),
'gracefulness'
)
...
...
tests/integration/test_progression.py
View file @
b1fc977d
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
# Imports ###########################################################
# Imports ###########################################################
import
time
from
mentoring.test_base
import
MentoringBaseTest
from
mentoring.test_base
import
MentoringBaseTest
...
@@ -51,43 +53,32 @@ class MentoringProgressionTest(MentoringBaseTest):
...
@@ -51,43 +53,32 @@ class MentoringProgressionTest(MentoringBaseTest):
# Initial - Step 1 ok, steps 2&3 redirect to step 1
# Initial - Step 1 ok, steps 2&3 redirect to step 1
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
self
.
assert_warning_is_hidden
(
mentoring
)
self
.
assert_warning_is_hidden
(
mentoring
)
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
self
.
assertFalse
(
submit
.
is_enabled
())
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
self
.
assertFalse
(
submit
.
is_enabled
())
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
# Submit step 1 without completing it - no change should be registered
self
.
assertFalse
(
submit
.
is_enabled
())
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'input.submit'
)
submit
.
click
()
self
.
assert_warning_is_hidden
(
mentoring
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
self
.
assertEqual
(
progress
.
text
,
''
)
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/mentoring_first'
)
# Should be impossible to complete step 2
# Should be impossible to complete step 2
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
.
send_keys
(
'This is the answer'
)
answer
.
send_keys
(
'This is the answer'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
time
.
sleep
(
1
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
#
progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertFalse
(
progress
.
find_elements_by_xpath
(
'./*'
))
#
self.assertFalse(progress.find_elements_by_xpath('./*'))
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
...
@@ -101,29 +92,32 @@ class MentoringProgressionTest(MentoringBaseTest):
...
@@ -101,29 +92,32 @@ class MentoringProgressionTest(MentoringBaseTest):
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
.
send_keys
(
'This is the answer'
)
answer
.
send_keys
(
'This is the answer'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
self
.
assert_warning_is_hidden
(
mentoring
)
self
.
assert_warning_is_hidden
(
mentoring
)
time
.
sleep
(
1
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
#
progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
#
self.assertTrue(progress.find_elements_by_css_selector('img'))
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
self
.
assert_warning_is_hidden
(
mentoring
)
self
.
assert_warning_is_hidden
(
mentoring
)
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/progression_2'
)
self
.
assert_warning
(
warning
,
'/jump_to_id/progression_2'
)
# Complete step 2 - no more warnings anywhere
# Complete step 2 - no more warnings anywhere
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
# Already filled the textarea in previous step
submit
.
click
()
# Already filled the textarea in previous step
time
.
sleep
(
1
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
#
progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
#
self.assertTrue(progress.find_elements_by_css_selector('img'))
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
mentoring
=
self
.
go_to_page
(
'Progression 1'
)
self
.
assert_warning_is_hidden
(
mentoring
)
self
.
assert_warning_is_hidden
(
mentoring
)
...
@@ -138,10 +132,10 @@ class MentoringProgressionTest(MentoringBaseTest):
...
@@ -138,10 +132,10 @@ class MentoringProgressionTest(MentoringBaseTest):
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
mentoring
=
self
.
go_to_page
(
'Progression 3'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'textarea'
)
answer
.
send_keys
(
'This is the answer'
)
answer
.
send_keys
(
'This is the answer'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
#
progress = mentoring.find_element_by_css_selector('.progress > .indicator')
self
.
assertEqual
(
progress
.
text
,
''
)
#
self.assertEqual(progress.text, '')
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
#
self.assertTrue(progress.find_elements_by_css_selector('img'))
tests/integration/test_table.py
View file @
b1fc977d
...
@@ -48,7 +48,7 @@ class MentoringTableBlockTest(MentoringBaseTest):
...
@@ -48,7 +48,7 @@ class MentoringTableBlockTest(MentoringBaseTest):
answers
=
mentoring
.
find_elements_by_css_selector
(
'textarea'
)
answers
=
mentoring
.
find_elements_by_css_selector
(
'textarea'
)
answers
[
0
]
.
send_keys
(
'This is the answer #1'
)
answers
[
0
]
.
send_keys
(
'This is the answer #1'
)
answers
[
1
]
.
send_keys
(
'This is the answer #2'
)
answers
[
1
]
.
send_keys
(
'This is the answer #2'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
input.submit
'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'
.submit input.input-main
'
)
submit
.
click
()
submit
.
click
()
table
=
self
.
go_to_page
(
'Table 2'
,
css_selector
=
'.mentoring-table'
)
table
=
self
.
go_to_page
(
'Table 2'
,
css_selector
=
'.mentoring-table'
)
...
...
tests/integration/xml/mcq_with_comments_1.xml
View file @
b1fc977d
<vertical>
<vertical
_demo
>
<mentoring
url_name=
"m
entoring-87043a1f-f14a-4813-b89f-3e051939a7ee"
display_name=
"MRQ Exercise 7"
weight=
"1
"
>
<mentoring
url_name=
"m
cq_with_comments"
display_name=
"MRQ Exercise 7"
weight=
"1"
enforce_dependency=
"false
"
>
<title>
MRQ With Resizable popups
</title>
<title>
MRQ With Resizable popups
</title>
<mrq
name=
"mrq_1_1_7"
type=
"choices"
>
<mrq
name=
"mrq_1_1_7"
type=
"choices"
>
<question>
What do you like in this MRQ?
</question>
<question>
What do you like in this MRQ?
</question>
...
@@ -12,8 +12,6 @@
...
@@ -12,8 +12,6 @@
<tip
require=
"elegance"
width =
"600"
height =
"800"
>
This is something everyone has to like about this MRQ
</tip>
<tip
require=
"elegance"
width =
"600"
height =
"800"
>
This is something everyone has to like about this MRQ
</tip>
<tip
require=
"beauty"
width =
"400"
height =
"600"
>
This is something everyone has to like about beauty
</tip>
<tip
require=
"beauty"
width =
"400"
height =
"600"
>
This is something everyone has to like about beauty
</tip>
<tip
reject=
"bugs"
width =
"100"
height =
"200"
>
Nah, there isn\'t any!
</tip>
<tip
reject=
"bugs"
width =
"100"
height =
"200"
>
Nah, there isn\'t any!
</tip>
<!--<message type="on-submit">Thank you for answering!</message> -->
</mrq>
</mrq>
<message
type=
"completed"
>
<message
type=
"completed"
>
...
@@ -23,4 +21,4 @@
...
@@ -23,4 +21,4 @@
<html><p>
Still some work to do...
</p></html>
<html><p>
Still some work to do...
</p></html>
</message>
</message>
</mentoring>
</mentoring>
</vertical>
</vertical
_demo
>
tests/integration/xml/progression_1.xml
View file @
b1fc977d
<vertical_demo>
<vertical_demo>
<mentoring
url_name=
"mentoring_first"
followed_by=
"progression_2"
>
<mentoring
url_name=
"mentoring_first"
followed_by=
"progression_2"
enforce_dependency=
"true"
>
<answer
name=
"progression_1_answer"
/>
<answer
name=
"progression_1_answer"
/>
</mentoring>
</mentoring>
</vertical_demo>
</vertical_demo>
tests/integration/xml/progression_2.xml
View file @
b1fc977d
<vertical_demo>
<vertical_demo>
<mentoring
url_name=
"progression_2"
followed_by=
"progression_3"
>
<mentoring
url_name=
"progression_2"
followed_by=
"progression_3"
enforce_dependency=
"true"
>
<answer
name=
"progression_2_answer"
/>
<answer
name=
"progression_2_answer"
/>
</mentoring>
</mentoring>
</vertical_demo>
</vertical_demo>
tests/integration/xml/progression_3.xml
View file @
b1fc977d
<vertical_demo>
<vertical_demo>
<mentoring
url_name=
"progression_3"
>
<mentoring
url_name=
"progression_3"
enforce_dependency=
"true"
>
<answer
name=
"progression_3_answer"
/>
<answer
name=
"progression_3_answer"
/>
</mentoring>
</mentoring>
</vertical_demo>
</vertical_demo>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment