X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FMember%2FOnlineAutoRenewMembershipTest.php;h=74fa8c37b21c4a68a6d0223529479b3b9e711c6c;hb=85d7b6d4128a6f3343501ae71473a992b74feb58;hp=86cef3729072fc402912844a5faa990212dafc3f;hpb=360067bfcde509898bcc086dec198f32794aa586;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php index 86cef37290..74fa8c37b2 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php @@ -1,9 +1,9 @@ openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -49,31 +48,28 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type('email-5', "{$lastName}@example.com"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $text = 'This membership will be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); } function testOnlineAutoRenewMembershipAuthenticated() { //configure membership signup page. $pageId = $this->_configureMembershipPage(); - $this->open($this->sboxPath); $this->webtestLogin(); $this->waitForPageToLoad($this->getTimeoutMsec()); //now do the test membership signup. $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -88,13 +84,13 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->waitForElementPresent("_qf_Confirm_next-bottom"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $text = 'This membership will be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); } function testOnlinePendingAutoRenewMembershipAnonymous() { @@ -103,7 +99,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase //now do the test membership signup. $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -116,25 +112,24 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->waitForElementPresent("_qf_Confirm_next-bottom"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $text = 'This membership will be renewed automatically every 1 year(s).'; - $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); + $this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]", $text, 'Missing text: ' . $text); } function _configureMembershipPage() { static $pageId = NULL; if (!$pageId) { - $this->open($this->sboxPath); - $this->webtestLogin(); + $this->webtestLogin(); //add payment processor. - $hash = substr(sha1(rand()), 0, 7); - $rand = 2 * rand(2, 50); + $hash = substr(sha1(rand()), 0, 7); + $rand = 2 * rand(2, 50); $processorName = "Webtest Auto Renew AuthNet" . $hash; $this->webtestAddPaymentProcessor($processorName, 'AuthNet'); @@ -145,9 +140,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - - //wait for the auto-complete member_of_contact to populate - sleep(2); + $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -159,29 +152,26 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - //wait for the auto-complete member_of_contact to populate - sleep(2); $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // create contribution page with randomized title and default params - $amountSection = FALSE; - $payLater = TRUE; - $onBehalf = FALSE; - $pledges = FALSE; - $recurring = TRUE; + $amountSection = FALSE; + $payLater = TRUE; + $onBehalf = FALSE; + $pledges = FALSE; + $recurring = TRUE; $membershipTypes = array(array('id' => 1, 'auto_renew' => 1), array('id' => 2, 'auto_renew' => 1), ); $memPriceSetId = NULL; - $friend = TRUE; - $profilePreId = NULL; + $friend = TRUE; + $profilePreId = NULL; $profilePostId = NULL; - $premiums = TRUE; - $widget = TRUE; - $pcp = TRUE; + $premiums = TRUE; + $widget = TRUE; + $pcp = TRUE; $contributionTitle = "Title $hash"; $pageId = $this->webtestAddContributionPage($hash, @@ -205,11 +195,11 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase ); //make sure we do have required permissions. - $permissions = array("edit-1-make-online-contributions"); + $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms"); $this->changePermissions($permissions); // now logout and do membership test that way - $this->openCiviPage('logout', 'reset=1', NULL); + $this->webtestLogout(); } return $pageId;