mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-40975 course: Adapt behat tests to the new course editing interface
This commit is contained in:
parent
79864ef25f
commit
047a8800f4
@ -21,14 +21,18 @@ Feature: Duplicate activities
|
||||
And I add a "Database" to section "1" and I fill the form with:
|
||||
| Name | Test database name |
|
||||
| Description | Test database description |
|
||||
And I click on "Actions" "link" in the "Test database name" activity
|
||||
And I open "Test database name" actions menu
|
||||
When I click on "Duplicate" "link" in the "Test database name" activity
|
||||
And I press "Continue"
|
||||
And I press "Edit the new copy"
|
||||
And I click on "Edit settings" "link" in the "Test database name" activity
|
||||
And I fill the moodle form with:
|
||||
| Name | Original database name |
|
||||
And I press "Save and return to course"
|
||||
And I open "Test database name" actions menu
|
||||
And I click on "Edit settings" "link" in the "Test database name" activity
|
||||
And I fill the moodle form with:
|
||||
| Name | Duplicated database name |
|
||||
| Description | Duplicated database description |
|
||||
And I press "Save and return to course"
|
||||
Then I should see "Test database name" in the "#section-1" "css_element"
|
||||
Then I should see "Original database name" in the "#section-1" "css_element"
|
||||
And I should see "Duplicated database name" in the "#section-1" "css_element"
|
||||
And "Test database name" "link" should appear before "Duplicated database name" "link"
|
||||
And "Original database name" "link" should appear before "Duplicated database name" "link"
|
||||
|
@ -40,7 +40,7 @@ Feature: Restore Moodle 2 course backups
|
||||
Then I should see "Course 1 restored in a new course"
|
||||
And I should see "Community finder" in the "Community finder" "block"
|
||||
And I should see "Test forum name"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
And the "id_format" field should match "Topics format" value
|
||||
And the "Number of sections" field should match "15" value
|
||||
@ -85,7 +85,7 @@ Feature: Restore Moodle 2 course backups
|
||||
When I restore "test_backup.mbz" backup into a new course using this options:
|
||||
Then I should see "Topic 1"
|
||||
And I should see "Test forum name"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
And the "id_format" field should match "Topics format" value
|
||||
And I fill the moodle form with:
|
||||
@ -96,14 +96,14 @@ Feature: Restore Moodle 2 course backups
|
||||
And I press "Save changes"
|
||||
And I should see "1 January - 7 January"
|
||||
And I should see "Test forum name"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
And the "id_format" field should match "Weekly format" value
|
||||
And I fill the moodle form with:
|
||||
| id_format | Social format |
|
||||
And I press "Save changes"
|
||||
And I should see "An open forum for chatting about anything you want to"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
And the "id_format" field should match "Social format" value
|
||||
And I press "Cancel"
|
||||
@ -120,7 +120,7 @@ Feature: Restore Moodle 2 course backups
|
||||
| Filename | test_backup.mbz |
|
||||
And I restore "test_backup.mbz" backup into "Course 2" course using this options:
|
||||
| Overwrite course configuration | Yes |
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
Then the "id_format" field should match "Topics format" value
|
||||
And the "Number of sections" field should match "15" value
|
||||
|
@ -18,6 +18,7 @@ Feature: Add and configure blocks throughout the site
|
||||
And I log in as "manager1"
|
||||
And I follow "Turn editing on"
|
||||
And I add the "Comments" block
|
||||
And I click on "Actions" "link" in the "Comments" "block"
|
||||
And I follow "Configure Comments block"
|
||||
And I fill the moodle form with:
|
||||
| Page contexts | Display throughout the entire site |
|
||||
@ -26,6 +27,7 @@ Feature: Add and configure blocks throughout the site
|
||||
Then I should see "Comments" in the "Comments" "block"
|
||||
And I should see "Save comment" in the "Comments" "block"
|
||||
And I am on homepage
|
||||
And I click on "Actions" "link" in the "Comments" "block"
|
||||
And I follow "Configure Comments block"
|
||||
And I fill the moodle form with:
|
||||
| Default weight | -10 (first) |
|
||||
|
@ -15,6 +15,7 @@ Feature: The context of a block can always be returned to it's original state.
|
||||
And I add the "Tags" block
|
||||
Then I should see "Tags" in the "Tags" "block"
|
||||
And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element"
|
||||
And I click on "Actions" "link" in the "Tags" "block"
|
||||
And I follow "Configure Tags block"
|
||||
And I fill the moodle form with:
|
||||
| Display on page types | Any page |
|
||||
@ -24,6 +25,7 @@ Feature: The context of a block can always be returned to it's original state.
|
||||
| Assignment name | Assignment1 |
|
||||
| Description | Description |
|
||||
And I follow "Assignment1"
|
||||
And I click on "Actions" "link" in the "Tags" "block"
|
||||
And I follow "Configure Tags block"
|
||||
And I fill the moodle form with:
|
||||
| Display on page types | Any assignment module page |
|
||||
@ -39,6 +41,7 @@ Feature: The context of a block can always be returned to it's original state.
|
||||
| Description | Description |
|
||||
And I follow "Assignment2"
|
||||
And I should see "Tags" in the "Tags" "block"
|
||||
And I click on "Actions" "link" in the "Tags" "block"
|
||||
And I follow "Configure Tags block"
|
||||
And I fill the moodle form with:
|
||||
| Display on page types | Any page |
|
||||
|
@ -25,7 +25,7 @@ Feature: Allow students to manually mark an activity as complete
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save changes"
|
||||
|
@ -27,7 +27,7 @@ Feature: Restrict sections availability through completion or grade conditions
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save changes"
|
||||
@ -93,4 +93,4 @@ Feature: Restrict sections availability through completion or grade conditions
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And "Test page name" activity should be visible
|
||||
And I should not see "Not available until you achieve a required score in Grade assignment"
|
||||
And I should not see "Not available until you achieve a required score in Grade assignment"
|
||||
|
@ -21,7 +21,7 @@ Feature: Toggle activities groups mode from the course page
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Group mode | No groups |
|
||||
| Force group mode | No |
|
||||
|
@ -24,7 +24,8 @@ Feature: Toggle activities visibility from the course page
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
| Visible | Show |
|
||||
When I click on "Hide" "link" in the "Test forum name" activity
|
||||
When I open "Test forum name" actions menu
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
Then "Test forum name" activity should be hidden
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
|
@ -30,7 +30,7 @@ Feature: Add activities to courses
|
||||
And I turn editing mode off
|
||||
Then I should not see "Adding a new"
|
||||
And I follow "Test name"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I expand all fieldsets
|
||||
And the "Name" field should match "Test name" value
|
||||
And the "Entries required for completion" field should match "9" value
|
||||
|
@ -327,6 +327,11 @@ class behat_course extends behat_base {
|
||||
|
||||
// Non-JS browsers can not click on img elements.
|
||||
if ($this->running_javascript()) {
|
||||
|
||||
// Expanding the actions menu.
|
||||
$actionsmenu = $this->find('css', "a[role='menuitem']", false, $activity);
|
||||
$actionsmenu->click();
|
||||
|
||||
// To check that the visibility is not clickable we check the funcionality rather than the applied style.
|
||||
$visibilityiconnode = $this->find('css', 'a.editing_show img', false, $activity);
|
||||
$visibilityiconnode->click();
|
||||
@ -527,7 +532,6 @@ class behat_course extends behat_base {
|
||||
// Adding chr(10) to save changes.
|
||||
$activity = $this->escape($activityname);
|
||||
return array(
|
||||
new Given('I open "' . $activity . '" actions menu'),
|
||||
new Given('I click on "' . get_string('edittitle') . '" "link" in the "' . $activity .'" activity'),
|
||||
new Given('I fill in "title" with "' . $this->escape($newactivityname) . chr(10) . '"'),
|
||||
new Given('I wait "2" seconds')
|
||||
@ -555,7 +559,7 @@ class behat_course extends behat_base {
|
||||
return;
|
||||
}
|
||||
|
||||
return new Given('I click on "' . get_string('actions', 'moodle') . '" "link" in the "' . $this->escape($activityname) . '" activity');
|
||||
return new Given('I click on "a[role=\'menuitem\']" "css_element" in the "' . $this->escape($activityname) . '" activity');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -654,8 +658,13 @@ class behat_course extends behat_base {
|
||||
$steps[] = new Given('I open "' . $activity . '" actions menu');
|
||||
}
|
||||
$steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity');
|
||||
$steps[] = new Given('I press "' . get_string('continue') .'"');
|
||||
$steps[] = new Given('I press "' . get_string('duplicatecontcourse') .'"');
|
||||
if ($this->running_javascript()) {
|
||||
// Temporary wait until MDL-41030 lands.
|
||||
$steps[] = new Given('I wait "4" seconds');
|
||||
} else {
|
||||
$steps[] = new Given('I press "' . get_string('continue') .'"');
|
||||
$steps[] = new Given('I press "' . get_string('duplicatecontcourse') .'"');
|
||||
}
|
||||
return $steps;
|
||||
}
|
||||
|
||||
@ -668,14 +677,31 @@ class behat_course extends behat_base {
|
||||
* @return Given[]
|
||||
*/
|
||||
public function i_duplicate_activity_editing_the_new_copy_with($activityname, TableNode $data) {
|
||||
|
||||
$steps = array();
|
||||
|
||||
$activity = $this->escape($activityname);
|
||||
|
||||
if ($this->running_javascript()) {
|
||||
$steps[] = new Given('I open "' . $activity . '" actions menu');
|
||||
$steps[] = new Given('I duplicate "' . $activity . '" activity');
|
||||
|
||||
// Determine the future new activity xpath from the former one.
|
||||
$activityliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($activityname);
|
||||
$duplicatedxpath = "//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][contains(., $activityliteral)]" .
|
||||
"/following-sibling::li";
|
||||
$duplicatedactionsmenuxpath = $duplicatedxpath . "/descendant::a[@role='menuitem']";
|
||||
|
||||
// The next sibling of the former activity will be the duplicated one, so we click on it from it's xpath as, at
|
||||
// this point, it don't even exists in the DOM (the steps are executed when we return them).
|
||||
$steps[] = new Given('I click on "' . $this->escape($duplicatedactionsmenuxpath) . '" "xpath_element"');
|
||||
|
||||
// We force the xpath as otherwise mink tries to interact with the former one.
|
||||
$steps[] = new Given('I click on "' . get_string('editsettings') . '" "link" in the "' . $this->escape($duplicatedxpath) . '" "xpath_element"');
|
||||
} else {
|
||||
$steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity');
|
||||
$steps[] = new Given('I press "' . get_string('continue') .'"');
|
||||
$steps[] = new Given('I press "' . get_string('duplicatecontedit') . '"');
|
||||
}
|
||||
$steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity');
|
||||
$steps[] = new Given('I press "' . get_string('continue') .'"');
|
||||
$steps[] = new Given('I press "' . get_string('duplicatecontedit') . '"');
|
||||
$steps[] = new Given('I fill the moodle form with:', $data);
|
||||
$steps[] = new Given('I press "' . get_string('savechangesandreturntocourse') . '"');
|
||||
return $steps;
|
||||
|
@ -56,7 +56,7 @@ Feature: Course activity controls works as expected
|
||||
And I indent left "Test forum name 1" activity
|
||||
And "#section-2" "css_element" <should_see_other_sections> exists
|
||||
And I open "Test forum name 1" actions menu
|
||||
And I click on "Update" "link" in the "Test forum name 1" activity
|
||||
And I click on "Edit settings" "link" in the "Test forum name 1" activity
|
||||
And I should see "Updating Forum"
|
||||
And I should see "Display description on course page"
|
||||
And I press "Save and return to course"
|
||||
@ -128,7 +128,7 @@ Feature: Course activity controls works as expected
|
||||
And "#section-2" "css_element" <should_see_other_sections> exists
|
||||
And I indent left "Test forum name 1" activity
|
||||
And "#section-2" "css_element" <should_see_other_sections> exists
|
||||
And I click on "Update" "link" in the "Test forum name 1" activity
|
||||
And I click on "Edit settings" "link" in the "Test forum name 1" activity
|
||||
And I should see "Updating Forum"
|
||||
And I should see "Display description on course page"
|
||||
And I press "Save and return to course"
|
||||
|
@ -17,7 +17,7 @@ Feature: Edit course settings
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
When I follow "Edit settings"
|
||||
When I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Course full name | Edited course fullname |
|
||||
| Course short name | Edited course shortname |
|
||||
@ -28,7 +28,7 @@ Feature: Edit course settings
|
||||
And I should not see "C1"
|
||||
And I should see "Edited course fullname"
|
||||
And I should see "Edited course shortname"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And the "Course full name" field should match "Edited course fullname" value
|
||||
And the "Course short name" field should match "Edited course shortname" value
|
||||
And the "Course summary" field should match "Edited course summary" value
|
||||
|
@ -20,7 +20,7 @@ Feature: Force group mode in a course
|
||||
And I add a "Chat" to section "1" and I fill the form with:
|
||||
| Name of this chat room | Chat room |
|
||||
| Description | Chat description |
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
|
||||
@javascript
|
||||
Scenario: Forced group mode using separate groups
|
||||
@ -29,10 +29,7 @@ Feature: Force group mode in a course
|
||||
| Force group mode | Yes |
|
||||
When I press "Save changes"
|
||||
Then "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should exists
|
||||
And I click on "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element"
|
||||
And "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should exists
|
||||
And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists
|
||||
|
||||
@javascript
|
||||
Scenario: Forced group mode using visible groups
|
||||
@ -41,10 +38,7 @@ Feature: Force group mode in a course
|
||||
| Force group mode | Yes |
|
||||
And I press "Save changes"
|
||||
Then "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should exists
|
||||
And I click on "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element"
|
||||
And "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should exists
|
||||
And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists
|
||||
|
||||
@javascript
|
||||
Scenario: Forced group mode without groups
|
||||
@ -53,8 +47,5 @@ Feature: Force group mode in a course
|
||||
| Force group mode | Yes |
|
||||
And I press "Save changes"
|
||||
Then "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should exists
|
||||
And I click on "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element"
|
||||
And "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists
|
||||
And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should exists
|
||||
And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists
|
||||
|
||||
|
@ -33,7 +33,7 @@ Feature: Activities can be moved between sections
|
||||
And I should not see "Test forum name" in the "#section-1" "css_element"
|
||||
|
||||
Scenario: Move activities in the course home with Javascript disabled using paged mode
|
||||
Given I follow "Edit settings"
|
||||
Given I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Course layout | Show one section per page |
|
||||
And I press "Save changes"
|
||||
@ -42,7 +42,7 @@ Feature: Activities can be moved between sections
|
||||
And I should not see "Test forum name" in the "#section-1" "css_element"
|
||||
|
||||
Scenario: Move activities in a course section with Javascript disabled using paged mode
|
||||
Given I follow "Edit settings"
|
||||
Given I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Course layout | Show one section per page |
|
||||
And I press "Save changes"
|
||||
|
@ -28,7 +28,7 @@ Feature: Sections can be moved
|
||||
And I should see "Test forum name" in the "#section-1" "css_element"
|
||||
|
||||
Scenario: Move up and down a section with Javascript disabled in the course home of a course using paged mode
|
||||
Given I follow "Edit settings"
|
||||
Given I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Course layout | Show one section per page |
|
||||
And I press "Save changes"
|
||||
@ -41,7 +41,7 @@ Feature: Sections can be moved
|
||||
And I should see "Test forum name" in the "#section-1" "css_element"
|
||||
|
||||
Scenario: Sections can not be moved with Javascript disabled in a section page of a course using paged mode
|
||||
Given I follow "Edit settings"
|
||||
Given I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Course layout | Show one section per page |
|
||||
And I press "Save changes"
|
||||
|
@ -21,7 +21,7 @@ Feature: Rename roles within a course
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
When I follow "Edit settings"
|
||||
When I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Your word for 'Non-editing teacher' | Tutor |
|
||||
| Your word for 'Student' | Learner |
|
||||
@ -33,7 +33,7 @@ Feature: Rename roles within a course
|
||||
And the "roleid" select box should contain "Tutor"
|
||||
And the "roleid" select box should contain "Learner"
|
||||
And the "roleid" select box should not contain "Student"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Your word for 'Non-editing teacher' | |
|
||||
| Your word for 'Student' | |
|
||||
|
@ -21,7 +21,7 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
|
||||
@javascript
|
||||
Scenario: Allow guest access without password
|
||||
|
@ -44,7 +44,7 @@ Feature: Group assignment submissions
|
||||
And I fill the moodle form with:
|
||||
| Group mode | Separate groups |
|
||||
And I press "Save and return to course"
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Group mode | Separate groups |
|
||||
And I press "Save changes"
|
||||
|
@ -25,7 +25,7 @@ Feature: Set a certain number of discussions as a completion condition for a for
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I follow "Edit settings"
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I fill the moodle form with:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save changes"
|
||||
|
Loading…
x
Reference in New Issue
Block a user