/**
* Force a link to open full-page, even if it would normally open in a popup
+ * @note: works with links only, not buttons
* @param string $element
* @param string $waitFor
*/
}
/**
- * Wait for ajax snippets to finish loading
+ * Wait for all ajax snippets to finish loading
*/
function waitForAjaxContent() {
- // Add sleep to prevent condition where we click an ajax button and call this function before the content has even started loading
- // TODO: When test suite is more stable, try removing sleep() and see if it breaks anything
- sleep(1);
$this->waitForElementNotPresent('css=.blockOverlay');
+ // Some ajax calls happen in pairs (e.g. submit a popup form then refresh the underlying content)
+ // So we'll wait a sec and recheck to see if any more stuff is loading
+ sleep(1);
+ if ($this->isElementPresent('css=.blockOverlay')) {
+ $this->waitForAjaxContent();
+ }
}
/**
$this->select('protocol', "IMAP");
$this->type('server', 'localhost');
$this->type('domain', 'example.com');
- $this->click('_qf_MailSettings_next-top');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_MailSettings_next-top');
}
}
$customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle));
$return[] = array(
"{$customSet['entity']}_{$customSet['subEntity']}" => array('cgtitle' => $customGroupTitle, 'gid' => $gid, 'triggerElement' => $customSet['triggerElement']));
+
+ // Go home for a sec to give time for caches to clear
+ $this->openCiviPage('');
}
return $return;
}
$this->waitForElementPresent("//*[@class='select2-result-label']");
$this->clickAt("//*[contains(@class,'select2-result-selectable')]/div[contains(@class, 'select2-result-label')]");
}
+ // Wait a sec for select2 to update the original element
+ sleep(1);
}
/**
$this->clickAt("xpath=//ul[@class='select2-results']//li/div[text()='$value']");
$this->assertElementContainsText("xpath=//*[@id='$fieldid']/preceding-sibling::div[1]/", $value);
}
+ // Wait a sec for select2 to update the original element
+ sleep(1);
}
/**
function login() {
$this->webtestLogin();
- $this->open($this->sboxPath . "civicrm");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('');
}
function testSearchMenu() {
// Contacts → Manage Groups
$this->click("//ul[@id='civicrm-menu']/li[4]");
- $this->click("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']");
$this->assertTextPresent("Find Groups");
$this->assertElementPresent("title");
}
function testContributionDashboard() {
- $this->login();
+ $this->webtestLogin();
// Enable CiviContribute module if necessary
$this->enableComponents("CiviContribute");
// Contributions → Dashboard
$this->click("css=ul#civicrm-menu li.crm-Contributions");
- $this->click("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a");
+ $this->clickLink("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a");
+
$this->waitForElementPresent("xpath=//*[@id='chart_view']/a");
$this->waitForElementPresent("xpath=//*[@id='ContributionCharts']/div[4]/div[3]");
$this->assertTextPresent("Contribution Summary");
}
function testEventDashboard() {
- $this->login();
+ $this->webtestLogin();
// Enable CiviEvent module if necessary
$this->enableComponents("CiviEvent");
// Events → Dashboard
$this->click("css=ul#civicrm-menu li.crm-Events");
- $this->click("css=ul#civicrm-menu li.crm-Events li.crm-Dashboard a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("css=ul#civicrm-menu li.crm-Events li.crm-Dashboard a");
$this->assertTextPresent("Event Summary");
$this->assertTextPresent("Counted:");
}
function testMembershipsDashboard() {
- $this->login();
+ $this->webtestLogin();
// Enable CiviMember module if necessary
$this->enableComponents("CiviMember");
}
function testFindContributions() {
- $this->login();
+ $this->webtestLogin();
// Enable CiviContribute module if necessary
$this->enableComponents("CiviContribute");
// Search → Find Contributions
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Search");
- $this->click("css=ul#civicrm-menu li.crm-Find_Contributions a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("css=ul#civicrm-menu li.crm-Find_Contributions a");
$this->assertTextPresent("Edit Search Criteria");
$this->assertElementPresent("sort_name");
}
function testNewMailing() {
- $this->login();
+ $this->webtestLogin();
// Enable CiviMail module if necessary
$this->enableComponents("CiviMail");
// New Mailing Form
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Mailings");
- $this->click("css=ul#civicrm-menu li.crm-New_Mailing a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("css=ul#civicrm-menu li.crm-New_Mailing a");
$this->assertTextPresent("New Mailing");
$this->assertElementPresent("name");
// Constituent Report Summary
$this->click("css=ul#civicrm-menu li.crm-Reports");
- $this->click("css=ul#civicrm-menu li.crm-Contact_Reports a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->click("xpath=//div[@id='Contact']/table/tbody/tr/td/a");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("css=ul#civicrm-menu li.crm-Contact_Reports a");
+
+ $this->clickLink("xpath=//div[@id='Contact']/table/tbody/tr/td/a");
$this->assertTextPresent("Constituent Summary");
- $this->click("//form[@id='Summary']/div[2]/div/div/div/div");
- $this->assertTextPresent("Display Columns");
+ $this->click("//div[contains(text(), 'Report Criteria')]");
+ $this->waitForVisible("//h3[contains(text(), 'Display Columns')]");
$this->click("//form[@id='Summary']/div[2]//div[@id='id_default']/div/div/div");
- $this->assertTextPresent("Most Important Issue");
+ $this->waitForVisible("//label[contains(text(), 'Most Important Issue')]");
$this->assertTextPresent("Set Filters");
$this->assertTextPresent("Contact Name");
$this->assertTextPresent("Contact Source");
$this->assertTextPresent("State/Province");
$this->assertTextPresent("Group");
$this->assertTextPresent("Tag");
- $this->click("_qf_Summary_submit");
- $this->waitForElementPresent("_qf_Summary_submit_print");
+ $this->clickLink("_qf_Summary_submit");
+
$this->assertTextPresent("Row(s) Listed");
$this->assertTextPresent("Total Row(s)");
}
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
$this->assertTextPresent("Custom Data");
$this->assertTextPresent("Constituent Information");
$this->assertTextPresent("Food Preference");
// Verify create form
- $this->click("//span[contains(text(), 'Add Set of Custom Fields')]");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("//span[contains(text(), 'Add Set of Custom Fields')]");
+
$this->assertElementPresent("title");
$this->assertElementPresent("extends[0]");
$this->assertElementPresent("weight");
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertTextPresent("CiviCRM Profile");
// Verify Reserved Profiles
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
// Verify tags
$this->assertTextPresent("Non-profit");
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
// Verify activity types
$this->assertTextPresent("Meeting");
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
// Verify relationship types
$this->assertTextPresent("Child of");
// Use class names for menu items since li array can change based on which components are enabled
$this->click("css=ul#civicrm-menu li.crm-Administer");
$this->click("css=ul#civicrm-menu li.crm-Communications");
- $this->click("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
// Verify message templates
$this->click("//a[contains(text(),'System Workflow Messages')]");