3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contact_PrevNextTest
32 class WebTest_Contact_PrevNextTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testPrevNext() {
39 $this->webtestLogin();
43 $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload');
45 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
46 $this->type("title", $groupName);
49 $this->type("description", "Adding new group.");
51 // check Access Control
52 $this->click("group_type[1]");
55 $this->click("_qf_Edit_upload");
56 $this->waitForPageToLoad($this->getTimeoutMsec());
61 $contact1 = substr(sha1(rand()), 0, 7);
62 $this->webtestAddContact($contact1, "AAA", "{$contact1}@example.com");
64 // Add Individual 1 to group
65 $this->click('css=li#tab_group a');
66 $this->waitForElementPresent('_qf_GroupContact_next');
67 $this->select('group_id', "label={$groupName}");
68 $this->click('_qf_GroupContact_next');
69 $this->waitForText('crm-notification-container', "Added to Group");
72 $contact2 = substr(sha1(rand()), 0, 7);
73 $this->webtestAddContact($contact2, "BBB", "{$contact2}@example.com");
75 // Add Individual 2 to group
76 $this->click('css=li#tab_group a');
77 $this->waitForElementPresent('_qf_GroupContact_next');
78 $this->select('group_id', "label={$groupName}");
79 $this->click('_qf_GroupContact_next');
80 $this->waitForText('crm-notification-container', "Added to Group");
83 $contact3 = substr(sha1(rand()), 0, 7);
84 $this->webtestAddContact($contact3, "CCC", "{$contact3}@example.com");
86 // Add Individual 3 to group
87 $this->click('css=li#tab_group a');
88 $this->waitForElementPresent('_qf_GroupContact_next');
89 $this->select('group_id', "label={$groupName}");
90 $this->click('_qf_GroupContact_next');
91 $this->waitForText('crm-notification-container', "Added to Group");
94 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
96 $this->select('group', "label={$groupName}");
97 $this->click("_qf_Basic_refresh");
98 $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
99 $this->assertElementContainsText('search-status', "3 Contacts");
101 $this->click("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[3]/a");
102 $this->waitForPageToLoad($this->getTimeoutMsec());
104 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
105 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
107 $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
108 $this->waitForPageToLoad($this->getTimeoutMsec());
109 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
110 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
111 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
113 $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
114 $this->waitForPageToLoad($this->getTimeoutMsec());
115 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact3} CCC");
116 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
118 $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
119 $this->waitForPageToLoad($this->getTimeoutMsec());
120 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
121 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
122 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
124 $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
125 $this->waitForPageToLoad($this->getTimeoutMsec());
126 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
127 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");