From e6d18d9d0044e2773ce8af3eccb90cea77401467 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 8 Apr 2013 12:24:23 +0800 Subject: [PATCH 1/2] MDL-38952 behat: Adding no-JS compatibility This step is widely used by JS scenarios, with Javascript disabled this step fails tests as tree nodes al already expanded; we can reuse JS scenarios for no-JS tests skiping this step in no-JS mode. --- lib/tests/behat/behat_navigation.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index fe1e47800e5..f3bad4610ba 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -46,6 +46,13 @@ class behat_navigation extends behat_base { */ public function i_expand_node($nodetext) { + // This step is useless with Javascript disabled as Moodle auto expands + // all of tree's nodes; adding this because of scenarios that shares the + // same steps with and without Javascript enabled. + if (!$this->running_javascript()) { + return false; + } + $xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')] /child::li /child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')] From 1c1c28660ac183045fc47dd852e73ff0718e575e Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 8 Apr 2013 12:25:25 +0800 Subject: [PATCH 2/2] MDL-38952 behat: New test According to MDLQA-134, a users can manage their contacts. --- message/tests/behat/manage_contacts.feature | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 message/tests/behat/manage_contacts.feature diff --git a/message/tests/behat/manage_contacts.feature b/message/tests/behat/manage_contacts.feature new file mode 100644 index 00000000000..a8dea48d638 --- /dev/null +++ b/message/tests/behat/manage_contacts.feature @@ -0,0 +1,32 @@ +@core_message +Feature: Manage contacts + In order to easily access the users I interact more with + As a moodle user + I need to add and remove users to/from my contacts list + + Background: + Given the following "users" exists: + | username | firstname | lastname | email | + | user1 | User | One | one@asd.com | + | user2 | User | Two | two@asd.com | + And I log in as "user1" + And I send "Message 1 from user1 to user2" message to "user2" + And I send "Message 2 from user1 to user2" message to "user2" + And I follow "Messages" + And I fill in "Search people and messages" with "User Two" + And I press "Search people and messages" + When I click on "Add contact" "link" in the "User Two" table row + Then I should see "Message 1 from user1 to user2" + And I should see "Message 2 from user1 to user2" + And I should see "User Two" in the "#message_contacts" "css_element" + And I follow "Remove contact" + And I should not see "User Two" in the "#message_contacts" "css_element" + And I should not see "Remove contact" + And I should see "Add contact" + And I follow "Add contact" + And I should see "User Two" in the "#message_contacts" "css_element" + + @javascript + Scenario: Adding and removing contacts with Javascript enabled + + Scenario: Adding and removing contacts with Javascript disabled