Commit 5a488a7a authored by Robert Lyon's avatar Robert Lyon

More fixing of @failed tests

Change-Id: If705e1e0b62c0a27fb5164b3ee90663de8ddd1f0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 95ef2429
......@@ -119,4 +119,71 @@ class BehatAdmin extends BehatBase {
}
}
/**
* Sets the specified plugin settings.
* A table with | Plugintype | Plugin | Setting label | value | is expected.
*
* @Given /^the following plugin settings are set:$/
* @param TableNode $table
* @throws SystemException
*/
public function plugin_settings_set(TableNode $table) {
$settings = array();
foreach ($table->getHash() as $pluginsetting) {
$settings[$pluginsetting['plugintype']][$pluginsetting['plugin']][$pluginsetting['field']] = $pluginsetting['value'];
}
// Validate the settings
$allowsettings = array(
// Artefact internal settings
'artefact' => array (
'internal' => array(
'profilemandatory' => array(
'firstname',
'lastname',
'studentid',
'preferredname',
'introduction',
'email',
'socialprofile',
// more to come ...
),
'profilepublic' => array(
'firstname',
'lastname',
'studentid',
'preferredname',
'email',
),
),
),
);
// if artefact internal profilemandatory is set we need to make sure that firstname/lastname/email are included.
if (!empty($settings['artefact']['internal']['profilemandatory'])) {
$values = explode(',', $settings['artefact']['internal']['profilemandatory']);
$mandatory = array('firstname', 'lastname', 'email');
$values = array_merge($mandatory, $values);
$settings['artefact']['internal']['profilemandatory'] = implode(',', $values);
}
// if artefact internal profilepublic is set we need to make sure that firstname/lastname/preferredname are included.
if (!empty($settings['artefact']['internal']['profilepublic'])) {
$values = explode(',', $settings['artefact']['internal']['profilepublic']);
$mandatory = array('firstname', 'lastname', 'email');
$values = array_merge($mandatory, $values);
$settings['artefact']['internal']['profilepublic'] = implode(',', $values);
}
// Update plugin settings
foreach ($allowsettings as $plugintype => $plugins) {
foreach ($plugins as $plugin => $fields) {
foreach ($fields as $field => $values) {
if (isset($settings[$plugintype][$plugin][$field]) && !set_config_plugin($plugintype, $plugin, $field, $settings[$plugintype][$plugin][$field])) {
throw new SystemException("Can not set the \"$plugintype\" \"$plugin\" option \"$field\" to \"$settings[$plugintype][$plugin][$field]\"");
}
}
}
}
}
}
......@@ -428,7 +428,11 @@ class BehatForms extends BehatBase {
" and contains(normalize-space(child::label[text()]), " . $textliteral . ")]" .
"//input[@type='checkbox']" .
"|" .
"//input[@id=" . $textliteral . "]";
"//input[@id=" . $textliteral . "]" .
"|" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' switchbox ')" .
" and contains(normalize-space(child::span[text()]), " . $textliteral . ")]" .
"//input[@type='checkbox']";
$switch_node = $this->find('xpath', $xpath, $exception);
$this->ensure_node_is_visible($switch_node);
......@@ -469,7 +473,13 @@ class BehatForms extends BehatBase {
$exception = new ElementNotFoundException($this->getSession(), 'field', null, $fieldlabel);
$xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' switchbox ')" .
" and contains(normalize-space(child::label[text()]), " . $textliteral . ")]" .
"//input[@type='checkbox']";
"//input[@type='checkbox']" .
"|" .
"//input[@id=" . $textliteral . "]" .
"|" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' switchbox ')" .
" and contains(normalize-space(child::span[text()]), " . $textliteral . ")]" .
"//input[@type='checkbox']";
$switch_node = $this->find('xpath', $xpath, $exception);
$this->ensure_node_is_visible($switch_node);
......
......@@ -317,7 +317,7 @@ function webservices_master_switch_form() {
'type' => array('type' => 'hidden', 'value' => 'webservice'),
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'enabled' => array('type' => 'switchbox',
'class' => 'last',
'class' => 'switchbox last',
'value' => $enabled,
'labelhtml' => '<span class="pseudolabel">'. get_string('control_webservices', 'auth.webservice') .'</span>',
),
......@@ -366,6 +366,7 @@ function webservices_protocol_switch_form() {
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'protocol' => array('type' => 'hidden', 'value' => $proto),
'enabled' => array('type' => 'switchbox',
'class' => 'switchbox',
'value' => $enabled,
'labelhtml' => '<span class="pseudolabel">' .get_string($proto, 'auth.webservice') . ': </span>',
),
......
@javascript @core_administration
@javascript @core @core_administration
Feature: Checking specific registered data is being sent
In order to check specific registered data is being sent
As an admin
......
@javascript @core_administration
@javascript @core @core_administration
Feature: Required social media
In order to make social media profile information required for the site
As an admin
So students have to provide mandatory credentials
Background:
Given the following plugin settings are set:
| plugintype | plugin | field | value |
| artefact | internal | profilemandatory | socialprofile |
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| userA | Kupuhipa1 | test01@example.com | Pete | Mc | mahara | internal | member |
Scenario: Social media credentials upon logging in as student (Bug 1432988)
Given I log in as "admin" with password "Kupuhipa1"
And I go to "/admin/extensions/pluginconfig.php?plugintype=artefact&pluginname=internal&type=profile"
And I check "Social media"
And I press "Save"
And I should see "Settings saved"
And I should not see "[[webpage/artefact.internal]]"
And I follow "Logout"
When I log in as "userA" with password "Kupuhipa1"
And I set the following fields to these values:
| Social network | Facebook URL |
| Your URL or username | https://www.facebook.com |
And I press "Submit"
And I should see "Latest changes I can view"
And I press "Submit"
Then I should see "Latest changes I can view"
@javascript @core_administration
@javascript @core @core_administration
Feature: Configuring the site options page
In order to change the configuration settings on the site options page
As an admin
......@@ -9,18 +9,7 @@ Scenario: Turning the switches on and off on the Site Options page (Bug 1431569)
And I go to "admin/site/options.php"
# Verifying I'm on the right page
And I should see "Here you can set some global options that will apply by default throughout the entire site."
And I expand the section "Site settings"
And I expand the section "User settings"
And I expand "Search settings" node
And I expand "Group settings" node
And I expand "Institution settings" node
And I expand "Account settings" node
And I expand "Security settings" node
And I expand "Proxy settings" node
And I expand "Email settings" node
And I expand "Notification settings" node
And I expand "General settings" node
And I expand "Logging settings" node
And I expand all fieldsets
# Checking that the default settings are correct
And the following fields match these values:
| Drop-down navigation | 0 |
......
@javascript @core_administration
@javascript @core @core_administration
Feature: Configuration on user search page
In order to change the configuration of the user search page
As an admin
......@@ -30,13 +30,10 @@ Scenario: Testing functions for user search page (Bug 1431569)
And I press "Save changes"
# Check that I can do user search when 'Email address' option is on
And I follow "Administration"
And I choose "Plugin administration" in "Extensions"
And I follow "Configuration for artefact internal"
And I set the field "Searchable fields: Email address" to "1"
And I press "Save"
Then I should see "Settings saved"
Given the following plugin settings are set:
| plugintype | plugin | field | value |
| artefact | internal | profilepublic | email |
And I set the following fields to these values:
| Search users | Pete Mc |
| Search users | test01@example.com |
And I press the key "Enter" in the "Search users" field
Then I should see "userA"
@javascript @core_administration
@javascript @core @core_administration
Feature: To enable webservices via the webservices configuration form
In order to use webservices
As an admin
......
@javascript @core_administration
@javascript @core @core_administration
Feature: Accessing the webservices test client page
In order to be able to access the webservies menus successfully
As an admin
......@@ -16,7 +16,7 @@ Scenario: Turning Master swtiches and protocol switches on checking test client
And I enable the switch "Switch web services on or off:"
And I should see "You need to enable at least one Protocol"
# Turning a protocol on
And I enable the switch "activate_webservice_protos_soap_enabled"
And I enable the switch "SOAP:"
# Navigating to the test client page to see it's accessible
When I go to "webservice/testclient.php"
Then I should see "This is the interactive test client facility for web services."
......@@ -27,7 +27,7 @@ Scenario: Turning Master swtiches and protocol switches on checking test client
And I follow "Administration"
And I go to "webservice/admin/index.php"
# Turning protocol off
And I disable the switch "activate_webservice_protos_soap_enabled"
And I disable the switch "SOAP:"
# Going to webservices test client page
When I go to "webservice/testclient.php"
# The regression error that's appearing
......
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