diff --git modules/simpletest/drupal_web_test_case.php modules/simpletest/drupal_web_test_case.php
index c2571e9..8d6d04c 100644
--- modules/simpletest/drupal_web_test_case.php
+++ modules/simpletest/drupal_web_test_case.php
@@ -1533,8 +1533,12 @@ class DrupalWebTestCase extends DrupalTestCase {
    * @param $headers
    *   An array containing additional HTTP request headers, each formatted as
    *   "name: value".
+   * @param $form_css_id
+   *   The optional CSS id of the form to be submitted. On some pages there
+   *   are many identical forms, so just using the value of the submit button
+   *   is not enough.
    */
-  protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array()) {
+  protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array(), $form_css_id = NULL) {
     $submit_matches = FALSE;
     $ajax = is_array($submit);
     if (isset($path)) {
@@ -1543,7 +1547,11 @@ class DrupalWebTestCase extends DrupalTestCase {
     if ($this->parse()) {
       $edit_save = $edit;
       // Let's iterate over all the forms.
-      $forms = $this->xpath('//form');
+      $xpath = "//form";
+      if (!empty($form_css_id)) {
+        $xpath .= "[@id='$form_css_id']";
+      }
+      $forms = $this->xpath($xpath);
       foreach ($forms as $form) {
         // We try to set the fields of this form as specified in $edit.
         $edit = $edit_save;
@@ -2711,6 +2719,31 @@ class DrupalWebTestCase extends DrupalTestCase {
   }
 
   /**
+   * Look for a regex in the body of the email.
+   * @param string $name
+   *   Name of the portion of the body to search. Most common: 'body'
+   * @param string $regex
+   *   Text to search for.
+   * @param string $message
+   *   Message for simpletest.
+   */
+  protected function assertMailPattern($name, $regex, $message) {
+    $mails = $this->drupalGetMails();
+    $mail = end($mails);
+    $regex_found = preg_match("/$regex/", $mail[$name]);
+    $this->assertTrue($regex_found, $message);
+  }
+
+  /**
+   * Output to verbose the most recent email sent.
+   */
+  protected function verboseEmail() {
+    $mails = $this->drupalGetMails();
+    $mail = end($mails);
+    $this->verbose(t("Email  was:") . "<pre>" . print_r($mail, TRUE) . "</pre>");
+  }
+
+  /**
    * Log verbose message in a text file.
    *
    * The a link to the vebose message will be placed in the test results via
diff --git modules/trigger/tests/trigger_test.module modules/trigger/tests/trigger_test.module
index 16bd703..ce67049 100644
--- modules/trigger/tests/trigger_test.module
+++ modules/trigger/tests/trigger_test.module
@@ -63,12 +63,12 @@ function trigger_test_trigger_info() {
   return array(
     'node' => array(
       'node_triggertest' => array(
-        'runs when' => t('A test trigger is fired'),
+        'label' => t('When a test trigger is fired'),
       ),
     ),
     'trigger_test' => array(
       'trigger_test_triggertest' => array(
-        'runs when' => t('Another test trigger is fired'),
+        'label' => t('When another test trigger is fired'),
       ),
     ),
   );
diff --git modules/trigger/trigger.test modules/trigger/trigger.test
index 0aa219f..9b63651 100644
--- modules/trigger/trigger.test
+++ modules/trigger/trigger.test
@@ -196,11 +196,11 @@ class TriggerOtherTestCase extends DrupalWebTestCase {
   }
 
   function setUp() {
-    parent::setUp('trigger', 'trigger_test');
+    parent::setUp('trigger', 'trigger_test', 'contact');
   }
 
   /**
-   * Test triggering on user create.
+   * Test triggering on user create and user login.
    */
   function testActionsUser() {
     // Assign an action to the create user trigger.
@@ -231,9 +231,73 @@ class TriggerOtherTestCase extends DrupalWebTestCase {
     $this->assertTrue(variable_get($action_id, FALSE), t('Check that creating a user triggered the test action.'));
 
     // Reset the action variable.
-    variable_set( $action_id, FALSE );
+    variable_set($action_id, FALSE);
+
+    $this->drupalLogin($test_user);
+    // Assign a configurable action 'System message' to the user_login trigger.
+    $action_edit = array(
+      'actions_label' => $this->randomName(16),
+      'message' => t("You have logged in:") . $this->randomName(16),
+    );
+
+    // Configure an advanced action that we can assign.
+    $aid = $this->configureAdvancedAction('system_message_action', $action_edit);
+    $edit = array(
+      'aid' => md5($aid),
+    );
+    $this->drupalPost('admin/structure/trigger/user', $edit, t('Assign'), array(), array(), 'trigger-user-login-assign-form');
+
+    // Verify that the action has been assigned to the correct hook.
+    $actions = trigger_get_assigned_actions('user_login');
+    $this->assertEqual(1, count($actions), t('One Action assigned to the hook'));
+    $this->assertEqual($actions[$aid]['label'], $action_edit['actions_label'], t('Correct action label found.'));
+
+    // User should get the configured message at login.
+    $contact_user = $this->drupalCreateUser(array('access site-wide contact form'));;
+    $this->drupalLogin($contact_user);
+    $this->assertText($action_edit['message']);
+  }
+
+  /**
+   * Test triggering an email with a node creation.
+   */
+  function testTriggeringAdvancedActions() {
+    $test_user = $this->drupalCreateUser(array('administer actions', 'access content', 'create article content'));
+    $this->drupalLogin($test_user);
+    // Create an article that we will view later;
+    $this->drupalPost('node/add/article', array('title' => t("some title"), 'body[und][0][value]' => t('some body')), t('Save'));
+    $this->assertText(t("Article some title has been created"));
+    $saved_node = $this->getUrl();
+
+    // Configure an email action that we will trigger.
+    $action_label = $this->randomName(16);
+    $send_mail_action_edit = array(
+      'actions_label' => $action_label,
+      'recipient' => $this->randomName(8) . "@example.com",
+      'subject' => $this->randomName(8),
+      'message' => t('Node viewed:[node:title]'),
+    );
+    $aid = $this->configureAdvancedAction('system_send_email_action', $send_mail_action_edit);
+    $hook = 'node_view';
+    $edit = array(
+      'aid' => md5($aid),
+    );
+    $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'), array(), array(), 'trigger-node-view-assign-form');
+
+    // Verify that the action has been assigned to the correct hook.
+    $actions = trigger_get_assigned_actions($hook);
+    $this->assertEqual(1, count($actions), t('One Action assigned to the hook'));
+    $this->assertEqual($actions[$aid]['label'], $action_label, t('Correct action label found.'));
+
+    // Visit the page we created earlier and trigger sending an email.
+    $this->drupalGet($saved_node);
+    $this->verboseEmail();
+    $this->assertMail('to', $send_mail_action_edit['recipient'], t("Correct recipient for email"));
+    $this->assertMailPattern('body', t('Node viewed:some title'), t("Email body is correct and has expanded token"));
   }
 
+
+
   /**
    * Test triggering on comment save.
    */
@@ -247,7 +311,7 @@ class TriggerOtherTestCase extends DrupalWebTestCase {
     $this->drupalPost('admin/structure/trigger/comment', $edit, t('Assign'));
 
     // Set action variable to FALSE.
-    variable_set( $action_id, FALSE );
+    variable_set($action_id, FALSE);
 
     // Create a node and add a comment to it.
     $web_user = $this->drupalCreateUser(array('create article content', 'access content', 'post comments without approval', 'post comments'));
@@ -276,7 +340,7 @@ class TriggerOtherTestCase extends DrupalWebTestCase {
     $this->drupalPost('admin/structure/trigger/taxonomy', $edit, t('Assign'));
 
     // Set action variable to FALSE.
-    variable_set( $action_id, FALSE );
+    variable_set($action_id, FALSE);
 
     // Create a taxonomy vocabulary and add a term to it.
 
@@ -298,4 +362,36 @@ class TriggerOtherTestCase extends DrupalWebTestCase {
     // Verify that the action variable has been set.
     $this->assertTrue(variable_get($action_id, FALSE), t('Check that creating a taxonomy term triggered the action.'));
   }
+
+  /**
+   * Configure an advanced action.
+   * @param string $hook
+   *   The name of the hook. For example: 'user_presave', 'user_login'
+   * @param array $action_configure_edit
+   *   The $edit array for the form to be used to configure.
+   *   Example members would be 'actions_label' (always), 'message', etc.
+   * @return integer
+   *   the aid (action id) of the configured action, or -1 if none.
+   */
+  protected function configureAdvancedAction($hook, $action_configure_edit) {
+    // Create an advanced action.
+    $hash = md5($hook);
+    $this->drupalPost("admin/config/system/actions/configure/$hash", $action_configure_edit, t('Save'));
+    $this->assertText(t('The action has been successfully saved.'));
+
+    // Now we have to find out the action ID of what we created.
+    $cell_to_find = "//div/table/tbody/tr/td[2][. = '{$action_configure_edit['actions_label']}']/../td[3]/a[@href]";
+    $this->assertFieldByXPath($cell_to_find, t('configure'), t('Found the configure link'));
+    $atag = $this->xpath($cell_to_find);
+    $this->assertTrue(is_object($atag[0]), t("Found the cell with 'configure' in it"));
+    if (is_object($atag[0])) {
+      $href = (string)$atag[0]->attributes()->href;
+      $aid = preg_replace('/^.*\//', '', (string)$href);
+      $this->verbose(t('The action ID for configured action hook=@hook is aid=@aid.', array('@hook' => $hook, '@aid' => $aid)));
+      return $aid;
+    }
+    return -1;
+  }
+
+
 }
