diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index c6053b9106b..4ebc6f62d21 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -35,6 +35,9 @@ use Behat\Mink\Element\NodeElement; use Behat\Mink\Element\Element; use Behat\Mink\Session; +require_once(__DIR__ . '/classes/component_named_selector.php'); +require_once(__DIR__ . '/classes/component_named_replacement.php'); + /** * Steps definitions base class. * @@ -216,10 +219,22 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { $selector = 'xpath'; } - // Convert to named_partial where the selector type is not named_partial, named_exact, xpath, or css. + // Convert to a named selector where the selector type is not a known selector. $converttonamed = !$this->getSession()->getSelectorsHandler()->isSelectorRegistered($selector); $converttonamed = $converttonamed && 'xpath' !== $selector; if ($converttonamed) { + if (behat_partial_named_selector::is_deprecated_selector($selector)) { + if ($replacement = behat_partial_named_selector::get_deprecated_replacement($selector)) { + error_log("The '{$selector}' selector has been replaced with {$replacement}"); + $selector = $replacement; + } + } else if (behat_exact_named_selector::is_deprecated_selector($selector)) { + if ($replacement = behat_exact_named_selector::get_deprecated_replacement($selector)) { + error_log("The '{$selector}' selector has been replaced with {$replacement}"); + $selector = $replacement; + } + } + $allowedpartialselectors = behat_partial_named_selector::get_allowed_selectors(); $allowedexactselectors = behat_exact_named_selector::get_allowed_selectors(); if (isset($allowedpartialselectors[$selector])) { @@ -229,7 +244,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { $locator = behat_selectors::normalise_named_selector($allowedexactselectors[$selector], $locator); $selector = 'named_exact'; } else { - throw new ExpectationException("The '{$selector}' selector type is not registered.", $this); + throw new ExpectationException("The '{$selector}' selector type is not registered.", $this->getSession()->getDriver()); } } @@ -1092,4 +1107,58 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { public static function get_extended_timeout() : int { return self::get_real_timeout(10); } + + /** + * Return a list of the exact named selectors for the component. + * + * Named selectors are what make Behat steps like + * Then I should see "Useful text" in the "General" "fieldset" + * work. Here, "fieldset" is the named selector, and "General" is the locator. + * + * If you override this method in your plugin (e.g. mod_mymod), to define + * new selectors specific to your plugin. For example, if you returned + * new behat_component_named_selector('Thingy', + * [".//some/xpath//img[contains(@alt, %locator%)]/.."]) + * then + * Then I should see "Useful text" in the "Whatever" "mod_mymod > Thingy" + * would work. + * + * This method should return a list of {@link behat_component_named_selector} and + * the docs on that class explain how it works. + * + * @return behat_component_named_selector[] + */ + public static function get_exact_named_selectors(): array { + return []; + } + + /** + * Return a list of the partial named selectors for the component. + * + * Like the exact named selectors above, but the locator only + * needs to match part of the text. For example, the standard + * "button" is a partial selector, so: + * When I click "Save" "button" + * will activate "Save changes". + * + * @return behat_component_named_selector[] + */ + public static function get_partial_named_selectors(): array { + return []; + } + + /** + * Return a list of the Mink named replacements for the component. + * + * Named replacements allow you to define parts of an xpath that can be reused multiple times, or in multiple + * xpaths. + * + * This method should return a list of {@link behat_component_named_replacement} and the docs on that class explain + * how it works. + * + * @return behat_component_named_replacement[] + */ + public static function get_named_replacements(): array { + return []; + } } diff --git a/lib/behat/classes/behat_context_helper.php b/lib/behat/classes/behat_context_helper.php index 8b050ccaa8f..d7a2b602eda 100644 --- a/lib/behat/classes/behat_context_helper.php +++ b/lib/behat/classes/behat_context_helper.php @@ -90,12 +90,8 @@ class behat_context_helper { * @return behat_base */ public static function get($classname) { - $contexts = self::$environment->getContexts(); - - foreach ($contexts as $context) { - if (is_a($context, $classname)) { - return $context; - } + if (self::$environment->hasContextClass($classname)) { + return self::$environment->getContext($classname); } $suitename = self::$environment->getSuite()->getName(); @@ -121,6 +117,16 @@ class behat_context_helper { return self::$environment->getContext($classname); } + /** + * Return whether there is a context of the specified classname. + * + * @param string $classname + * @return bool + */ + public static function has_context(string $classname): bool { + return self::$environment->hasContextClass($classname); + } + /** * Translates string to XPath literal. * diff --git a/lib/behat/classes/behat_selectors.php b/lib/behat/classes/behat_selectors.php index f093e759d94..e90ec563c1e 100644 --- a/lib/behat/classes/behat_selectors.php +++ b/lib/behat/classes/behat_selectors.php @@ -23,6 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +require_once(__DIR__ . '/named_selector.php'); require_once(__DIR__ . '/exact_named_selector.php'); require_once(__DIR__ . '/partial_named_selector.php'); diff --git a/lib/behat/classes/component_named_replacement.php b/lib/behat/classes/component_named_replacement.php new file mode 100644 index 00000000000..f11a4ceead7 --- /dev/null +++ b/lib/behat/classes/component_named_replacement.php @@ -0,0 +1,99 @@ +. + +/** + * A class for recording the definition of Mink replacements. + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * A class for recording the definition of Mink replacements for use in Mink selectors. + * + * These are comprised of a source string, and a replacement. + * + * During use the source string is converted from the string to be in the format: + * + * %[component]/[string]% + * + * For example: + * + * %mod_forum/title% + * + * Mink replacements are used in xpath translation to translate regularly used items such as title. + * Here is an example from the upstream Mink project: + * + * '%tagTextMatch%' => 'contains(normalize-space(string(.)), %locator%)' + * + * And can be used in an xpath: + * + * .//label[%tagTextMatch%] + * + * This would be expanded to: + * + * .//label[contains(normalize-space(string(.)), %locator%)] + * + * Replacements can also be used in other replacements, as long as that replacement is defined later. + * + * '%linkMatch%' => '(%idMatch% or %tagTextMatch% or %titleMatch% or %relMatch%)' + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class behat_component_named_replacement { + /** @var string */ + protected $from; + + /** @var string */ + protected $to; + + /** + * Create the replacement. + * + * @param string $from this is the old selector that should no longer be used. + * For example 'group_message'. + * @param string $to this is the new equivalent that should be used instead. + * For example 'core_message > Message'. + */ + public function __construct(string $from, string $to) { + $this->from = $from; + $this->to = $to; + } + + /** + * Get the 'from' part of the replacement, formatted for the component. + * + * @param string $component + * @return string + */ + public function get_from(string $component): string { + return "%{$component}/{$this->from}%"; + } + + /** + * Get the 'to' part of the replacement. + * + * @return string Target xpath + */ + public function get_to(): string { + return $this->to; + } +} diff --git a/lib/behat/classes/component_named_selector.php b/lib/behat/classes/component_named_selector.php new file mode 100644 index 00000000000..8b58484fe1d --- /dev/null +++ b/lib/behat/classes/component_named_selector.php @@ -0,0 +1,124 @@ +. + +/** + * Class representing a named selector that can be used in Behat tests. + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Class representing a named selector that can be used in Behat tests. + * + * Named selectors are what make Behat steps like + * Then I should see "Useful text" in the "General" "fieldset" + * Here, "fieldset" is the named selector, and "General" is the locator. + * + * Selectors can either be exact, in which case the locator needs to + * match exactly, or can be partial, for example the way + * When I click "Save" "button" + * will trigger a "Save changes" button. + * + * Instances of this class get returned by the get_exact_named_selectors() + * and get_partial_named_selectors() methods in classes like behat_mod_mymod. + * The code that makes the magic work is in the trait behat_named_selector + * used by both behat_exact_named_selector and behat_partial_named_selector. + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class behat_component_named_selector { + /** @var string */ + protected $alias; + + /** @var array List of xpaths */ + protected $xpaths; + + /** @var string */ + protected $istextselector; + + /** + * Create the selector definition. + * + * As an example, if you define + * new behat_component_named_selector('Message', + * [".//*[@data-conversation-id]//img[contains(@alt, %locator%)]/.."]) + * in get_partial_named_selectors in behat_message in + * message/tests/behat/behat_message.php, then steps like + * When "Group 1" "core_message > Message" should exist + * will work. + * + * Text selectors are things that contain other things (e.g. some particular text), e.g. + * Then I can see "Some text" in the "Whatever" "text_selector" + * whereas non-text selectors are atomic things, like + * When I click the "Whatever" "widget". + * + * @param string $alias The 'friendly' name of the thing. This will be prefixed with the component name. + * For example, if the mod_mymod plugin, says 'Thingy', then "mod_mymod > Thingy" becomes a selector. + * @param array $xpaths A list of xpaths one or more XPaths that the selector gets transformed into. + * @param bool $istextselector Whether this selector can also be used as a text selector. + */ + public function __construct(string $alias, array $xpaths, bool $istextselector = true) { + $this->alias = $alias; + $this->xpaths = $xpaths; + $this->istextselector = $istextselector; + } + + /** + * Whether this is a text selector. + * + * @return bool + */ + public function is_text_selector(): bool { + return $this->istextselector; + } + + /** + * Get the name of the selector. + * This is a back-end feature and contains a namespaced md5 of the human-readable name. + * + * @param string $component + * @return string + */ + public function get_name(string $component): string { + return implode('_', [$component, md5($this->alias)]); + } + + /** + * Get the alias of the selector. + * This is the human-readable name that you would typically interact with. + * + * @param string $component + * @return string + */ + public function get_alias(string $component): string { + return implode(" > ", [$component, $this->alias]);; + } + + /** + * Get the list of combined xpaths. + * + * @return string The list of xpaths combined with the xpath | (OR) operator + */ + public function get_combined_xpath(): string { + return implode(' | ', $this->xpaths); + } +} diff --git a/lib/behat/classes/exact_named_selector.php b/lib/behat/classes/exact_named_selector.php index 4902075c275..e178daed7bd 100644 --- a/lib/behat/classes/exact_named_selector.php +++ b/lib/behat/classes/exact_named_selector.php @@ -32,6 +32,9 @@ */ class behat_exact_named_selector extends \Behat\Mink\Selector\ExactNamedSelector { + // Use the named selector trait. + use behat_named_selector; + /** * Creates selector instance. */ @@ -63,6 +66,9 @@ class behat_exact_named_selector extends \Behat\Mink\Selector\ExactNamedSelector 'text_exact' => 'text', ); + /** @var List of deprecated selectors */ + protected static $deprecatedselectors = []; + /** * Allowed selectors getter. * diff --git a/lib/behat/classes/named_selector.php b/lib/behat/classes/named_selector.php new file mode 100644 index 00000000000..e683ffcf291 --- /dev/null +++ b/lib/behat/classes/named_selector.php @@ -0,0 +1,113 @@ +. + +/** + * Moodle-specific common functions for named selectors. + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Common functions for named selectors. + * + * This has to be a trait, because we need this in both the classes + * behat_exact_named_selector and behat_partial_named_selector, and + * those classes have to be subclasses of \Behat\Mink\Selector\ExactNamedSelector + * and \Behat\Mink\Selector\PartialNamedSelector. This trait is a way achieve + * that without duplciated code. + * + * @package core + * @category test + * @copyright 2019 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +trait behat_named_selector { + + /** + * Registers new XPath selector with specified name. + * + * @param string $component + * @param behat_component_named_selector $selector + */ + public function register_component_selector(string $component, behat_component_named_selector $selector) { + $alias = $selector->get_alias($component); + $name = $selector->get_name($component); + static::$allowedselectors[$alias] = $name; + + if ($selector->is_text_selector()) { + static::$allowedtextselectors[$alias] = $name; + } + + // We must use Reflection here. The replacements property is private and cannot be accessed otherwise. + // This is due to an API limitation in Mink. + $rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class); + $r = $rc->getProperty('replacements'); + $r->setAccessible(true); + $replacements = $r->getValue($this); + + $selectorxpath = strtr($selector->get_combined_xpath(), $replacements); + + parent::registerNamedXpath($name, $selectorxpath); + } + + /** + * Registers new XPath selector with specified name. + * + * @param string $component + * @param behat_component_named_replacement $replacement + */ + public function register_replacement(string $component, behat_component_named_replacement $replacement) { + // We must use Reflection here. The replacements property is private and cannot be accessed otherwise. + // This is due to an API limitation in Mink. + $rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class); + $r = $rc->getProperty('replacements'); + $r->setAccessible(true); + $existing = $r->getValue($this); + + $from = $replacement->get_from($component); + + if (isset($existing[$from])) { + throw new \coding_exception("A named replacement already exists in the partial named selector for '{$from}'. " . + "Replacement names must be unique, and should be namespaced to the component"); + } + + $translatedto = strtr($replacement->get_to(), $existing); + $this->registerReplacement($from, $translatedto); + } + + /** + * Check whether the specified selector has been deprecated and marked for replacement. + * + * @param string $selector + * @return bool + */ + public static function is_deprecated_selector(string $selector): bool { + return array_key_exists($selector, static::$deprecatedselectors); + } + + /** + * Fetch the replacement name of a deprecated selector. + * + * @param string $selector + * @return bool + */ + public static function get_deprecated_replacement(string $selector): ?string { + return static::$deprecatedselectors[$selector]; + } +} diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index 8503da8eaf7..86830de043d 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -33,6 +33,9 @@ */ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSelector { + // Use the named selector trait. + use behat_named_selector; + /** * Creates selector instance. */ @@ -271,6 +274,15 @@ XPATH ], ]; + /** @var List of deprecated selectors */ + protected static $deprecatedselectors = [ + 'group_message' => 'core_message > Message', + 'group_message_member' => 'core_message > Message member', + 'group_message_tab' => 'core_message > Message tab', + 'group_message_list_area' => 'core_message > Message list area', + 'group_message_message_content' => 'core_message > Message content', + ]; + /** * Allowed selectors getter. * diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index 46b3c87afe1..bbf18b7f13b 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -396,7 +396,7 @@ class behat_hooks extends behat_base { * Yes, this is in a strange location and should be in the BeforeScenario hook, but failures in the test setUp lead * to the test being incorrectly marked as skipped with no way to force the test to be failed. * - * @param BeforeStepScope $scope + * @param BeforeStepScope $scope * @BeforeStep */ public function before_step(BeforeStepScope $scope) { @@ -425,7 +425,6 @@ class behat_hooks extends behat_base { new ExpectationException($message, $session) ); - self::$initprocessesfinished = true; } $this->scenariorunning = true; } @@ -709,6 +708,70 @@ class behat_hooks extends behat_base { protected static function is_first_scenario() { return !(self::$initprocessesfinished); } + + /** + * Register component selectors. + * + * @param BeforeScenarioScope $scope scope passed by event fired before scenario. + * @BeforeScenario + */ + public function register_component_selectors(BeforeScenarioScope $scope) { + foreach (\core_component::get_component_names() as $component) { + $this->register_component_selectors_for_component($component); + } + } + + /** + * Register a set of component selectors. + * + * @param string $component + */ + public function register_component_selectors_for_component(string $component): void { + $componentclassname = "behat_{$component}"; + + if (!behat_context_helper::has_context($componentclassname)) { + if ("core_" === substr($component, 0, 5)) { + $componentclassname = "behat_" . substr($component, 5); + if (!behat_context_helper::has_context($componentclassname)) { + return; + } + } else { + return; + } + } + + $context = behat_context_helper::get($componentclassname); + $namedpartial = $this->getSession()->getSelectorsHandler()->getSelector('named_partial'); + $namedexact = $this->getSession()->getSelectorsHandler()->getSelector('named_exact'); + + // Replacements must come before selectors as they are used in the selectors. + foreach ($context->get_named_replacements() as $replacement) { + $namedpartial->register_replacement($component, $replacement); + $namedexact->register_replacement($component, $replacement); + } + + foreach ($context->get_partial_named_selectors() as $selector) { + $namedpartial->register_component_selector($component, $selector); + } + + foreach ($context->get_exact_named_selectors() as $selector) { + $namedexact->register_component_selector($component, $selector); + } + + } + + /** + * Mark the first step as having been completed. + * + * This must be the last BeforeStep hook in the setup. + * + * @param BeforeStepScope $scope + * @BeforeStep + */ + public function first_step_setup_complete(BeforeStepScope $scope) { + self::$initprocessesfinished = true; + } + } /** diff --git a/message/tests/behat/behat_message.php b/message/tests/behat/behat_message.php index cd8bc43f1c1..28731d904b6 100644 --- a/message/tests/behat/behat_message.php +++ b/message/tests/behat/behat_message.php @@ -37,6 +37,69 @@ require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); */ class behat_message extends behat_base { + /** + * Return the list of partial named selectors. + * + * @return array + */ + public static function get_partial_named_selectors(): array { + return [ + new behat_component_named_selector('Message', [".//*[@data-conversation-id]//img[%altMatch%]/.."]), + new behat_component_named_selector('Message conversation', [ + <<execute('behat_general::i_click_on', [ $this->escape($tab), - 'group_message_tab' + 'core_message > Message tab' ]); } @@ -213,7 +276,7 @@ class behat_message extends behat_base { $this->execute('behat_general::i_click_on', array( $this->escape($conversationname), - 'group_message', + 'core_message > Message', ) ); } diff --git a/message/tests/behat/delete_messages.feature b/message/tests/behat/delete_messages.feature index 9de5bc3f0d6..1504d8ebb89 100644 --- a/message/tests/behat/delete_messages.feature +++ b/message/tests/behat/delete_messages.feature @@ -40,15 +40,15 @@ Feature: Delete messages from conversations Scenario: Delete a message sent by the user from a group conversation Given I log in as "student1" And I open messaging - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging - And I click on "Hi!" "group_message_message_content" - And I click on "How are you?" "group_message_message_content" - And I click on "Can somebody help me?" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" + And I click on "How are you?" "core_message > Message content" + And I click on "Can somebody help me?" "core_message > Message content" And I should see "3" in the "[data-region='message-selected-court']" "css_element" # Clicking to unselect - And I click on "How are you?" "group_message_message_content" - And I click on "Can somebody help me?" "group_message_message_content" + And I click on "How are you?" "core_message > Message content" + And I click on "Can somebody help me?" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -57,19 +57,19 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Group 1" "group_message_conversation" - And I should see "How are you?" in the "Group 1" "group_message_conversation" - And I should see "Can somebody help me?" in the "Group 1" "group_message_conversation" + And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should see "How are you?" in the "Group 1" "core_message > Message conversation" + And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation" And I should not see "Messages selected" Scenario: Delete two messages from a group conversation; one sent by another user. Given I log in as "student1" And I open messaging - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging - And I click on "Hi!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" - And I click on "How are you?" "group_message_message_content" + And I click on "How are you?" "core_message > Message content" And I should see "2" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -78,9 +78,9 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Group 1" "group_message_conversation" - And I should not see "How are you?" in the "Group 1" "group_message_conversation" - And I should see "Can somebody help me?" in the "Group 1" "group_message_conversation" + And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should not see "How are you?" in the "Group 1" "core_message > Message conversation" + And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation" And I should not see "Messages selected" # Check messages were not deleted for other users And I log out @@ -94,10 +94,10 @@ Feature: Delete messages from conversations Scenario: Cancel deleting two messages from a group conversation Given I log in as "student1" And I open messaging - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging - And I click on "Hi!" "group_message_message_content" - And I click on "How are you?" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" + And I click on "How are you?" "core_message > Message content" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" # Canceling deletion, so messages should be there @@ -105,7 +105,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='cancel-confirm']" "xpath_element" Then I should not see "Cancel" And I should see "Hi!" - And I should see "How are you?" in the "Group 1" "group_message_conversation" + And I should see "How are you?" in the "Group 1" "core_message > Message conversation" And I should see "2" in the "[data-region='message-selected-court']" "css_element" Scenario: Delete a message sent by the user from a private conversation @@ -115,7 +115,7 @@ Feature: Delete messages from conversations And I open the "Private" conversations list And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -124,9 +124,9 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" - And I should see "Hello!" in the "Student 2" "group_message_conversation" - And I should see "Are you free?" in the "Student 2" "group_message_conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "Hello!" in the "Student 2" "core_message > Message conversation" + And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" Scenario: Delete two messages from a private conversation; one sent by another user @@ -136,9 +136,9 @@ Feature: Delete messages from conversations And I open the "Private" conversations list And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" - And I click on "Hello!" "group_message_message_content" + And I click on "Hello!" "core_message > Message content" And I should see "2" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -147,9 +147,9 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should not see "Hello!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" - And I should see "Are you free?" in the "Student 2" "group_message_conversation" + And I should not see "Hello!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" # Check messages were not deleted for the other user And I log out @@ -168,8 +168,8 @@ Feature: Delete messages from conversations And I open the "Private" conversations list And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" - And I click on "Hello!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" + And I click on "Hello!" "core_message > Message content" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" # Canceling deletion, so messages should be there @@ -177,7 +177,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='cancel-confirm']" "xpath_element" Then I should not see "Cancel" And I should see "Hi!" - And I should see "Hello!" in the "Student 2" "group_message_conversation" + And I should see "Hello!" in the "Student 2" "core_message > Message conversation" And I should see "2" in the "[data-region='message-selected-court']" "css_element" Scenario: Delete a message sent by the user from a favorite conversation @@ -188,7 +188,7 @@ Feature: Delete messages from conversations And I open messaging And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -197,8 +197,8 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" - And I should see "Hello!" in the "Student 2" "group_message_conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "Hello!" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" Scenario: Delete two messages from a favourite conversation; one sent by another user @@ -209,9 +209,9 @@ Feature: Delete messages from conversations And I open messaging And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" And I should see "1" in the "[data-region='message-selected-court']" "css_element" - And I click on "Hello!" "group_message_message_content" + And I click on "Hello!" "core_message > Message content" And I should see "2" in the "[data-region='message-selected-court']" "css_element" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" @@ -220,9 +220,9 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should not see "Hello!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" - And I should see "Are you free?" in the "Student 2" "group_message_conversation" + And I should not see "Hello!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" Scenario: Cancel deleting two messages from a favourite conversation @@ -233,8 +233,8 @@ Feature: Delete messages from conversations And I open messaging And I should see "Student 2" And I select "Student 2" conversation in messaging - And I click on "Hi!" "group_message_message_content" - And I click on "Hello!" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" + And I click on "Hello!" "core_message > Message content" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" # Canceling deletion, so messages should be there @@ -242,7 +242,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='cancel-confirm']" "xpath_element" Then I should not see "Cancel" And I should see "Hi!" - And I should see "Hello!" in the "Student 2" "group_message_conversation" + And I should see "Hello!" in the "Student 2" "core_message > Message conversation" And I should see "2" in the "[data-region='message-selected-court']" "css_element" Scenario: Check an empty favourite conversation is still favourite @@ -253,9 +253,9 @@ Feature: Delete messages from conversations And I open messaging And I should see "Student 2" And I select "Student 2" conversation in the "favourites" conversations list - And I click on "Hi!" "group_message_message_content" - And I click on "Hello!" "group_message_message_content" - And I click on "Are you free?" "group_message_message_content" + And I click on "Hi!" "core_message > Message content" + And I click on "Hello!" "core_message > Message content" + And I click on "Are you free?" "core_message > Message content" And "Delete selected messages" "button" should exist When I click on "Delete selected messages" "button" And I should see "Delete" diff --git a/message/tests/behat/favourite_conversations.feature b/message/tests/behat/favourite_conversations.feature index 842b55ed4e7..51ca228516b 100644 --- a/message/tests/behat/favourite_conversations.feature +++ b/message/tests/behat/favourite_conversations.feature @@ -31,35 +31,35 @@ Feature: Star and unstar conversations Given I log in as "student1" Then I open messaging And I open the "Group" conversations list - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging And I open contact menu And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should see "Group 1" in the "favourites" "group_message_list_area" + And I should see "Group 1" in the "favourites" "core_message > Message list area" And I open the "Group" conversations list - And I should not see "Group 1" in the "group-messages" "group_message_list_area" + And I should not see "Group 1" in the "group-messages" "core_message > Message list area" Scenario: Unstar a group conversation Given I log in as "student1" Then I open messaging And I open the "Group" conversations list - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging And I open contact menu And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should see "Group 1" in the "favourites" "group_message_list_area" + And I should see "Group 1" in the "favourites" "core_message > Message list area" And I select "Group 1" conversation in messaging And I open contact menu And I click on "Unstar" "link" in the "//div[@data-region='header-container']" "xpath_element" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should not see "Group 1" in the "favourites" "group_message_list_area" + And I should not see "Group 1" in the "favourites" "core_message > Message list area" And I open the "Group" conversations list - And I should see "Group 1" in the "group-messages" "group_message_list_area" + And I should see "Group 1" in the "group-messages" "core_message > Message list area" Scenario: Star a private conversation Given the following "private messages" exist: @@ -68,15 +68,15 @@ Feature: Star and unstar conversations Then I log in as "student1" And I open messaging And I open the "Private" conversations list - And "Student 2" "group_message" should exist + And "Student 2" "core_message > Message" should exist And I select "Student 2" conversation in messaging And I open contact menu And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should see "Student 2" in the "favourites" "group_message_list_area" + And I should see "Student 2" in the "favourites" "core_message > Message list area" And I open the "Private" conversations list - And I should not see "Student 2" in the "messages" "group_message_list_area" + And I should not see "Student 2" in the "messages" "core_message > Message list area" Scenario: Unstar a private conversation Given the following "private messages" exist: @@ -87,12 +87,12 @@ Feature: Star and unstar conversations | student1 | student2 | Then I log in as "student1" And I open messaging - And I should see "Student 2" in the "favourites" "group_message_list_area" + And I should see "Student 2" in the "favourites" "core_message > Message list area" And I select "Student 2" conversation in messaging And I open contact menu And I click on "Unstar" "link" in the "//div[@data-region='header-container']" "xpath_element" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should not see "Group 1" in the "favourites" "group_message_list_area" + And I should not see "Group 1" in the "favourites" "core_message > Message list area" And I open the "Private" conversations list - And I should see "Student 2" in the "messages" "group_message_list_area" \ No newline at end of file + And I should see "Student 2" in the "messages" "core_message > Message list area" diff --git a/message/tests/behat/group_conversation.feature b/message/tests/behat/group_conversation.feature index e9907274b4b..bde9a02d87d 100644 --- a/message/tests/behat/group_conversation.feature +++ b/message/tests/behat/group_conversation.feature @@ -47,26 +47,26 @@ Feature: Create conversations for course's groups Given I log in as "teacher1" Then I open messaging And I open the "Group" conversations list - And "Group 1" "group_message" should exist - And "Group 2" "group_message" should exist - And "Group 3" "group_message" should not exist + And "Group 1" "core_message > Message" should exist + And "Group 2" "core_message > Message" should exist + And "Group 3" "core_message > Message" should not exist And I log out And I log in as "student1" And I open messaging And I open the "Group" conversations list - And "Group 1" "group_message" should exist - And "Group 2" "group_message" should not exist - And "Group 3" "group_message" should not exist + And "Group 1" "core_message > Message" should exist + And "Group 2" "core_message > Message" should not exist + And "Group 3" "core_message > Message" should not exist Scenario: View group conversation's participants numbers Given I log in as "teacher1" Then I open messaging And I open the "Group" conversations list And I select "Group 1" conversation in messaging - And I should see "5 participants" in the "Group 1" "group_message_header" + And I should see "5 participants" in the "Group 1" "core_message > Message header" And I go back in "view-conversation" message drawer And I select "Group 2" conversation in messaging - And I should see "1 participants" in the "Group 2" "group_message_header" + And I should see "1 participants" in the "Group 2" "core_message > Message header" Scenario: View group conversation's participants list Given I log in as "teacher1" @@ -75,20 +75,20 @@ Feature: Create conversations for course's groups # Check Group 1 participants list. And I select "Group 1" conversation in messaging And I open messaging information - And "Teacher 1" "group_message_member" should not exist - And "Student 0" "group_message_member" should exist - And "Student 1" "group_message_member" should exist - And "Student 2" "group_message_member" should exist - And "Student 3" "group_message_member" should exist - And "Student 4" "group_message_member" should not exist + And "Teacher 1" "core_message > Message member" should not exist + And "Student 0" "core_message > Message member" should exist + And "Student 1" "core_message > Message member" should exist + And "Student 2" "core_message > Message member" should exist + And "Student 3" "core_message > Message member" should exist + And "Student 4" "core_message > Message member" should not exist And I go back in "group-info-content-container" message drawer And I go back in "view-conversation" message drawer # Check Group 2 participants list. And I select "Group 2" conversation in messaging And I open messaging information - And "Teacher 1" "group_message_member" should not exist - And "No participants" "group_message_member" should exist - And "Student 4" "group_message_member" should not exist + And "Teacher 1" "core_message > Message member" should not exist + And "No participants" "core_message > Message member" should exist + And "Student 4" "core_message > Message member" should not exist Scenario: Check group conversation members are synced when a new group member is added Given I log in as "teacher1" @@ -99,13 +99,13 @@ Feature: Create conversations for course's groups And I open messaging And I open the "Group" conversations list And I select "Group 1" conversation in messaging - And I should see "6 participants" in the "Group 1" "group_message_header" + And I should see "6 participants" in the "Group 1" "core_message > Message header" And I open messaging information - And "Student 4" "group_message_member" should exist + And "Student 4" "core_message > Message member" should exist And I go back in "group-info-content-container" message drawer And I go back in "view-conversation" message drawer And I select "Group 2" conversation in messaging - And I should see "2 participants" in the "Group 2" "group_message_header" + And I should see "2 participants" in the "Group 2" "core_message > Message header" And I open messaging information - And "No participants" "group_message_member" should not exist - And "Student 4" "group_message_member" should exist + And "No participants" "core_message > Message member" should not exist + And "Student 4" "core_message > Message member" should exist diff --git a/message/tests/behat/message_delete_conversation.feature b/message/tests/behat/message_delete_conversation.feature index 183c07a741d..5d7d65a31de 100644 --- a/message/tests/behat/message_delete_conversation.feature +++ b/message/tests/behat/message_delete_conversation.feature @@ -35,17 +35,17 @@ Feature: Message delete conversations And I should see "Delete" And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element" And I should not see "Delete" - And I should not see "Hi!" in the "Student 1" "group_message_conversation" - And I should not see "What do you need?" in the "Student 1" "group_message_conversation" - And I should not see "##today##j F##" in the "Student 1" "group_message_conversation" + And I should not see "Hi!" in the "Student 1" "core_message > Message conversation" + And I should not see "What do you need?" in the "Student 1" "core_message > Message conversation" + And I should not see "##today##j F##" in the "Student 1" "core_message > Message conversation" # Check user is deleting private conversation only for them And I log out And I log in as "student1" And I open messaging And I select "Student 2" conversation in the "messages" conversations list - And I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "What do you need?" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + And I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "What do you need?" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" Scenario: Cancel deleting a private conversation Given I log in as "student1" @@ -57,8 +57,8 @@ Feature: Message delete conversations And I should see "Cancel" And I click on "//button[@data-action='cancel-confirm']" "xpath_element" And I should not see "Cancel" - And I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + And I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" Scenario: Delete a starred conversation Given the following "favourite conversations" exist: @@ -73,17 +73,17 @@ Feature: Message delete conversations And I should see "Delete" And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element" And I should not see "Delete" - And I should not see "Hi!" in the "Student 2" "group_message_conversation" - And I should not see "What do you need?" in the "Student 2" "group_message_conversation" - And I should not see "##today##j F##" in the "Student 2" "group_message_conversation" + And I should not see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should not see "What do you need?" in the "Student 2" "core_message > Message conversation" + And I should not see "##today##j F##" in the "Student 2" "core_message > Message conversation" # Check user is deleting private conversation only for them And I log out And I log in as "student2" And I open messaging And I select "Student 1" conversation in the "messages" conversations list - And I should see "Hi!" in the "Student 1" "group_message_conversation" - And I should see "What do you need?" in the "Student 1" "group_message_conversation" - And I should see "##today##j F##" in the "Student 1" "group_message_conversation" + And I should see "Hi!" in the "Student 1" "core_message > Message conversation" + And I should see "What do you need?" in the "Student 1" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" Scenario: Cancel deleting a starred conversation Given the following "favourite conversations" exist: @@ -92,16 +92,16 @@ Feature: Message delete conversations When I log in as "student1" And I open messaging And I select "Student 2" conversation in the "favourites" conversations list - Then I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" And I open contact menu And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element" # Cancel deletion, so conversation should be there And I should see "Cancel" And I click on "//button[@data-action='cancel-confirm']" "xpath_element" And I should not see "Cancel" - And I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + And I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" Scenario: Check a deleted starred conversation is still starred Given the following "favourite conversations" exist: @@ -115,10 +115,10 @@ Feature: Message delete conversations Then I should see "Delete" And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element" And I should not see "Delete" - And I should not see "Hi!" in the "Student 2" "group_message_conversation" + And I should not see "Hi!" in the "Student 2" "core_message > Message conversation" And I go back in "view-conversation" message drawer - And I should not see "Student 2" in the "favourites" "group_message_list_area" + And I should not see "Student 2" in the "favourites" "core_message > Message list area" And I send "Hi!" message to "Student 2" user And I go back in "view-conversation" message drawer And I go back in "view-search" message drawer - And I should see "Student 2" in the "favourites" "group_message_list_area" + And I should see "Student 2" in the "favourites" "core_message > Message list area" diff --git a/message/tests/behat/message_send_messages.feature b/message/tests/behat/message_send_messages.feature index 45f1a93c555..519cee1649c 100644 --- a/message/tests/behat/message_send_messages.feature +++ b/message/tests/behat/message_send_messages.feature @@ -31,23 +31,23 @@ Feature: Message send messages Given I log in as "student1" And I open messaging And I open the "Group" conversations list - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging When I send "Hi!" message in the message area - Then I should see "Hi!" in the "Group 1" "group_message_conversation" - And I should see "##today##j F##" in the "Group 1" "group_message_conversation" + Then I should see "Hi!" in the "Group 1" "core_message > Message conversation" + And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" And I log out And I log in as "student2" And I open messaging - And "Group 1" "group_message" should exist + And "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in messaging - And I should see "Hi!" in the "Group 1" "group_message_conversation" + And I should see "Hi!" in the "Group 1" "core_message > Message conversation" Scenario: Send a message to a starred conversation Given I log in as "student1" When I open messaging And I open the "Group" conversations list - Then "Group 1" "group_message" should exist + Then "Group 1" "core_message > Message" should exist And I select "Group 1" conversation in the "group-messages" conversations list And I open contact menu And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element" @@ -56,11 +56,11 @@ Feature: Message send messages And I should see "Group 1" And I select "Group 1" conversation in the "favourites" conversations list And I send "Hi!" message in the message area - And I should see "Hi!" in the "Group 1" "group_message_conversation" - And I should see "##today##j F##" in the "Group 1" "group_message_conversation" + And I should see "Hi!" in the "Group 1" "core_message > Message conversation" + And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" And I go back in "view-conversation" message drawer And I open the "Group" conversations list - And I should not see "Group 1" in the "Group" "group_message_tab" + And I should not see "Group 1" in the "Group" "core_message > Message tab" Scenario: Send a message to a private conversation via contact tab Given the following "message contacts" exist: @@ -71,17 +71,17 @@ Feature: Message send messages And I click on "Contacts" "link" And I click on "Student 2" "link" in the "//*[@data-section='contacts']" "xpath_element" When I send "Hi!" message in the message area - Then I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" Scenario: Try to send a message to a private conversation is not contact but you are allowed to send a message Given I log in as "student1" And I open messaging When I send "Hi!" message to "Student 2" user - Then I should see "Hi!" in the "Student 2" "group_message_conversation" - And I should see "##today##j F##" in the "Student 2" "group_message_conversation" + Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" And I log out And I log in as "student2" And I open messaging And I select "Student 1" conversation in messaging - And I should see "Hi!" in the "Student 1" "group_message_conversation" \ No newline at end of file + And I should see "Hi!" in the "Student 1" "core_message > Message conversation" diff --git a/message/tests/behat/mute_conversations.feature b/message/tests/behat/mute_conversations.feature index 4a40e60e9c2..ca30488036d 100644 --- a/message/tests/behat/mute_conversations.feature +++ b/message/tests/behat/mute_conversations.feature @@ -33,15 +33,15 @@ Feature: Mute and unmute conversations Given I log in as "student1" When I open messaging And I open the "Group" conversations list - Then "Group 1" "group_message" should exist - And "muted" "icon_container" in the "Group 1" "group_message" should not be visible + Then "Group 1" "core_message > Message" should exist + And "muted" "icon_container" in the "Group 1" "core_message > Message" should not be visible And I select "Group 1" conversation in messaging - And "muted" "icon_container" in the "Group 1" "group_message_header" should not be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message header" should not be visible And I open contact menu And I click on "Mute" "link" in the "[data-region='header-container']" "css_element" - And "muted" "icon_container" in the "Group 1" "group_message_header" should be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message header" should be visible And I go back in "view-conversation" message drawer - And "muted" "icon_container" in the "Group 1" "group_message" should be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message" should be visible Scenario: Mute a private conversation When I log in as "student1" @@ -49,14 +49,14 @@ Feature: Mute and unmute conversations Then I should see "Private" And I open the "Private" conversations list And I should see "Student 2" - And "muted" "icon_container" in the "Student 2" "group_message" should not be visible + And "muted" "icon_container" in the "Student 2" "core_message > Message" should not be visible And I select "Student 2" conversation in messaging And "muted" "icon_container" in the "[data-action='view-contact']" "css_element" should not be visible And I open contact menu And I click on "Mute" "link" in the "[data-region='header-container']" "css_element" And "muted" "icon_container" in the "[data-action='view-contact']" "css_element" should be visible And I go back in "view-conversation" message drawer - And "muted" "icon_container" in the "Student 2" "group_message" should be visible + And "muted" "icon_container" in the "Student 2" "core_message > Message" should be visible Scenario: Unmute a group conversation Given the following "muted group conversations" exist: @@ -65,15 +65,15 @@ Feature: Mute and unmute conversations When I log in as "student1" And I open messaging And I open the "Group" conversations list - Then "Group 1" "group_message" should exist - And "muted" "icon_container" in the "Group 1" "group_message" should be visible + Then "Group 1" "core_message > Message" should exist + And "muted" "icon_container" in the "Group 1" "core_message > Message" should be visible And I select "Group 1" conversation in messaging - And "muted" "icon_container" in the "Group 1" "group_message_header" should be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message header" should be visible And I open contact menu And I click on "Unmute" "link" in the "[data-region='header-container']" "css_element" - And "muted" "icon_container" in the "Group 1" "group_message_header" should not be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message header" should not be visible And I go back in "view-conversation" message drawer - And "muted" "icon_container" in the "Group 1" "group_message" should not be visible + And "muted" "icon_container" in the "Group 1" "core_message > Message" should not be visible Scenario: Unmute a private conversation Given the following "muted private conversations" exist: @@ -84,11 +84,11 @@ Feature: Mute and unmute conversations Then I should see "Private" And I open the "Private" conversations list And I should see "Student 2" - And "muted" "icon_container" in the "Student 2" "group_message" should be visible + And "muted" "icon_container" in the "Student 2" "core_message > Message" should be visible And I select "Student 2" conversation in messaging And "muted" "icon_container" in the "[data-action='view-contact']" "css_element" should be visible And I open contact menu And I click on "Unmute" "link" in the "[data-region='header-container']" "css_element" And "muted" "icon_container" in the "[data-action='view-contact']" "css_element" should not be visible And I go back in "view-conversation" message drawer - And "muted" "icon_container" in the "Student 2" "group_message" should not be visible + And "muted" "icon_container" in the "Student 2" "core_message > Message" should not be visible diff --git a/message/tests/behat/self_conversation.feature b/message/tests/behat/self_conversation.feature index 5063b3cd2ed..ea7a669cce4 100644 --- a/message/tests/behat/self_conversation.feature +++ b/message/tests/behat/self_conversation.feature @@ -15,47 +15,47 @@ Feature: Self conversation Scenario: Self conversation exists Given I log in as "student1" When I open messaging - Then "Student 1" "group_message" should exist + Then "Student 1" "core_message > Message" should exist And I select "Student" conversation in messaging And I should see "Personal space" Scenario: Self conversation can be unstarred Given I log in as "student1" When I open messaging - Then "Student 1" "group_message" should exist + Then "Student 1" "core_message > Message" should exist And I select "Student" conversation in messaging And I open contact menu - And I click on "Unstar" "link" in the "Student 1" "group_message_header" + And I click on "Unstar" "link" in the "Student 1" "core_message > Message header" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should not see "Student 1" in the "favourites" "group_message_list_area" + And I should not see "Student 1" in the "favourites" "core_message > Message list area" And I open the "Private" conversations list - And I should see "Student 1" in the "messages" "group_message_list_area" + And I should see "Student 1" in the "messages" "core_message > Message list area" Scenario: Self conversation can be deleted Given I log in as "student1" When I open messaging - Then "Student 1" "group_message" should exist + Then "Student 1" "core_message > Message" should exist And I select "Student 1" conversation in messaging And I open contact menu - And I click on "Delete conversation" "link" in the "Student 1" "group_message_header" + And I click on "Delete conversation" "link" in the "Student 1" "core_message > Message header" And I should see "Delete" And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element" And I should not see "Delete" And I go back in "view-conversation" message drawer And I open the "Starred" conversations list - And I should not see "Student 1" in the "favourites" "group_message_list_area" + And I should not see "Student 1" in the "favourites" "core_message > Message list area" And I open the "Private" conversations list - And I should not see "Student 1" in the "messages" "group_message_list_area" + And I should not see "Student 1" in the "messages" "core_message > Message list area" Scenario: Send a message to a self-conversation via message drawer Given I log in as "student1" When I open messaging - Then "Student 1" "group_message" should exist + Then "Student 1" "core_message > Message" should exist And I select "Student 1" conversation in messaging And I send "Hi!" message in the message area - And I should see "Hi!" in the "Student 1" "group_message_conversation" - And I should see "##today##j F##" in the "Student 1" "group_message_conversation" + And I should see "Hi!" in the "Student 1" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" Scenario: Send a message to a self-conversation via user profile Given I log in as "student1" @@ -63,5 +63,5 @@ Feature: Self conversation Then I should see "Message" And I click on "Message" "icon" And I send "Hi!" message in the message area - And I should see "Hi!" in the "Student 1" "group_message_conversation" - And I should see "##today##j F##" in the "Student 1" "group_message_conversation" + And I should see "Hi!" in the "Student 1" "core_message > Message conversation" + And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" diff --git a/message/tests/behat/unread_messages.feature b/message/tests/behat/unread_messages.feature index 97f5ffa02fd..bf6095e12ad 100644 --- a/message/tests/behat/unread_messages.feature +++ b/message/tests/behat/unread_messages.feature @@ -31,23 +31,23 @@ Feature: Unread messages Given I log in as "student1" When I open messaging And I open the "Group" conversations list - Then "New group" "group_message" should exist + Then "New group" "core_message > Message" should exist And I select "New group" conversation in messaging And I send "Hi!" message in the message area - And I should see "Hi!" in the "New group" "group_message_conversation" - And I should see "##today##j F##" in the "New group" "group_message_conversation" + And I should see "Hi!" in the "New group" "core_message > Message conversation" + And I should see "##today##j F##" in the "New group" "core_message > Message conversation" And I log out And I log in as "student2" And I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" And I open messaging - And I should see "1" in the "Group" "group_message_tab" - And "New group" "group_message" should exist - And I should see "1" in the "New group" "group_message" + And I should see "1" in the "Group" "core_message > Message tab" + And "New group" "core_message > Message" should exist + And I should see "1" in the "New group" "core_message > Message" And I select "New group" conversation in messaging - And I should see "Hi!" in the "New group" "group_message_conversation" + And I should see "Hi!" in the "New group" "core_message > Message conversation" And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" - And I should not see "1" in the "Group" "group_message_tab" - And I should not see "1" in the "New group" "group_message" + And I should not see "1" in the "Group" "core_message > Message tab" + And I should not see "1" in the "New group" "core_message > Message" Scenario: Unread messages for private conversation Given the following "private messages" exist: @@ -57,14 +57,14 @@ Feature: Unread messages When I log in as "student1" Then I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" And I open messaging - And I should see "1" in the "Private" "group_message_tab" - And "Student 2" "group_message" should exist - And I should see "1" in the "Student 2" "group_message" + And I should see "1" in the "Private" "core_message > Message tab" + And "Student 2" "core_message > Message" should exist + And I should see "1" in the "Student 2" "core_message > Message" And I select "Student 2" conversation in messaging - And I should see "Hi!" in the "Student 2" "group_message_conversation" + And I should see "Hi!" in the "Student 2" "core_message > Message conversation" And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" - And I should not see "1" in the "Private" "group_message_tab" - And I should not see "1" in the "Student 2" "group_message" + And I should not see "1" in the "Private" "core_message > Message tab" + And I should not see "1" in the "Student 2" "core_message > Message" Scenario: Unread messages for starred conversation Given the following "private messages" exist: @@ -77,11 +77,11 @@ Feature: Unread messages When I log in as "student1" Then I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" And I open messaging - And I should see "1" in the "Starred" "group_message_tab" - And "Student 2" "group_message" should exist - And I should see "1" in the "Student 2" "group_message" + And I should see "1" in the "Starred" "core_message > Message tab" + And "Student 2" "core_message > Message" should exist + And I should see "1" in the "Student 2" "core_message > Message" And I select "Student 2" conversation in messaging - And I should see "Hi!" in the "Student 2" "group_message_conversation" + And I should see "Hi!" in the "Student 2" "core_message > Message conversation" And I should not see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" - And I should not see "1" in the "Starred" "group_message_tab" - And I should not see "1" in the "Student 2" "group_message" + And I should not see "1" in the "Starred" "core_message > Message tab" + And I should not see "1" in the "Student 2" "core_message > Message"