webtestLogin(); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click('link=CiviCRM'); $this->waitForPageToLoad($this->getTimeoutMsec()); //jump directly to relationship type selector. $this->openCiviPage('admin/reltype', 'reset=1&action=browse'); //load the form to add new relationship type. $this->click('link=Add Relationship Type'); $this->waitForElementPresent('_qf_RelationshipType_next-bottom'); //enter the relationship type values. $labelAB = 'Test Relationship Type A - B -' . rand(); $labelBA = 'Test Relationship Type B - A -' . rand(); $this->type('label_a_b', $labelAB); $this->type('label_b_a', $labelBA); $this->select('contact_types_a', "value=Individual"); $this->select('contact_types_b', "value=Individual"); $this->type('description', 'Test Relationship Type Description'); //save the data. $this->click('_qf_RelationshipType_next-bottom'); //does data saved. $this->waitForText('crm-notification-container', 'The Relationship Type has been saved.'); $this->waitForElementPresent('link=Add Relationship Type'); //validate data. $data = array( 'Relationship A to B' => $labelAB, 'Relationship B to A' => $labelBA, 'Contact Type A' => 'Individual', 'Contact Type B' => 'Individual', ); foreach ($data as $param => $val) { $this->assertElementContainsText('option11', $val, "Could not able to save $param"); } } function testRelationshipTypeAddValidateFormRules() { $this->webtestLogin(); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click('link=CiviCRM'); $this->waitForPageToLoad($this->getTimeoutMsec()); //jump directly to relationship type selector. $this->openCiviPage('admin/reltype', 'reset=1&action=browse'); //validate form rules. $this->click('link=Add Relationship Type'); $this->waitForElementPresent('_qf_RelationshipType_next-bottom'); $this->select('contact_types_a', 'value=Individual'); $this->select('contact_types_b', 'value=Individual'); $description = 'Test Relationship Type Description'; $this->type('description', $description); $this->click('_qf_RelationshipType_next-bottom'); $this->waitForText("xpath=//*[@id='RelationshipType']/div[2]/table/tbody/tr[1]/td[2]/label[@class='error']", 'This field is required.'); //enter the relationship type values. $labelAB = 'Test Relationship Type A - B - DUPLICATE TO BE' . rand(); $labelBA = 'Test Relationship Type B - A - DUPLICATE TO BE' . rand(); $this->type('label_a_b', $labelAB); $this->type('label_b_a', $labelBA); $this->select('contact_types_a', "value=Individual"); $this->select('contact_types_b', "value=Individual"); $this->type('description', 'Test Relationship Type Description'); $this->click('_qf_RelationshipType_next-bottom'); $this->waitForElementPresent('link=Add Relationship Type'); $this->openCiviPage('admin/reltype', 'reset=1&action=browse'); $this->click('link=Add Relationship Type'); $this->waitForElementPresent('_qf_RelationshipType_next-bottom'); $this->type('label_a_b', $labelAB); $this->type('label_b_a', $labelBA); $this->click('_qf_RelationshipType_next-bottom'); $this->waitForText('crm-notification-container', 'Label already exists in Database.'); } }