From b4a57e40e0c81d1a4bdb25be8bc3b1eb818eb0af Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 12 Mar 2015 18:36:36 +0530 Subject: [PATCH] webtest fixes --- .../Contribute/OnlineContributionTest.php | 2 +- .../OnlineRecurContributionTest.php | 2 +- .../WebTest/Event/PricesetMaxCountTest.php | 55 +++---------------- 3 files changed, 10 insertions(+), 49 deletions(-) diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index 037d6cd410..52b56a96f8 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -259,7 +259,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { //logout $this->webtestLogout(); $amountLabel = 'Total Amount'; - $amountValue = '1.00'; + $amountValue = '0.00'; //Open Live Contribution Page $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); diff --git a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php index e9e2827dfb..23ca9642fd 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php @@ -112,7 +112,7 @@ class WebTest_Contribute_OnlineRecurContributionTest extends CiviSeleniumTestCas // Confirmation page $this->waitForElementPresent("_qf_Confirm_next-bottom"); - $text = 'I want to contribute this amount every 1 month(s) for 12 installments.'; + $text = 'I want to contribute this amount every month for 12 installments.'; $this->assertTrue($this->isTextPresent($text), 'Missing recurring contribution text (confirmation): ' . $text); $text = $rand; $this->assertTrue($this->isTextPresent($contributionAmount), 'Missing contribution amount (confirmation): ' . $contributionAmount); diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index decb54feec..512e3de4ce 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -211,11 +211,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // select sold option for select field, check for form rule - $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp1}']", "(Sold out)"); // fill correct available option for select field $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); @@ -410,12 +406,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for sold option for select field - $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); - - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp1}']", "(Sold out)"); // check for sold option for select field $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); @@ -620,12 +611,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Participant_2_next-Array'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // Skip participant3 and register $this->click('_qf_Participant_2_next_skip-Array'); @@ -664,12 +650,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select field - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // fill available value for select $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); @@ -695,12 +676,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select field - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Participant_1_next-Array'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // fill available value for select $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); @@ -912,12 +888,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Participant_2_next-Array'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // Skip participant3 and register $this->click('_qf_Participant_2_next_skip-Array'); @@ -956,12 +927,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select field - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // fill available value for select $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); @@ -987,12 +953,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type("xpath=//input[@id='price_{$textFieldId}']", '1'); // check for select field - $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}"); - - $this->click('_qf_Participant_1_next-Array'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->assertStringsPresent(array('Sorry, this option is currently sold out.')); + $this->assertElementContainsText("xpath=//select[@id='price_{$selectFieldId}']//option[@value='crm_disabled_opt-{$selectFieldOp2}']", "(Sold out)"); // fill available value for select $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}"); -- 2.25.1