[Pkg-mozext-commits] [compactheader] 261/441: Created new helper module for compactheader mozmill test

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 12:29:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository compactheader.

commit 3bf8461126622ad05f4c4f60c6b3307925115c7f
Author: Joachim.Herb at gmx.de <Joachim.Herb at gmx.de>
Date:   Wed Aug 10 00:14:38 2011 +0200

    Created new helper module for compactheader mozmill test
    
    --HG--
    branch : markAddressType
---
 .../test-compactheader-preferences.js              | 90 ++--------------------
 test/compactheader/test-compactheader-toolbar.js   | 81 ++++---------------
 test/download.sh                                   |  2 +-
 test/executeTests.pl                               |  2 +-
 4 files changed, 26 insertions(+), 149 deletions(-)

diff --git a/test/compactheader/test-compactheader-preferences.js b/test/compactheader/test-compactheader-preferences.js
index 12c6f8b..dc0b313 100644
--- a/test/compactheader/test-compactheader-preferences.js
+++ b/test/compactheader/test-compactheader-preferences.js
@@ -41,7 +41,8 @@ var MODULE_NAME = 'test-compactheader-preferences';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers',
-                       'address-book-helpers', 'mouse-event-helpers'];
+                       'address-book-helpers', 'mouse-event-helpers',
+                       'compactheader-helpers'];
 
 var elib = {};
 Cu.import('resource://mozmill/modules/elementslib.js', elib);
@@ -58,10 +59,6 @@ const PREF = "browser.preferences.instantApply";
 var prefBranch = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService).getBranch(null);
 
-var browserPreferences = Components.classes["@mozilla.org/preferences-service;1"]
-    .getService(Components.interfaces.nsIPrefService)
-    .getBranch("browser.preferences.");
-
 var messageBodyISO8859_1 = "ae: " + String.fromCharCode(228) +
   ", oe: " + String.fromCharCode(246) +
   ", ue: " + String.fromCharCode(252) +
