X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FMailing%2FMailingTest.php;h=2c542c7bebd3252fcd258f38c8ca76329f63b122;hb=HEAD;hp=9abbc437a94a9b30dcc6fe274ebfc89792e62b9d;hpb=b812c745fe6f05312c761952af4634e9912da158;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index 9abbc437a9..7f067fc7f5 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -1,9 +1,9 @@ openCiviPage("a/#/mailing/new"); //-------select recipients---------- + $tokens = ' {domain.address}{action.optOutUrl}'; // fill mailing name $mailingName = substr(sha1(rand()), 0, 7); @@ -98,15 +99,17 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { // HTML format message $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest."; - $this->fillRichTextField("crmUiId_1", $HTMLMessage); - $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']"); - $this->waitForTextPresent($HTMLMessage); - $this->waitForAjaxContent(); - $this->click("xpath=//button[@title='Close']"); + $this->fillRichTextField("crmUiId_1", $HTMLMessage . $tokens); + + // FIXME: Selenium can't access content in an iframe + //$this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']"); + //$this->waitForTextPresent($HTMLMessage); + //$this->waitForAjaxContent(); + //$this->click("xpath=//button[@title='Close']"); // Open Plain-text Format pane and type text format msg - $this->click("//div[text()='Plain Text']"); - $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$mailingName} Webtest."); + $this->click("//div[starts-with(text(),'Plain Text')]"); + $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$mailingName} Webtest.$tokens"); $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']"); $this->waitForTextPresent("This is text formatted content for Mailing {$mailingName} Webtest."); @@ -130,7 +133,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->waitForTextPresent("Mailing $mailingName Webtest"); $this->click("xpath=//div[@class='content']//a[text()='~1 recipient']"); - $this->webtestVerifyTabularData(array("$firstName Mailson"=> "mailino$firstName@mailson.co.in")); + $this->webtestVerifyTabularData(array("$firstName Mailson" => "mailino$firstName@mailson.co.in")); $this->click("xpath=//button[@title='Close']"); $this->waitForTextPresent("(Include: $groupName)"); @@ -250,7 +253,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { //------end delivery verification--------- // //------ check with unsubscribe ------- - // // FIX ME: there is an issue with DSN setting for Webtest, need to handle by seperate DSN setting for Webtests + // // FIX ME: there is an issue with DSN setting for Webtest, need to handle by separate DSN setting for Webtests // // build unsubscribe link // require_once 'CRM/Mailing/Event/DAO/Queue.php'; // $eventQueue = new CRM_Mailing_Event_DAO_Queue( ); @@ -331,6 +334,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->openCiviPage("a/#/mailing/new"); //-------select recipients---------- + $tokens = ' {domain.address}{action.optOutUrl}'; // fill mailing name $mailingName = substr(sha1(rand()), 0, 7); @@ -348,15 +352,17 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { // HTML format message $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest."; - $this->fillRichTextField("crmUiId_1", $HTMLMessage); - $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']"); - $this->waitForElementPresent($HTMLMessage); - $this->waitForAjaxContent(); - $this->click("xpath=//button[@title='Close']"); + $this->fillRichTextField("crmUiId_1", $HTMLMessage . $tokens); + + // FIXME: Selenium can't access content in an iframe + //$this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']"); + //$this->waitForElementPresent($HTMLMessage); + //$this->waitForAjaxContent(); + //$this->click("xpath=//button[@title='Close']"); // Open Plain-text Format pane and type text format msg - $this->click("//div[text()='Plain Text']"); - $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$mailingName} Webtest."); + $this->click("//div[starts-with(text(),'Plain Text')]"); + $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$mailingName} Webtest.$tokens"); $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']"); $this->waitForTextPresent("This is text formatted content for Mailing {$mailingName} Webtest."); @@ -380,7 +386,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->waitForTextPresent("Mailing $mailingName Webtest"); $this->click("xpath=//div[@class='content']//a[text()='~1 recipient']"); - $this->webtestVerifyTabularData(array("$firstName Mailson"=> "mailino$firstName@mailson.co.in")); + $this->webtestVerifyTabularData(array("$firstName Mailson" => "mailino$firstName@mailson.co.in")); $this->click("xpath=//button[@title='Close']"); $this->waitForTextPresent("(Include: $groupName)");