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_Admin_RelationshipTypeAddTest
32 class WebTest_Admin_RelationshipTypeAddTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testRelationshipTypeAdd() {
40 $this->webtestLogin();
41 $this->waitForPageToLoad($this->getTimeoutMsec());
43 $this->click('link=CiviCRM');
44 $this->waitForPageToLoad($this->getTimeoutMsec());
46 //jump directly to relationship type selector.
47 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
49 //load the form to add new relationship type.
50 $this->click('link=Add Relationship Type');
51 $this->waitForElementPresent('_qf_RelationshipType_next-bottom');
53 //enter the relationship type values.
54 $labelAB = 'Test Relationship Type A - B -' . rand();
55 $labelBA = 'Test Relationship Type B - A -' . rand();
56 $this->type('label_a_b', $labelAB);
57 $this->type('label_b_a', $labelBA);
58 $this->select('contact_types_a', "value=Individual");
59 $this->select('contact_types_b', "value=Individual");
60 $this->type('description', 'Test Relationship Type Description');
63 $this->click('_qf_RelationshipType_next-bottom');
66 $this->waitForText('crm-notification-container', 'The Relationship Type has been saved.');
68 $this->waitForElementPresent('link=Add Relationship Type');
71 'Relationship A to B' => $labelAB,
72 'Relationship B to A' => $labelBA,
73 'Contact Type A' => 'Individual',
74 'Contact Type B' => 'Individual',
76 foreach ($data as $param => $val) {
77 $this->assertElementContainsText("xpath=//table[@class='display dataTable no-footer']", $val, "Could not able to save $param");
81 public function testRelationshipTypeAddValidateFormRules() {
83 $this->webtestLogin();
84 $this->waitForPageToLoad($this->getTimeoutMsec());
86 $this->click('link=CiviCRM');
87 $this->waitForPageToLoad($this->getTimeoutMsec());
89 //jump directly to relationship type selector.
90 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
92 //validate form rules.
93 $this->click('link=Add Relationship Type');
94 $this->waitForElementPresent('_qf_RelationshipType_next-bottom');
96 $this->select('contact_types_a', 'value=Individual');
97 $this->select('contact_types_b', 'value=Individual');
98 $description = 'Test Relationship Type Description';
99 $this->type('description', $description);
101 $this->click('_qf_RelationshipType_next-bottom');
102 $this->waitForText("xpath=//*[@id='RelationshipType']/div[2]/table/tbody/tr[1]/td[2]/label[@class='crm-inline-error']", 'This field is required.');
104 //enter the relationship type values.
105 $labelAB = 'Test Relationship Type A - B - DUPLICATE TO BE' . rand();
106 $labelBA = 'Test Relationship Type B - A - DUPLICATE TO BE' . rand();
107 $this->type('label_a_b', $labelAB);
108 $this->type('label_b_a', $labelBA);
109 $this->select('contact_types_a', "value=Individual");
110 $this->select('contact_types_b', "value=Individual");
111 $this->type('description', 'Test Relationship Type Description');
112 $this->click('_qf_RelationshipType_next-bottom');
113 $this->waitForElementPresent('link=Add Relationship Type');
115 $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
116 $this->click('link=Add Relationship Type');
117 $this->waitForElementPresent('_qf_RelationshipType_next-bottom');
119 $this->type('label_a_b', $labelAB);
120 $this->type('label_b_a', $labelBA);
121 $this->click('_qf_RelationshipType_next-bottom');
123 $this->waitForText('crm-notification-container', 'Label already exists in Database.');