CRM-18050: Webtest
authorWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 22 Apr 2016 13:04:37 +0000 (18:34 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 22 Apr 2016 13:04:37 +0000 (18:34 +0530)
tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php

index d8db6390794b73b7cf41216aec00e41f8b136465..5ce0bd82676b52699cac0c5b49d0c04095037e77 100644 (file)
@@ -112,4 +112,38 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase
     }
   }
 
+  /**
+   * CRM-18050: create price set with auto-renewing memberships.
+   */
+  public function testCreatePriceSetWithAutoRenewMembershipType() {
+    $this->webtestLogin();
+
+    // Create a membership type to use for this test
+    $periodType = 'rolling';
+    $duration_interval = 1;
+    $duration_unit = 'year';
+    $auto_renew = "required";
+    $priceSetTitle = 'Membership PriceSet' . substr(sha1(rand()), 0, 7);
+    $memTypeParams = $this->webtestAddMembershipType($periodType, $duration_interval, $duration_unit, $auto_renew);
+
+    // Create a price set with membership type.
+    $this->openCiviPage("admin/price", "reset=1&action=add", '_qf_Set_cancel-bottom');
+    $this->type('title', $priceSetTitle);
+    $this->click("xpath=//table[@class='form-layout']/tbody//tr/td[2]/label[text()='Membership']");
+    $this->select('financial_type_id', "value=2");
+    $this->click("_qf_Set_next-bottom");
+    $this->waitForAjaxContent();
+    $this->waitForElementPresent('is_active');
+    $fieldLablel = 'Field Label' . substr(sha1(rand()), 0, 7);
+    $this->type('label', $fieldLablel);
+    $this->select('html_type', "value=Radio");
+    $this->waitForAjaxContent();
+    $this->waitForElementPresent('membership_type_id[1]');
+    $this->select('membership_type_id[1]', "label={$memTypeParams['membership_type']}");
+    $this->waitForAjaxContent();
+    $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Save']");
+    $this->waitForElementPresent('field_page');
+    $this->assertElementContainsText("xpath=//div[@id='crm-main-content-wrapper']/div[@id='field_page']/table/tbody/tr/td[1]/div", "{$fieldLablel}");
+  }
+
 }