mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
Merge branch 'MDL-75913-401' of https://github.com/davewoloszyn/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
de329f8268
@ -1,5 +1,4 @@
|
||||
# This feature has Atto-specific steps. See MDL-75913 for further details.
|
||||
@customfield @customfield_textarea @javascript @_file_upload @editor_atto
|
||||
@customfield @customfield_textarea @javascript @editor_tiny
|
||||
Feature: Default value for the textarea custom field can contain images
|
||||
In order to see images on custom fields
|
||||
As a manager
|
||||
@ -25,21 +24,18 @@ Feature: Default value for the textarea custom field can contain images
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
# Upload an image into the private files.
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| admin | lib/tests/fixtures/gd-logo.png | gd-logo.png |
|
||||
And I log in as "admin"
|
||||
And I follow "Manage private files"
|
||||
And I upload "lib/tests/fixtures/gd-logo.png" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
And I navigate to "Courses > Course custom fields" in site administration
|
||||
And I click on "Add a new custom field" "link"
|
||||
And I click on "Text area" "link"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test field |
|
||||
| Short name | testfield |
|
||||
| Default value | v |
|
||||
# Embed the image into Default value.
|
||||
And I select the text in the "Default value" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "Default value" "form_row"
|
||||
And I click on "Image" "button" in the "Default value" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "gd-logo.png" "link"
|
||||
@ -55,17 +51,19 @@ Feature: Default value for the textarea custom field can contain images
|
||||
|
||||
Scenario: Teacher will see textarea default value when editing a course created before custom field was created
|
||||
# Teacher will see the image when editing existing course.
|
||||
And I log in as "teacher"
|
||||
When I log in as "teacher"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
Then "//img[contains(@src, 'draftfile.php') and contains(@src, '/gd-logo.png') and @alt='Example']" "xpath_element" should exist in the "Test field" "form_row"
|
||||
And I switch to the "Test field" TinyMCE editor iframe
|
||||
Then "//img[contains(@src, 'draftfile.php') and contains(@src, '/gd-logo.png') and @alt='Example']" "xpath_element" should exist
|
||||
And I switch to the main frame
|
||||
# Save the course without changing the default value.
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
# Now the same image is displayed as "value" and not as "defaultvalue".
|
||||
And I am on site homepage
|
||||
And "//img[contains(@src, '/customfield_textarea/defaultvalue/')]" "xpath_element" should not exist
|
||||
Then "//img[contains(@src, '/customfield_textarea/defaultvalue/')]" "xpath_element" should not exist
|
||||
And the image at "//*[contains(@class, 'frontpage-course-list-all')]//*[contains(@class, 'customfield_textarea')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/customfield_textarea/value/') and @alt='Example']" "xpath_element" should be identical to "lib/tests/fixtures/gd-logo.png"
|
||||
|
||||
Scenario: Manager can create a course and the default value for textarea custom field will apply.
|
||||
@ -76,9 +74,11 @@ Feature: Default value for the textarea custom field can contain images
|
||||
| Course full name | Course 2 |
|
||||
| Course short name | C2 |
|
||||
And I expand all fieldsets
|
||||
Then "//img[contains(@src, 'draftfile.php') and contains(@src, '/gd-logo.png') and @alt='Example']" "xpath_element" should exist in the "Test field" "form_row"
|
||||
And I switch to the "Test field" TinyMCE editor iframe
|
||||
Then "//img[contains(@src, 'draftfile.php') and contains(@src, '/gd-logo.png') and @alt='Example']" "xpath_element" should exist
|
||||
And I switch to the main frame
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
# Now the same image is displayed as "value" and not as "defaultvalue".
|
||||
And I am on site homepage
|
||||
And the image at "//*[contains(@class, 'frontpage-course-list-all')]//*[contains(@class, 'customfield_textarea')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/customfield_textarea/value/') and @alt='Example']" "xpath_element" should be identical to "lib/tests/fixtures/gd-logo.png"
|
||||
Then the image at "//*[contains(@class, 'frontpage-course-list-all')]//*[contains(@class, 'customfield_textarea')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/customfield_textarea/value/') and @alt='Example']" "xpath_element" should be identical to "lib/tests/fixtures/gd-logo.png"
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This feature has Atto-specific steps. See MDL-75913 for further details.
|
||||
@core @core_course @core_customfield @javascript @editor_atto
|
||||
@core @core_course @core_customfield @javascript
|
||||
Feature: Teachers can edit course custom fields
|
||||
In order to have additional data on the course
|
||||
As a teacher
|
||||
@ -28,6 +28,9 @@ Feature: Teachers can edit course custom fields
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| admin | lib/tests/fixtures/gd-logo.png | gd-logo.png |
|
||||
|
||||
Scenario: Display custom fields on course edit form
|
||||
When I log in as "teacher1"
|
||||
@ -74,16 +77,12 @@ Feature: Teachers can edit course custom fields
|
||||
| Field 5 | b |
|
||||
And I log out
|
||||
|
||||
@javascript @_file_upload
|
||||
@javascript @editor_tiny
|
||||
Scenario: Use images in the custom field description
|
||||
When I log in as "admin"
|
||||
And I follow "Manage private files"
|
||||
And I upload "lib/tests/fixtures/gd-logo.png" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
And I navigate to "Courses > Course custom fields" in site administration
|
||||
And I click on "Edit" "link" in the "Field 1" "table_row"
|
||||
And I select the text in the "Description" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "Description" "form_row"
|
||||
And I click on "Image" "button" in the "Description" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "gd-logo.png" "link"
|
||||
@ -111,9 +110,9 @@ Feature: Teachers can edit course custom fields
|
||||
Then I should see "You must supply a value here" in the "Short name" "form_row"
|
||||
And I set the field "Short name" to "short name"
|
||||
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
||||
And I should see "The short name can only contain alphanumeric lowercase characters and underscores (_)." in the "Short name" "form_row"
|
||||
Then I should see "The short name can only contain alphanumeric lowercase characters and underscores (_)." in the "Short name" "form_row"
|
||||
And I set the field "Short name" to "f1"
|
||||
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
||||
And I should see "Short name already exists" in the "Short name" "form_row"
|
||||
Then I should see "Short name already exists" in the "Short name" "form_row"
|
||||
And I click on "Cancel" "button" in the "Adding a new Short text" "dialogue"
|
||||
And I log out
|
||||
|
@ -7,17 +7,13 @@ Feature: Render H5P content using filters
|
||||
| shortname | fullname |
|
||||
| C1 | Course 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
||||
| page | PageName2 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
@ -27,51 +23,36 @@ Feature: Render H5P content using filters
|
||||
|
||||
@javascript @external
|
||||
Scenario: Render an external H5P content URL.
|
||||
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
||||
And I set the field "Page content" to "<div>Go for it</div>https://moodle.h5p.com/content/1290772960722742119/embed"
|
||||
When I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <div>Go for it</div>https://moodle.h5p.com/content/1290772960722742119/embed | 1 | 1 |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "Lorum ipsum"
|
||||
|
||||
@javascript
|
||||
Scenario: Add an external H5P content URL in a link with the URL. Should be rendered.
|
||||
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
||||
# This content won't be displayed, so this scenario shouldn't be labeled as external.
|
||||
And I set the field "Page content" to "<a href='https://moodle.h5p.com/content/1290772960722742119/embed'>https://moodle.h5p.com/content/1290772960722742119/embed</a>"
|
||||
When I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <a href='https://moodle.h5p.com/content/1290772960722742119/embed'>https://moodle.h5p.com/content/1290772960722742119/embed</a> | 1 | 1 |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "Lorum ipsum"
|
||||
|
||||
Scenario: Add an external H5P content URL in a link with text. Shouldn't be rendered.
|
||||
Given I am on the PageName1 "page activity editing" page logged in as teacher1
|
||||
# This content won't be displayed, so this scenario shouldn't be labeled as external.
|
||||
And I set the field "Page content" to "<a href='https://moodle.h5p.com/content/1290772960722742119/embed'>Here you are the content</a>"
|
||||
When I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <a href='https://moodle.h5p.com/content/1290772960722742119/embed'>Here you are the content</a> | 1 | 1 |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
Then ".h5p-iframe" "css_element" should not exist
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@javascript @editor_atto
|
||||
@javascript
|
||||
Scenario: Render a local H5P file as admin
|
||||
Given I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | ipsumFile |
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
|
||||
And I press "Save and return to course"
|
||||
And I am on the PageName1 "page activity editing" page
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "ipsumFile (File)" "link"
|
||||
And I click on "ipsums.h5p" "link"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
When I click on "Save and display" "button"
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber | [[files::content]] |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1 | 1 | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
And I should see "PageName1" in the "page-header" "region"
|
||||
# Switch to iframe created by filter
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
@ -85,88 +66,43 @@ Feature: Render H5P content using filters
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Switch to iframe created by embed.php page
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "you don't have access"
|
||||
Then I should not see "you don't have access"
|
||||
And I should see "Lorum ipsum"
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@javascript @editor_atto
|
||||
@javascript
|
||||
Scenario: Render a local H5P file as teacher
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | ipsumFile |
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
|
||||
And I press "Save and return to course"
|
||||
And I am on the PageName1 "page activity editing" page
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "ipsumFile (File)" "link"
|
||||
And I click on "ipsums.h5p" "link"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
When I click on "Save and display" "button"
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber | [[files::content]] |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1 | 1 | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::teacher1 |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
And I should see "PageName1" in the "page-header" "region"
|
||||
# Switch to iframe created by filter
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries."
|
||||
And I should see "missing-required-library"
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@javascript @editor_atto
|
||||
@javascript
|
||||
Scenario: Render a local H5P file with existing libraries
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | ipsumFileTeacher |
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
|
||||
And I press "Save and return to course"
|
||||
And I am on the PageName1 "page activity editing" page
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "ipsumFileTeacher (File)" "link"
|
||||
And I click on "ipsums.h5p" "link"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber | [[files::content]] |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1 | 1 | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::teacher1 |
|
||||
| page | PageName2 | PageDesc2 | 1 | C1 | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1 | 1 | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p::admin |
|
||||
When I am on the PageName1 "page activity" page logged in as teacher1
|
||||
And I should see "PageName1" in the "page-header" "region"
|
||||
# Switch to iframe created by filter
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Libraries don't exist, so an error should be displayed.
|
||||
And I should see "missing-required-library"
|
||||
Then I should see "missing-required-library"
|
||||
And I switch to the main frame
|
||||
And I log out
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | ipsumFile |
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
|
||||
And I press "Save and return to course"
|
||||
And I am on the PageName2 "page activity editing" page
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "ipsumFile (File)" "link"
|
||||
And I click on "ipsums.h5p" "link"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
And I am on the PageName2 "page activity" page logged in as admin
|
||||
And I should see "PageName2" in the "page-header" "region"
|
||||
# Switch to iframe created by filter
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Switch to iframe created by embed.php page
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Libraries have been installed.
|
||||
And I should see "Lorum ipsum"
|
||||
Then I should see "Lorum ipsum"
|
||||
And I switch to the main frame
|
||||
And I log out
|
||||
And I am on the PageName1 "page activity" page logged in as teacher1
|
||||
# Switch to iframe created by filter
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
@ -175,29 +111,18 @@ Feature: Render H5P content using filters
|
||||
Then I should not see "missing-required-library"
|
||||
And I should see "Lorum ipsum"
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@javascript @editor_atto
|
||||
@javascript
|
||||
Scenario: Render local H5P file with a disabled main library
|
||||
Given I log in as "admin"
|
||||
# Upload H5P file to private files.
|
||||
And I follow "Manage private files..."
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber | [[files::content]] |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | <p>H5P Activity:</p><div class="h5p-placeholder">@@PLUGINFILE@@/ipsums.h5p</div> | 1 | 1 | h5p/tests/fixtures/ipsums.h5p::ipsums.h5p |
|
||||
When I am logged in as "admin"
|
||||
# Upload manually the H5P content-type library and disable it.
|
||||
And I navigate to "H5P > Manage H5P content types" in site administration
|
||||
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "H5P content type" filemanager
|
||||
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
|
||||
And I click on "Disable" "link" in the "Accordion" "table_row"
|
||||
# Add H5P content to the page.
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the PageName1 "page activity editing" page
|
||||
When I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "ipsums.h5p" "link"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I click on "Save and display" "button"
|
||||
And I am on the PageName1 "page activity" page logged in as admin
|
||||
And I should see "PageName1" in the "page-header" "region"
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Library is disabled, so an error should be displayed.
|
||||
@ -212,7 +137,7 @@ Feature: Render H5P content using filters
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
# Switch to iframe created by embed.php page.
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Lorum ipsum"
|
||||
Then I should see "Lorum ipsum"
|
||||
And I should not see "This file can't be displayed because its content type is disabled."
|
||||
And I switch to the main frame
|
||||
And I navigate to "H5P > Manage H5P content types" in site administration
|
||||
@ -220,6 +145,6 @@ Feature: Render H5P content using filters
|
||||
# Library is disabled again, so an error should be displayed.
|
||||
And I am on the PageName1 "page activity" page
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "This file can't be displayed because its content type is disabled."
|
||||
Then I should see "This file can't be displayed because its content type is disabled."
|
||||
And I should not see "Lorum ipsum"
|
||||
And I switch to the main frame
|
||||
|
@ -287,6 +287,12 @@ class behat_core_generator extends behat_generator_base {
|
||||
'required' => array('contextlevel', 'reference', 'contenttype', 'user', 'contentname'),
|
||||
'switchids' => array('user' => 'userid')
|
||||
],
|
||||
'user private files' => [
|
||||
'singular' => 'user private file',
|
||||
'datagenerator' => 'user_private_files',
|
||||
'required' => ['user', 'filepath', 'filename'],
|
||||
'switchids' => ['user' => 'userid']
|
||||
],
|
||||
'badge external backpacks' => [
|
||||
'singular' => 'badge external backpack',
|
||||
'datagenerator' => 'badge_external_backpack',
|
||||
@ -1054,6 +1060,34 @@ class behat_core_generator extends behat_generator_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create content in the given user's private files.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function process_user_private_files(array $data) {
|
||||
global $CFG;
|
||||
|
||||
$userid = $data['userid'];
|
||||
$fs = get_file_storage();
|
||||
$filepath = "{$CFG->dirroot}/{$data['filepath']}";
|
||||
|
||||
if (!file_exists($filepath)) {
|
||||
throw new coding_exception("File '{$filepath}' does not exist");
|
||||
}
|
||||
$filerecord = [
|
||||
'userid' => $userid,
|
||||
'contextid' => context_user::instance($userid)->id,
|
||||
'component' => 'user',
|
||||
'filearea' => 'private',
|
||||
'itemid' => 0,
|
||||
'filepath' => '/',
|
||||
'filename' => basename($filepath),
|
||||
];
|
||||
$fs->create_file_from_pathname($filerecord, $filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a exetrnal backpack.
|
||||
*
|
||||
|
@ -461,4 +461,21 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
$this->execute('behat_general::i_click_on', [$button, 'NodeElement']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the TinyMCE iframe using a selector.
|
||||
*
|
||||
* @param string $editorlocator
|
||||
*
|
||||
* @When /^I switch to the "(?P<editorlocator_string>(?:[^"]|\\")*)" TinyMCE editor iframe$/
|
||||
*/
|
||||
public function switch_to_tiny_iframe(string $editorlocator): void {
|
||||
$this->require_tiny_tags();
|
||||
|
||||
// Get the iframe name for this editor.
|
||||
$iframename = $this->get_editor_iframe_name($editorlocator);
|
||||
|
||||
// Switch to it.
|
||||
$this->execute('behat_general::switch_to_iframe', [$iframename]);
|
||||
}
|
||||
}
|
||||
|
@ -86,4 +86,95 @@ abstract class component_generator_base {
|
||||
|
||||
\core\session\manager::set_user($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the instance record, inserting any files that are referenced.
|
||||
*
|
||||
* @param stdClass $instance The instance record of the already-created record
|
||||
* @param stdClass $record The data passed in to create the instance
|
||||
* @param string $table The table that the data exists in
|
||||
* @param context $context The context of the instance
|
||||
* @param string $component The component of the owning plugin
|
||||
* @param string $filearea The name of the file area
|
||||
* @param int $targetitemid The itemid to use when saving the files
|
||||
* @return stdClass The updated instance record
|
||||
*/
|
||||
protected function insert_files(
|
||||
stdClass $instance,
|
||||
stdClass $record,
|
||||
string $table,
|
||||
context $context,
|
||||
string $component,
|
||||
string $filearea,
|
||||
int $targetitemid
|
||||
): stdClass {
|
||||
global $CFG, $DB, $USER;
|
||||
|
||||
$fieldname = "[[files::{$filearea}]]";
|
||||
if (!isset($record->$fieldname)) {
|
||||
return $instance;
|
||||
}
|
||||
|
||||
preg_match('/\[\[files::(.*)\]\]/', $fieldname, $matches);
|
||||
if (empty($matches[1])) {
|
||||
throw new coding_exception('Invalid file field name: ' . $fieldname);
|
||||
}
|
||||
|
||||
$referencedfieldname = trim($matches[1]);
|
||||
if (!isset($record->$referencedfieldname)) {
|
||||
throw new coding_exception("File field '{$fieldname}' references non-existent field '{$referencedfieldname}'");
|
||||
}
|
||||
|
||||
$fs = get_file_storage();
|
||||
$itemid = file_get_unused_draft_itemid();
|
||||
$itemidfieldname = "{$referencedfieldname}[itemid]";
|
||||
$record->$itemidfieldname = $itemid;
|
||||
|
||||
$filenames = explode(',', $record->$fieldname);
|
||||
foreach ($filenames as $filename) {
|
||||
$filename = trim($filename);
|
||||
if (!$filename) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$explodedfilename = explode('::', $filename, 3);
|
||||
if (count($explodedfilename) === 2) {
|
||||
[$sourcefile, $targetfile] = $explodedfilename;
|
||||
$user = $USER;
|
||||
} else {
|
||||
[$sourcefile, $targetfile, $username] = $explodedfilename;
|
||||
$user = \core_user::get_user_by_username($username);
|
||||
}
|
||||
$filepath = "{$CFG->dirroot}/{$sourcefile}";
|
||||
if (!file_exists($filepath)) {
|
||||
throw new coding_exception("File '{$filepath}' does not exist");
|
||||
}
|
||||
$filerecord = [
|
||||
'userid' => $user->id,
|
||||
'contextid' => context_user::instance($user->id)->id,
|
||||
'component' => 'user',
|
||||
'filearea' => 'draft',
|
||||
'itemid' => $itemid,
|
||||
'filepath' => '/' . dirname($targetfile),
|
||||
'filename' => basename($targetfile),
|
||||
];
|
||||
$fs->create_file_from_pathname($filerecord, $filepath);
|
||||
}
|
||||
|
||||
$olduser = $USER;
|
||||
$this->set_user($user);
|
||||
$instance->$referencedfieldname = file_save_draft_area_files(
|
||||
$itemid,
|
||||
$context->id,
|
||||
$component,
|
||||
$referencedfieldname,
|
||||
$targetitemid,
|
||||
null,
|
||||
$instance->$referencedfieldname
|
||||
);
|
||||
$this->set_user($olduser);
|
||||
|
||||
$DB->update_record($table, $instance);
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
@ -200,6 +200,7 @@ abstract class testing_module_generator extends component_generator_base {
|
||||
'conditionfieldgroup' => array(),
|
||||
'conditioncompletiongroup' => array()
|
||||
);
|
||||
|
||||
foreach ($defaults as $key => $value) {
|
||||
if (!isset($moduleinfo->$key)) {
|
||||
$moduleinfo->$key = $value;
|
||||
@ -277,9 +278,21 @@ abstract class testing_module_generator extends component_generator_base {
|
||||
$moduleinfo = add_moduleinfo($record, $course);
|
||||
|
||||
// Prepare object to return with additional field cmid.
|
||||
$instance = $DB->get_record($this->get_modulename(), array('id' => $moduleinfo->instance), '*', MUST_EXIST);
|
||||
$modulename = $this->get_modulename();
|
||||
$instance = $DB->get_record($modulename, ['id' => $moduleinfo->instance], '*', MUST_EXIST);
|
||||
$instance->cmid = $moduleinfo->coursemodule;
|
||||
|
||||
// Insert files for the 'intro' file area.
|
||||
$instance = $this->insert_files(
|
||||
$instance,
|
||||
$record,
|
||||
$modulename,
|
||||
\context_module::instance($instance->cmid),
|
||||
"mod_{$modulename}",
|
||||
'intro',
|
||||
0
|
||||
);
|
||||
|
||||
// If the theme was initialised while creating the module instance, something somewhere called an output
|
||||
// function. Rather than leaving this as a hard-to-debug situation, let's make it fail with a clear error.
|
||||
$outputstartedafter = $PAGE->get_where_theme_was_initialised();
|
||||
|
@ -4,7 +4,8 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
|
||||
As a teacher
|
||||
I need to be able to edit the feedback for a students previous submission attempt.
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
# Atto is necessary to use in this test to circumvent an error in Firefox when using Tiny.
|
||||
# See issue MDL-77740 for more context, although that implementation does not fix it here.
|
||||
@javascript @editor_atto
|
||||
Scenario: Edit feedback for a students previous attempt.
|
||||
Given the following "courses" exist:
|
||||
|
@ -1,5 +1,4 @@
|
||||
# This feature has Atto-specific steps. See MDL-75913 for further details.
|
||||
@mod @mod_lesson @editor_atto
|
||||
@mod @mod_lesson @javascript @editor_tiny
|
||||
Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
In order to duplicate a lesson page
|
||||
As a teacher
|
||||
@ -24,14 +23,13 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| teacher1 | mod/lesson/tests/fixtures/moodle_logo.jpg | moodle_logo.jpg |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Manage private files"
|
||||
And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Duplicate content page with an image.
|
||||
Given I am on the "Test lesson name" "lesson activity" page
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
@ -40,9 +38,7 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | Previous page |
|
||||
| id_jumpto_1 | Previous page |
|
||||
# Atto needs focus to add image, select empty p tag to do so.
|
||||
And I select the text in the "id_contents_editor" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "[data-fieldtype=editor]" "css_element"
|
||||
And I click on "Image" "button" in the "Page contents" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodle_logo.jpg" "link"
|
||||
@ -51,24 +47,24 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
And I click on "Save image" "button"
|
||||
And I press "Save page"
|
||||
And I follow "Duplicate page: First page name"
|
||||
And I should see "Inserted page: First page name"
|
||||
Then I should see "Inserted page: First page name"
|
||||
And I follow "Update page: First page name"
|
||||
And I set the field "Page title" to "Introduction page"
|
||||
And I press "Save page"
|
||||
When I follow "Update page: First page name"
|
||||
And I should see "First page name"
|
||||
Then "//*[contains(@id, 'id_contents_editor')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
And I follow "Update page: First page name"
|
||||
Then I should see "First page name"
|
||||
And I switch to the "Page contents" TinyMCE editor iframe
|
||||
Then "//*[contains(@data-id, 'id_contents_editor')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Duplicate question page with image in answer.
|
||||
Given I am on the "Test lesson name" "lesson activity" page
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True false with an image in the answer |
|
||||
| Page contents | Select the picture |
|
||||
| id_answer_editor_0 | To be replaced |
|
||||
| id_answer_editor_0 | Answer text |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
@ -76,9 +72,7 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
# Atto needs focus to add image, select empty p tag to do so.
|
||||
And I select the text in the "id_answer_editor_0" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@id='id_answer_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
|
||||
And I click on "Image" "button" in the "//*[@id='id_answer_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodle_logo.jpg" "link"
|
||||
@ -87,25 +81,27 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
And I click on "Save image" "button"
|
||||
And I press "Save page"
|
||||
And I follow "Duplicate page: True false with an image in the answer"
|
||||
And I should see "Inserted page: True false with an image in the answer"
|
||||
Then I should see "Inserted page: True false with an image in the answer"
|
||||
And I follow "Update page: True false with an image in the answer"
|
||||
And I set the field "Page title" to "First true false"
|
||||
And I press "Save page"
|
||||
When I follow "Update page: True false with an image in the answer"
|
||||
And I should see "True false with an image in the answer"
|
||||
And I should see "Select the picture"
|
||||
Then "//*[contains(@id, 'id_answer_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
And I follow "Update page: True false with an image in the answer"
|
||||
Then I should see "True false with an image in the answer"
|
||||
And I switch to the "Page contents" TinyMCE editor iframe
|
||||
Then I should see "Select the picture"
|
||||
And I switch to the main frame
|
||||
And I switch to the "Answer" TinyMCE editor iframe
|
||||
Then "//*[contains(@data-id, 'id_answer_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Duplicate question page with image in feedback.
|
||||
Given I am on the "Test lesson name" "lesson activity" page
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True false with an image in the feedback |
|
||||
| Page contents | Select the picture |
|
||||
| id_answer_editor_0 | To be replaced |
|
||||
| id_answer_editor_0 | Answer text |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
@ -113,9 +109,7 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
# Atto needs focus to add image, select empty p tag to do so.
|
||||
And I select the text in the "id_response_editor_0" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@id='id_response_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
|
||||
And I click on "Image" "button" in the "//*[@id='id_response_editor_0']/ancestor::*[@data-fieldtype='editor']" "xpath_element"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodle_logo.jpg" "link"
|
||||
@ -124,11 +118,14 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
|
||||
And I click on "Save image" "button"
|
||||
And I press "Save page"
|
||||
And I follow "Duplicate page: True false with an image in the feedback"
|
||||
And I should see "Inserted page: True false with an image in the feedback"
|
||||
Then I should see "Inserted page: True false with an image in the feedback"
|
||||
And I follow "Update page: True false with an image in the feedback"
|
||||
And I set the field "Page title" to "First true false"
|
||||
And I press "Save page"
|
||||
When I follow "Update page: True false with an image in the feedback"
|
||||
And I should see "True false with an image in the feedback"
|
||||
And I should see "Select the picture"
|
||||
Then "//*[contains(@id, 'id_response_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
And I follow "Update page: True false with an image in the feedback"
|
||||
Then I should see "True false with an image in the feedback"
|
||||
And I switch to the "Page contents" TinyMCE editor iframe
|
||||
Then I should see "Select the picture"
|
||||
And I switch to the main frame
|
||||
And I switch to the "Response" TinyMCE editor iframe
|
||||
Then "//*[contains(@data-id, 'id_response_editor_0')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist
|
||||
|
@ -3,9 +3,8 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ
|
||||
As a teacher
|
||||
I need to add questions with images in answers and responses
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@javascript @_file_upload @editor_atto
|
||||
Scenario: questions with images in answers and responses
|
||||
@javascript @editor_tiny
|
||||
Scenario: Questions with images in answers and responses
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
@ -24,10 +23,10 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| teacher1 | mod/lesson/tests/fixtures/moodle_logo.jpg | moodle_logo.jpg |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Manage private files"
|
||||
And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
@ -47,9 +46,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ
|
||||
| id_response_editor_2 | Incorrect answer |
|
||||
| id_jumpto_2 | This page |
|
||||
| id_score_2 | 0 |
|
||||
# Atto needs focus to add image, select empty p tag to do so.
|
||||
And I select the text in the "id_answer_editor_2" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_answer_editor_2']]" "xpath_element"
|
||||
And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_answer_editor_2']]" "xpath_element"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodle_logo.jpg" "link"
|
||||
@ -69,9 +66,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
# Atto needs focus to add image, select empty p tag to do so.
|
||||
And I select the text in the "id_response_editor_0" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_response_editor_0']]" "xpath_element"
|
||||
And I click on "Image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_response_editor_0']]" "xpath_element"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodle_logo.jpg" "link"
|
||||
|
@ -58,6 +58,19 @@ class mod_page_generator extends testing_module_generator {
|
||||
$record->printlastmodified = 1;
|
||||
}
|
||||
|
||||
return parent::create_instance($record, (array)$options);
|
||||
$instance = parent::create_instance($record, (array)$options);
|
||||
|
||||
// Insert files for the 'content' file area.
|
||||
$instance = $this->insert_files(
|
||||
$instance,
|
||||
$record,
|
||||
'page',
|
||||
\context_module::instance($instance->cmid),
|
||||
'mod_page',
|
||||
'content',
|
||||
0
|
||||
);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ Feature: Teachers can override the grade for any question
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| teacher1 | mod/quiz/tests/fixtures/moodle_logo.jpg | moodle_logo.jpg |
|
||||
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1"
|
||||
And I press "Attempt quiz"
|
||||
And I follow "Finish attempt ..."
|
||||
@ -59,9 +62,6 @@ Feature: Teachers can override the grade for any question
|
||||
@javascript @_switch_window @_file_upload @_bug_phantomjs @editor_tiny
|
||||
Scenario: Comment on a response to an essay question attempt.
|
||||
When I log in as "teacher1"
|
||||
And I follow "Manage private files"
|
||||
And I upload "mod/quiz/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
And I am on the "Quiz 1 > student1 > Attempt 1" "mod_quiz > Attempt review" page
|
||||
And I follow "Make comment or override mark"
|
||||
And I switch to "commentquestion" window
|
||||
|
@ -1,15 +1,17 @@
|
||||
@mod @mod_workshop @javascript @_file_upload
|
||||
@mod @mod_workshop @javascript
|
||||
Feature: Teachers can embed images into instructions and conclusion fields
|
||||
In order to display images as a part of instructions or conclusions in the workshop
|
||||
As a teacher
|
||||
I need to be able to embed images into the fields and they should display correctly
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@editor_atto
|
||||
@editor_tiny
|
||||
Scenario: Embedding the image into the instructions and conclusions fields
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | One | teacher1@example.com |
|
||||
And the following "user private files" exist:
|
||||
| user | filepath | filename |
|
||||
| teacher1 | mod/workshop/tests/fixtures/moodlelogo.png | moodlelogo.png |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
@ -29,17 +31,11 @@ Feature: Teachers can embed images into instructions and conclusion fields
|
||||
| Conclusion format | 1 |
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
# Upload an image into the private files.
|
||||
And I follow "Manage private files"
|
||||
And I upload "mod/workshop/tests/fixtures/moodlelogo.png" file to "Files" filemanager
|
||||
And I click on "Save changes" "button"
|
||||
When I log in as "teacher1"
|
||||
# Edit the workshop.
|
||||
When I am on the "Workshop with embedded images" "workshop activity editing" page
|
||||
And I am on the "Workshop with embedded images" "workshop activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I set the field "Instructions for submission" to "<p>Image test</p>"
|
||||
And I select the text in the "Instructions for submission" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_instructauthorseditor']]" "xpath_element"
|
||||
And I click on "Image" "button" in the "Instructions for submission" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodlelogo.png" "link"
|
||||
@ -50,9 +46,7 @@ Feature: Teachers can embed images into instructions and conclusion fields
|
||||
# Embed the image into Instructions for assessment.
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Instructions for assessment" to "<p>Image test</p>"
|
||||
And I select the text in the "Instructions for assessment" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_instructreviewerseditor']]" "xpath_element"
|
||||
And I click on "Image" "button" in the "Instructions for assessment" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodlelogo.png" "link"
|
||||
@ -63,9 +57,7 @@ Feature: Teachers can embed images into instructions and conclusion fields
|
||||
# Embed the image into Conclusion.
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Conclusion" to "<p>Image test</p>"
|
||||
And I select the text in the "Conclusion" Atto editor
|
||||
And I click on "Insert or edit image" "button" in the "//*[@data-fieldtype='editor']/*[descendant::*[@id='id_conclusioneditor']]" "xpath_element"
|
||||
And I click on "Image" "button" in the "Conclusion" "form_row"
|
||||
And I click on "Browse repositories..." "button"
|
||||
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
|
||||
And I click on "moodlelogo.png" "link"
|
||||
@ -77,6 +69,6 @@ Feature: Teachers can embed images into instructions and conclusion fields
|
||||
And I change phase in workshop "Workshop with embedded images" to "Submission phase"
|
||||
Then "//*[contains(@class, 'instructions')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/mod_workshop/instructauthors/moodlelogo.png') and @alt='How to submit']" "xpath_element" should exist
|
||||
And I change phase in workshop "Workshop with embedded images" to "Assessment phase"
|
||||
And "//*[contains(@class, 'instructions')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/mod_workshop/instructreviewers/moodlelogo.png') and @alt='How to assess']" "xpath_element" should exist
|
||||
Then "//*[contains(@class, 'instructions')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/mod_workshop/instructreviewers/moodlelogo.png') and @alt='How to assess']" "xpath_element" should exist
|
||||
And I change phase in workshop "Workshop with embedded images" to "Closed"
|
||||
And "//*[contains(@class, 'conclusion')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/mod_workshop/conclusion/moodlelogo.png') and @alt='Well done']" "xpath_element" should exist
|
||||
Then "//*[contains(@class, 'conclusion')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/mod_workshop/conclusion/moodlelogo.png') and @alt='Well done']" "xpath_element" should exist
|
||||
|
@ -14,25 +14,21 @@ Feature: Updating a file in the content bank after using in a course
|
||||
And the following "contentbank content" exist:
|
||||
| contextlevel | reference | contenttype | user | contentname | filepath |
|
||||
| Course | C1 | contenttype_h5p | admin | package.h5p | /h5p/tests/fixtures/guess-the-answer.h5p |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
||||
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@editor_atto
|
||||
Scenario: Referenced files is the default option and updates alias as well
|
||||
Given I am on the PageName1 "Page activity editing" page logged in as admin
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
When I log in as "admin"
|
||||
And I am on "Course1" course homepage with editing mode on
|
||||
And I add a "H5P" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | guessFile |
|
||||
And I click on "Add..." "link" in the ".fp-toolbar" "css_element"
|
||||
And I select "Content bank" repository in file picker
|
||||
And I click on "package.h5p" "file" in repository content area
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Press here to reveal answer"
|
||||
Then I should see "Press here to reveal answer"
|
||||
And I switch to the main frame
|
||||
# Now edit the content in the content bank.
|
||||
When I am on "Course1" course homepage with editing mode on
|
||||
@ -51,31 +47,31 @@ Feature: Updating a file in the content bank after using in a course
|
||||
And I click on "Save" "button"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "This is a new text"
|
||||
Then I should see "This is a new text"
|
||||
And I switch to the main frame
|
||||
# Check the course page is updated.
|
||||
When I am on the PageName1 "Page activity" page
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
When I am on "Course1" course homepage with editing mode on
|
||||
And I click on "guessFile" "link" in the "page-content" "region"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "This is a new text"
|
||||
And I switch to the main frame
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@editor_atto
|
||||
Scenario: Copied files should not be updated if the original is edited
|
||||
Given I am on the PageName1 "Page activity editing" page logged in as admin
|
||||
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
|
||||
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
|
||||
When I log in as "admin"
|
||||
And I am on "Course1" course homepage with editing mode on
|
||||
And I add a "H5P" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | guessFile |
|
||||
And I click on "Add..." "link" in the ".fp-toolbar" "css_element"
|
||||
And I select "Content bank" repository in file picker
|
||||
And I click on "package.h5p" "file" in repository content area
|
||||
And I click on "Make a copy of the file" "radio"
|
||||
And I click on "Select this file" "button"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Press here to reveal answer"
|
||||
Then I should see "Press here to reveal answer"
|
||||
And I switch to the main frame
|
||||
# Now edit the content in the content bank.
|
||||
When I am on "Course1" course homepage with editing mode on
|
||||
@ -94,11 +90,12 @@ Feature: Updating a file in the content bank after using in a course
|
||||
And I click on "Save" "button"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "This is a new text"
|
||||
Then I should see "This is a new text"
|
||||
And I switch to the main frame
|
||||
# Check the course page is not updated.
|
||||
When I am on the PageName1 "Page activity" page
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
When I am on "Course1" course homepage with editing mode on
|
||||
And I click on "guessFile" "link" in the "page-content" "region"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "Press here to reveal answer"
|
||||
And I switch to the main frame
|
||||
|
@ -128,20 +128,18 @@ Feature: Select content bank files using the content bank files repository
|
||||
Then I should see "1" elements in "Files" filemanager
|
||||
And I should see "filltheblanks.h5p" in the ".fp-content .fp-file" "css_element"
|
||||
|
||||
# This scenario has Atto-specific steps. See MDL-75913 for further details.
|
||||
@editor_atto
|
||||
Scenario: Non-editing teacher can not see the content bank repository
|
||||
Given I am on the Forum "Forum activity" page logged in as teacher2
|
||||
And I click on "Add discussion topic" "link"
|
||||
And I click on "Link" "button"
|
||||
When I click on "Browse repositories..." "button"
|
||||
And I click on "Advanced" "button"
|
||||
When I click on "Add..." "button"
|
||||
Then I should not see "Content bank" in the ".fp-repo-area" "css_element"
|
||||
|
||||
Scenario: Student can not see the content bank repository
|
||||
Given I am on the Forum "Forum activity" page logged in as student
|
||||
And I click on "Add discussion topic" "link"
|
||||
And I click on "Link" "button"
|
||||
When I click on "Browse repositories..." "button"
|
||||
And I click on "Advanced" "button"
|
||||
When I click on "Add..." "button"
|
||||
Then I should not see "Content bank" in the ".fp-repo-area" "css_element"
|
||||
|
||||
Scenario: Both content name and file name are shown when a content is selected
|
||||
|
Loading…
x
Reference in New Issue
Block a user