@@ -83,6 +80,8 @@ function setupModule(module) {
   meh.installInto(module);
   let meh = collector.getModule('mouse-event-helpers');
   meh.installInto(module);
+  let chh = collector.getModule('compactheader-helpers');
+  chh.installInto(module);
 
   folder1 = create_folder("MessageWindowC");
   folder2 = create_folder("MessageWindowD");
@@ -117,7 +116,7 @@ function setupModule(module) {
  *  does not break the get messages button in main toolbar
  */
 function test_double_preference_change_ISO(){
-  select_message_in_folder(folder1, 2);
+  select_message_in_folder(folder1, 2, mc);
   assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
   open_preferences_dialog(mc, subtest_change_twoline_linkify);
   mc.sleep(10);
@@ -125,7 +124,7 @@ function test_double_preference_change_ISO(){
 }
 
 function test_double_preference_change_UTF(){
-  select_message_in_folder(folder1, 3);
+  select_message_in_folder(folder1, 3, mc);
   assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
   open_preferences_dialog(mc, subtest_change_twoline_linkify);
   mc.sleep(10);
@@ -139,9 +138,9 @@ function subtest_change_twoline_linkify(aController) {
 }
 
 function test_single_preference_change_folder(){
-  select_message_in_folder(folder1, 3);
+  select_message_in_folder(folder1, 3, mc);
   open_preferences_dialog(mc, subtest_change_twoline);
-  select_message_in_folder(folder2, 0);
+  select_message_in_folder(folder2, 0, mc);
 }
 
 function subtest_change_twoline(aController) {
@@ -149,79 +148,6 @@ function subtest_change_twoline(aController) {
   close_preferences_dialog(aController);
 }
 
-/**
- *  Helper function to open an extra window, so that the 3pane
- *  window can be closed and opend again for persistancy checks.
- *  They are copied from the test-session-store.js.
- */
-function close3PaneWindow() {
-  let windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].
-    getService(Ci.nsIWindowMediator);
-  let mail3PaneWindow = windowMediator.getMostRecentWindow("mail:3pane");
-  // close the 3pane window
-  mail3PaneWindow.close();
-}
-
-function open3PaneWindow() {
-  let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
-    getService(Ci.nsIWindowWatcher);
-  WindowHelper.plan_for_new_window("mail:3pane");
-  windowWatcher.openWindow(null,
-                           "chrome://messenger/content/messenger.xul", "",
-                           "all,chrome,dialog=no,status,toolbar",
-                           null);
-  return WindowHelper.wait_for_new_window("mail:3pane");
-}
-
-function openAddressBook() {
-  let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
-    getService(Ci.nsIWindowWatcher);
-  WindowHelper.plan_for_new_window("mail:addressbook");
-  windowWatcher.openWindow(
-                      null,
-                      "chrome://messenger/content/addressbook/addressbook.xul", "",
-                      "all,chrome,dialog=no,status,toolbar",
-                      null);
-  return WindowHelper.wait_for_new_window("mail:addressbook");
-}
-
-function open_preferences_dialog(aController, aSubtest) {
-  plan_for_modal_dialog("ext:options", aSubtest);
-  aController.click(aController.eid("hidecohePreferencesButton"));
-  wait_for_modal_dialog("ext:options", 1);
-}
-
-function close_preferences_dialog(aController) {
-  plan_for_window_close(aController);
-  if (browserPreferences.getBoolPref("instantApply")) {
-    let cancelButton = aController.window.document.documentElement.getButton('cancel');
-    aController.click(new elib.Elem(cancelButton));
-  }
-  else {
-    let okButton = aController.window.document.documentElement.getButton('accept');
-    aController.click(new elib.Elem(okButton));
-  }
-  wait_for_window_close();
-  //assert_true(aController.window.closed, "The preferences dialog is not closed.");
-}
-
-/**
- * Select message in current (global) folder1.
- */
-function select_message_in_folder(aFolder, aMessageNum)
-{
-  be_in_folder(aFolder);
-
-  // select and open the first message
-  let curMessage = select_click_row(aMessageNum);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  return curMessage;
-}
-
 function addToFolder(aSubject, aBody, aFolder, aCharset) {
 
   let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
diff --git a/test/compactheader/test-compactheader-toolbar.js b/test/compactheader/test-compactheader-toolbar.js
index dcd237d..4d63181 100644
--- a/test/compactheader/test-compactheader-toolbar.js
+++ b/test/compactheader/test-compactheader-toolbar.js
@@ -41,7 +41,8 @@ var MODULE_NAME = 'test-compactheader-toolbar';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers',
-                       'address-book-helpers', 'mouse-event-helpers'];
+                       'address-book-helpers', 'mouse-event-helpers',
+                       'compactheader-helpers'];
 
 var elib = {};
 Cu.import('resource://mozmill/modules/elementslib.js', elib);
@@ -66,6 +67,8 @@ function setupModule(module) {
   abh.installInto(module);
   let meh = collector.getModule('mouse-event-helpers');
   meh.installInto(module);
+  let chh = collector.getModule('compactheader-helpers');
+  chh.installInto(module);
 
   folder = create_folder("MessageWindowB");
 
@@ -94,7 +97,7 @@ function setupModule(module) {
  *  does not break the get messages button in main toolbar
  */
 function test_get_msg_button_customize_header_toolbar(){
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // It is necessary to press the Get Message Button to get the popup menu populated
   mc.click(mc.aid("button-getmsg", {class: "toolbarbutton-menubutton-dropmarker"}));
@@ -128,7 +131,7 @@ function test_get_msg_button_customize_header_toolbar(){
  */
 function test_customize_header_toolbar_check_default()
 {
-  let curMessage = select_message_in_folder(0);
+  let curMessage = select_message_in_folder(folder, 0, mc);
   let hdrToolbar = mc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
@@ -167,7 +170,7 @@ function test_customize_header_toolbar_check_default()
 // */
 function test_customize_header_toolbar_reorder_buttons()
 {
-  let curMessage = select_message_in_folder(0);
+  let curMessage = select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -216,7 +219,7 @@ function test_customize_header_toolbar_reorder_buttons()
 // */
 function test_customize_header_toolbar_separate_window()
 {
-  let curMessage = select_message_in_folder(0);
+  let curMessage = select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -262,7 +265,7 @@ function test_customize_header_toolbar_separate_window()
 
   mc = open3PaneWindow();
   abwc.window.close();
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // Check, if the buttons in the mail3pane window are the correct ones.
   let hdrToolbar = mc.eid("header-view-toolbar").node;
@@ -291,7 +294,7 @@ function test_customize_header_toolbar_remove_buttons(){
   // at the end.
   var lCurrentset;
 
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -313,7 +316,7 @@ function test_customize_header_toolbar_remove_buttons(){
       "__empty");
 
   // Move to the next message and check again.
-  let curMessage = select_message_in_folder(1);
+  let curMessage = select_message_in_folder(folder, 1, mc);
   assert_equals(filterInvisibleButtons(mc, toolbar.currentSet), "__empty");
   assert_equals(filterInvisibleButtons(mc, toolbar.getAttribute("currentset")),
       "__empty");
@@ -337,7 +340,7 @@ function test_customize_header_toolbar_remove_buttons(){
   close3PaneWindow();
   mc = open3PaneWindow();
   abwc.window.close();
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   let toolbar = mc.eid("header-view-toolbar").node;
   assert_equals(filterInvisibleButtons(mc, toolbar.currentSet), "__empty");
@@ -370,7 +373,7 @@ function test_customize_header_toolbar_remove_buttons(){
  */
 function test_customize_header_toolbar_add_all_buttons(){
 
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -490,7 +493,7 @@ function test_customize_header_toolbar_add_all_buttons(){
  *  Test header pane toolbar customization dialog layout
  */
 function test_customize_header_toolbar_dialog_style(){
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -527,7 +530,7 @@ function test_customize_header_toolbar_dialog_style(){
  *  Test header pane toolbar customization dialog for button style changes
  */
 function test_customize_header_toolbar_change_button_style(){
-  select_message_in_folder(0);
+  select_message_in_folder(folder, 0, mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -567,23 +570,6 @@ function test_customize_header_toolbar_change_button_style(){
 }
 
 /**
- * Select message in current (global) folder.
- */
-function select_message_in_folder(aMessageNum)
-{
-  be_in_folder(folder);
-
-  // select and open the first message
-  let curMessage = select_click_row(aMessageNum);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  return curMessage;
-}
-
-/**
  *  Check all buttons in the toolbar for the correct style
  *  of text and icon.
  */
@@ -658,42 +644,6 @@ function close_header_pane_toolbar_customization(aCtc)
   }
 }
 
-/**
- *  Helper function to open an extra window, so that the 3pane
- *  window can be closed and opend again for persistancy checks.
- *  They are copied from the test-session-store.js.
- */
-function close3PaneWindow() {
-  let windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].
-    getService(Ci.nsIWindowMediator);
-  let mail3PaneWindow = windowMediator.getMostRecentWindow("mail:3pane");
-  // close the 3pane window
-  mail3PaneWindow.close();
-}
-
-function open3PaneWindow() {
-  let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
-    getService(Ci.nsIWindowWatcher);
-  WindowHelper.plan_for_new_window("mail:3pane");
-  windowWatcher.openWindow(null,
-                           "chrome://messenger/content/messenger.xul", "",
-                           "all,chrome,dialog=no,status,toolbar",
-                           null);
-  return WindowHelper.wait_for_new_window("mail:3pane");
-}
-
-function openAddressBook() {
-  let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
-    getService(Ci.nsIWindowWatcher);
-  WindowHelper.plan_for_new_window("mail:addressbook");
-  windowWatcher.openWindow(
-                      null,
-                      "chrome://messenger/content/addressbook/addressbook.xul", "",
-                      "all,chrome,dialog=no,status,toolbar",
-                      null);
-  return WindowHelper.wait_for_new_window("mail:addressbook");
-}
-
 /*
  * Remove invsible buttons from (comma separated) buttons list
  */
@@ -720,3 +670,4 @@ function filterInvisibleButtons(aController, aButtons) {
 
   return strResult;
 }
+
diff --git a/test/download.sh b/test/download.sh
index b6269da..48f861b 100644
--- a/test/download.sh
+++ b/test/download.sh
@@ -20,7 +20,7 @@ else
   return 1;
 fi
 export TESTS=thunderbird-5.0.tests.zip
-export XPI=../../../AMO/CompactHeader-1.4.2beta4.xpi
+export XPI=../../../AMO/CompactHeader-1.4.2beta5.xpi
 export TESTDIR=test-5.0
 
 wget -P ftp -N $FTP_DIR/$APP
diff --git a/test/executeTests.pl b/test/executeTests.pl
index 51dc987..1056c50 100644
--- a/test/executeTests.pl
+++ b/test/executeTests.pl
@@ -7,7 +7,7 @@ use POSIX;
 use Cwd;
 
 my $file = 'testapps.csv';
-my $xpi = "../../../AMO/CompactHeader-1.4.2beta4.xpi";
+my $xpi = "../../../AMO/CompactHeader-1.4.2beta5.xpi";
 my $ftpdir = "ftp";
 
 my ($ostype,$hosttype,$version,$ftppath,$app,$tests,$lightning);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/compactheader.git



More information about the Pkg-mozext-commits mailing list