// configure default mail-box
$this->setupDefaultMailbox();
- $this->openCiviPage("mailing/send", "reset=1", "_qf_Group_cancel");
+ $this->openCiviPage("a/#/mailing/new");
//-------select recipients----------
// fill mailing name
$mailingName = substr(sha1(rand()), 0, 7);
- $this->type("name", "Mailing $mailingName Webtest");
+ $this->waitForElementPresent("xpath=//input[@name='mailingName']");
+ $this->type("xpath=//input[@name='mailingName']", "Mailing $mailingName Webtest");
// Add the test mailing group
- $this->select("includeGroups", "$groupName");
+ $this->select2("s2id_crmUiId_8", $groupName, TRUE);
- // click next
- $this->clickLink("_qf_Group_next", "_qf_Settings_cancel", FALSE);
+ // do check count for Recipient
+ $this->waitForTextPresent("~1 recipient");
- //--------track and respond----------
+ // fill subject for mailing
+ $this->type("xpath=//input[@name='subject']", "Test subject {$mailingName} for Webtest");
- // check for default settings options
- $this->assertChecked("url_tracking");
- $this->assertChecked("open_tracking");
+ // HTML format message
+ $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest.";
+ $this->fillRichTextField("crmUiId_1", $HTMLMessage);
- // do check count for Recipient
- $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
+ $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as HTML']");
+ $this->waitForTextPresent($HTMLMessage);
+ $this->waitForAjaxContent();
+ $this->click("xpath=//button[@title='Close']");
- // no need tracking for this test
+ // 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.");
- // click next with default settings
- $this->clickLink("_qf_Settings_next", "_qf_Upload_cancel");
+ $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']");
+ $this->waitForTextPresent("This is text formatted content for Mailing {$mailingName} Webtest.");
+ $this->waitForAjaxContent();
+ $this->click("xpath=//button[@title='Close']");
- //--------Mailing content------------
- // let from email address be default
+ // select default header and footer ( with label )
+ $this->click("xpath=//ul/li/a[text()='Header and Footer']");
+ $this->select2("s2id_crmUiId_10", "Mailing Header");
+ $this->select2("s2id_crmUiId_11", "Mailing Footer");
- // fill subject for mailing
- $this->type("subject", "Test subject {$mailingName} for Webtest");
+ //--------track and respond----------
- // check for default option enabled
- $this->assertChecked("CIVICRM_QFID_1_upload_type");
+ // check for default settings options
+ $this->click("xpath=//ul/li/a[text()='Tracking']");
+ $this->assertChecked("url_tracking");
+ $this->assertChecked("open_tracking");
- // HTML format message
- $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest.";
- $this->fillRichTextField("html_message", $HTMLMessage);
+ // click next with default settings
+ $this->click("xpath=//div[@class='crm-wizard-buttons']/button[text()='Next']");
- // Open Plain-text Format pane and type text format msg
- $this->click("//fieldset[@id='compose_id']/div[2]/div[1]");
- $this->type("text_message", "This is text formatted content for Mailing {$mailingName} Webtest.");
+ $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->click("xpath=//button[@title='Close']");
+ $this->waitForTextPresent("(Include: $groupName)");
- // select default header and footer ( with label )
- $this->select("header_id", "label=Mailing Header");
- $this->select("footer_id", "label=Mailing Footer");
+ //----------Schedule or Send------------
- // do check count for Recipient
- $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
+ // do check for default option enabled
+ $this->assertChecked("xpath=//input[@id='schedule-send-now']");
// click next with nominal content
- $this->clickLink("_qf_Upload_upload", "_qf_Test_cancel");
+ $this->click("xpath=//center/a/div[text()='Submit Mailing']");
//---------------Test------------------
////////
- // do check count for Recipient
- $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
-
- // click next
- $this->clickLink("_qf_Test_next", "_qf_Schedule_cancel");
-
- //----------Schedule or Send------------
-
- // do check for default option enabled
- $this->assertChecked("now");
-
- // do check count for Recipient
- $this->assertElementContainsText('css=.messages', "Total Recipients: 1");
-
- // finally schedule the mail by clicking submit
- $this->clickLink("_qf_Schedule_next");
-
//----------end New Mailing-------------
//check redirected page to Scheduled and Sent Mailings and verify for mailing name
- $this->assertElementContainsText('page-title', "Find Mailings");
+ $this->waitForTextPresent("Find Mailings");
$this->assertElementContainsText("xpath=//table[@class='selector row-highlight']/tbody//tr//td", "Mailing $mailingName Webtest");
//--------- mail delivery verification---------
$this->clickLink("link=Successful Deliveries");
// check for open page
- $this->assertElementContainsText('page-title', "Successful Deliveries");
+ $this->waitForTextPresent("Successful Deliveries");
// verify email
$this->verifyText("xpath=//table[@id='mailing_event']/tbody//tr/td[2]", preg_quote("mailino$firstName@mailson.co.in"));