Commit b92e552f authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1852513: Behat Tests coverage for 19.10 features"

parents c388a220 01df3e24
......@@ -1996,4 +1996,66 @@ JS;
}
}
/**
* @Then I select the skin :skinname from :skinsection
*/
public function iSelectTheSkinFrom($skinname, $skinsection) {
$skinnameliteral = $this->escaper->escapeLiteral($skinname);
$xpath = "//div[contains(@id, $skinsection)]" .
"/div[contains(concat(' ', normalize-space(@class), ' '), ' skin ')]" .
"/a/div";
try {
$skin = $this->find('xpath', $xpath);
$this->ensure_node_is_visible($skin);
$skin->click();
}
catch (ElementNotFoundException $e) {
throw new ExpectationException('The skin with title ' . $skinname . ' was not found', $this->getSession());
}
}
/**
* Check if a block's "display" icons are present
*
* @Then the :row row should contain display button :text
*/
public function check_row_contains_display_icon($row, $text) {
$rowname = $this->escaper->escapeLiteral($row);
$textliteral = $this->escaper->escapeLiteral($text);
$xpath = "//li[contains(normalize-space(.), " . $rowname . ")]" .
"/preceding-sibling::div[contains(concat(' ', normalize-space(@class), ' '), ' bh-displayiconsonly ')][1]" .
"/a/span[@title=" . $textliteral . "]";
try {
$button = $this->find('xpath', $xpath);
$this->ensure_node_is_visible($button);
}
catch (ElementNotFoundException $e) {
throw new ExpectationException('The display button with title ' . $textliteral . ' in row ' . $rowname . ' was not found', $this->getSession());
}
}
/**
* Check if a block's "display" icons are not present
*
* @Then the :row row should not contain display button :text
*/
public function check_row_does_not_contains_display_icon($row, $text) {
$rowname = $this->escaper->escapeLiteral($row);
$textliteral = $this->escaper->escapeLiteral($text);
$xpath = "//li[contains(normalize-space(.), " . $rowname . ")]" .
"/preceding-sibling::div[contains(concat(' ', normalize-space(@class), ' '), ' bh-displayiconsonly ')][1]" .
"/a/span[@title=" . $textliteral . "]";
$found = true;
try {
$button = $this->find('xpath', $xpath);
$this->ensure_node_is_visible($button);
}
catch (ElementNotFoundException $e) {
// all is fine as it is missing
$found = false;
}
if ($found) {
throw new ExpectationException('The display button with title ' . $textliteral . ' in row ' . $rowname . ' was found', $this->getSession());
}
}
}
......@@ -74,12 +74,12 @@
{/if}
</div>
{license_form_files($prefix, 'edit')}
<div class="form-group">
<div class="form-group switchbox">
<label for="{$prefix}_edit_allowcomments">
{str tag=Comments section=artefact.comment}
</label>
<div class="form-switch">
<div class="switch onoff"{if $switchwidth} style="width: {$switchwidth}"{/if}>
<div class="switch"{if $switchwidth} style="width: {$switchwidth}"{/if}>
<input class="switchbox" type="checkbox" name="{$prefix}_edit_allowcomments" id="{$prefix}_edit_allowcomments" {if $fileinfo->allowcomments}checked {/if} />
<label class="switch-label" tabindex="1" for="{$prefix}_edit_allowcomments">
<span class="switch-inner" role="presentation" aria-hidden="true"></span>
......
@javascript @core @core_artefact
Feature: Mahara users can view comments and details of their content on pages
As a user
I want to view details and comments of my content on pages
Background:
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| UserA | Kupuh1pa! | UserA@example.org | Betty | User | mahara | internal | member |
And the following "pages" exist:
| title | description | ownertype | ownername |
| Page UserA_01 | Page 01| user | UserA |
Scenario: Create a block and see comments and details modal and headers update accordingly
Given I log in as "UserA" with password "Kupuh1pa!"
Given I choose "Pages and collections" in "Create" from main menu
And I click on "Edit" in "Page UserA_01" card menu
When I follow "Drag to add a new block" in the "blocktype sidebar" property
And I press "Add"
And I set the field "Block title" to "Image Block"
And I click on "Image" in the "Content types" property
And I follow "Image"
And I attach the file "Image1.jpg" to "File"
And I press "Save"
And I click on "Display page"
And I click on "Details"
And I should see "Add comment" in the ".block-header .commentlink" "css_element"
And I should see "Details" in the ".commentlink" "css_element"
# Open the modal and see metadata details and add comment form
When I follow "Add comment"
And I should see "Image1.jpg" in the "div#configureblock" "css_element"
And I should see "Preview" in the "div#configureblock" "css_element"
And I fill in "This is a comment in a modal" in editor "Comment"
And I click on "Comment"
And I should see "Comment submitted"
And I should see "Comments (1) and details" in the ".commentlink" "css_element"
# Delete comment from modal
When I follow "Comments (1) and details"
And I should see "This is a comment in a modal"
And I delete the "This is a comment in a modal" row
And I wait "1" seconds
Then the "div#modal_messages" element should contain "Comment removed"
And I close the dialog
And I should see "Add comment"
And I should see "Details" in the ".commentlink" "css_element"
# Disable comments on the artefact and see modal reflect changes
When I follow "Add comment"
And I should not see "Comment removed"
And I click on "Comment"
Then the "div#modal_messages" element should contain "There was an error with submitting this form. Please check the marked fields and try again."
And I close the dialog
And I click on "Edit" in the ".pageactions" "css_element"
And I configure the block "Image Block"
And I click on "Image - Image1.jpg"
And I click on "Edit file \"Image1.jpg\""
And I scroll to the base of id "instconf_artefactid_edit_allowcomments"
And I should see "Comments"
When I disable the switch "Comments"
And I press "Save changes"
And I close the dialog
And I click on "Display page" in the ".pageactions" "css_element"
And I should see "Details" in the ".modal_link" "css_element"
And I should not see "Add comment" in the ".modal_link" "css_element"
# The image in the block is also a link to the modal
And I follow "Details"
And I should see "Preview" in the "div#configureblock" "css_element"
And I should not see "Add comment" in the "div#configureblock" "css_element"
Scenario: Add a block with multiple artefacts and see the comments and details header change accordingly
Given I log in as "UserA" with password "Kupuh1pa!"
Given I choose "Pages and collections" in "Create" from main menu
And I click on "Edit" in "Page UserA_01" card menu
When I follow "Drag to add a new block" in the "blocktype sidebar" property
And I press "Add"
And I set the field "Block title" to "File(s) to Download Block"
And I click on "File(s) to download" in the "Content types" property
And I expand "Files" node in the "#instconf_artefactfieldset_container" "css_element"
And I attach the file "Image2.png" to "File"
And I attach the file "mahara_about.pdf" to "File"
And I click on "Edit file \"mahara_about.pdf\""
When I disable the switch "Comments"
And I press "Save changes"
And I press "Save"
And I click on "Display page" in the ".pageactions" "css_element"
And I click on "Details" in the ".pageactions" "css_element"
Then the "Image2.png" row should contain display button "Details"
And the "Image2.png" row should contain display button "Add comment"
And the "mahara_about.pdf" row should contain display button "Details"
And the "mahara_about.pdf" row should not contain display button "Add comment"
And I should not see "Add comment" in the ".block-header .modal_link" "css_element"
@javascript @core @core_artefact
Feature: Creating, sharing and deleting skins
As a user
I want to create a new skin, share a skin and delete a skin
Background:
# Skins need to be enabled
Given the following site settings are set:
| field | value |
| skins | 1 |
And the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| UserA | Kupuh1pa! | UserA@example.org | Betty | User | mahara | internal | member |
| UserB | Kupuh1pa! | UserB@example.org | Veronica | User | mahara | internal | member |
And the following "pages" exist:
| title | description | ownertype | ownername |
| Page UserA_01 | Page 01| user | UserA |
| Page UserB_01 | Page 01| user | UserB |
Scenario: Create a skin with many customizations then apply it to a new page, then delete it
Given I log in as "UserA" with password "Kupuh1pa!"
# Attach file to be applied to skin
And I choose "Files" in "Create" from main menu
And I attach the file "Image1.jpg" to "File"
And I choose "Skins" in "Create" from main menu
And I click on "Create skin"
And I follow "General"
And I set the following fields to these values:
| Skin title |A fabulous new skin |
| Skin description | A fabulous new skin |
And I select "This is a private skin" from "designskinform_viewskin_access"
And I scroll to the base of id "designskinform"
And I follow "Page"
And I scroll to the base of id "designskinform_header_background_image_open_upload_browse_container"
And I press "Add a file"
And I press "Select \"Image1.jpg\""
And I select "Repeat both directions" from "designskinform_body_background_repeat"
And I scroll to the top
And I follow "Text"
And I uncheck "designskinform_view_text_heading_color_optional"
And I fill in "Header text colour" with "DEB6D5"
And I select "Century Gothic" from "designskinform_view_block_header_font"
And I select "Theme default" from "designskinform_view_text_font_family"
And I press "Save"
And I should see "A fabulous new skin"
#Apply the skin to a page
Given I choose "Pages and collections" in "Create" from main menu
And I click on "Edit" in "Page UserA_01" card menu
And I follow "Settings" in the "Toolbar buttons" property
And I follow "Skin"
And I scroll to the base of id "settings_skin_open"
Then I select the skin "A fabulous new skin" from "userskins"
And I should see "A fabulous new skin" in the ".col-md-3" "css_element"
And I press "Save"
And I click on "Display page"
#Delete the skin
And I choose "Skins" in "Create" from main menu
And I should see "A fabulous new skin"
And I click on "Delete"
And I press "Yes"
And I should not see "A fabulous new skin"
#Check the deleted skin has been removed from the page
Given I choose "Pages and collections" in "Create" from main menu
And I click on "Edit" in "Page UserA_01" card menu
And I follow "Settings" in the "Toolbar buttons" property
And I follow "Skin"
And I should not see "A fabulous new skin"
Scenario: Create a private skin and check its visibility
Given I log in as "UserA" with password "Kupuh1pa!"
Given I choose "Skins" in "Create" from main menu
And I click on "Create skin"
And I follow "General"
And I set the following fields to these values:
| Skin title | "A fabulous private skin |
# Create a private skin
And I select "This is a private skin" from "designskinform_viewskin_access"
And I press "Save"
And I click on "Create skin"
And I follow "General"
And I set the following fields to these values:
| Skin title | "A fabulous public skin |
# Create a public skin
And I select "This is a public skin" from "designskinform_viewskin_access"
And I press "Save"
And I should see "A fabulous private skin"
And I should see "A fabulous public skin"
And I log out
# Check privacy restrictions for skin
Given I log in as "UserB" with password "Kupuh1pa!"
Given I choose "Skins" in "Create" from main menu
And I should see "A fabulous public skin"
And I should not see "A fabulous private skin"
And I follow "Add to favourites"
Given I choose "Pages and collections" in "Create" from main menu
And I click on "Edit" in "Page UserB_01" card menu
And I follow "Settings" in the "Toolbar buttons" property
And I follow "Skin"
And I scroll to the base of id "settings_skin_container"
# Apply a a skin saved to favourite skins
And I follow "Favourite skins"
Then I select the skin "A fabulous public skin" from "userskins"
And I should see "A fabulous public skin" in the ".col-md-3" "css_element"
And I press "Save"
And I click on "Display page"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment