3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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';
28 class WebTest_Admin_RelationshipTypeAddTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function testRelationshipTypeAdd() {
36 $this->webtestLogin();
37 $this->waitForPageToLoad($this->getTimeoutMsec());
39 $this->click('link=CiviCRM');
40 $this->waitForPageToLoad($this->getTimeoutMsec());
42 //jump directly to relationship type selector.
43 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
45 //load the form to add new relationship type.
46 $this->click('link=Add Relationship Type');
47 $this->waitForPageToLoad($this->getTimeoutMsec());
49 //enter the relationship type values.
50 $labelAB = 'Test Relationship Type A - B -' . rand();
51 $labelBA = 'Test Relationship Type B - A -' . rand();
52 $this->type('label_a_b', $labelAB);
53 $this->type('label_b_a', $labelBA);
54 $this->select('contact_types_a', "value=Individual");
55 $this->select('contact_types_b', "value=Individual");
56 $this->type('description', 'Test Relationship Type Description');
59 $this->click('_qf_RelationshipType_next-bottom');
60 $this->waitForPageToLoad($this->getTimeoutMsec());
63 $this->waitForText('crm-notification-container', 'The Relationship Type has been saved.');
67 'Relationship A to B' => $labelAB,
68 'Relationship B to A' => $labelBA,
69 'Contact Type A' => 'Individual',
70 'Contact Type B' => 'Individual',
72 foreach ($data as $param => $val) {
73 $this->assertElementContainsText('option11', $val, "Could not able to save $param");
77 function testRelationshipTypeAddValidateFormRules() {
79 $this->webtestLogin();
80 $this->waitForPageToLoad($this->getTimeoutMsec());
82 $this->click('link=CiviCRM');
83 $this->waitForPageToLoad($this->getTimeoutMsec());
85 //jump directly to relationship type selector.
86 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
88 //validate form rules.
89 $this->click('link=Add Relationship Type');
90 $this->waitForPageToLoad($this->getTimeoutMsec());
92 $this->select('contact_types_a', 'value=Individual');
93 $this->select('contact_types_b', 'value=Individual');
94 $description = 'Test Relationship Type Description';
95 $this->type('description', $description);
97 $this->click('_qf_RelationshipType_next-bottom');
98 $this->waitForPageToLoad($this->getTimeoutMsec());
99 $this->waitForText('crm-notification-container', 'Relationship Label-A to B is a required field.');
101 //enter the relationship type values.
102 $labelAB = 'Test Relationship Type A - B - DUPLICATE TO BE' . rand();
103 $labelBA = 'Test Relationship Type B - A - DUPLICATE TO BE' . rand();
104 $this->type('label_a_b', $labelAB);
105 $this->type('label_b_a', $labelBA);
106 $this->select('contact_types_a', "value=Individual");
107 $this->select('contact_types_b', "value=Individual");
108 $this->type('description', 'Test Relationship Type Description');
109 $this->click('_qf_RelationshipType_next-bottom');
110 $this->waitForPageToLoad($this->getTimeoutMsec());
112 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
113 $this->click('link=Add Relationship Type');
114 $this->waitForPageToLoad($this->getTimeoutMsec());
116 $this->type('label_a_b', $labelAB);
117 $this->type('label_b_a', $labelBA);
118 $this->click('_qf_RelationshipType_next-bottom');
120 $this->waitForPageToLoad($this->getTimeoutMsec());
121 $this->waitForText('crm-notification-container', 'Label already exists in Database.');