[Pkg-mozext-commits] [compactheader] 263/441: New mozmill test to check toggling of message header and font style of email addresses in two line compact mode.

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 4b5cdd2f11f7536c348b0c772e6c0d0c41ec9aa4
Author: Joachim.Herb at gmx.de <Joachim.Herb at gmx.de>
Date:   Wed Aug 10 22:05:12 2011 +0200

    New mozmill test to check toggling of message header and font style of
    email addresses in two line compact mode.
    
    --HG--
    branch : markAddressType
---
 ...eferences.js => test-compactheader-collapse.js} | 147 +++++++++++----------
 .../test-compactheader-preferences.js              |   2 -
 test/compactheader/test-compactheader-toolbar.js   |  15 ++-
 test/download.sh                                   |  42 +++++-
 test/executeTests.pl                               |  47 ++++++-
 test/shared-modules/test-compactheader-helpers.js  |  23 ++++
 6 files changed, 195 insertions(+), 81 deletions(-)

diff --git a/test/compactheader/test-compactheader-preferences.js b/test/compactheader/test-compactheader-collapse.js
similarity index 57%
copy from test/compactheader/test-compactheader-preferences.js
copy to test/compactheader/test-compactheader-collapse.js
index dc0b313..5b77d6a 100644
--- a/test/compactheader/test-compactheader-preferences.js
+++ b/test/compactheader/test-compactheader-collapse.js
@@ -19,8 +19,6 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Blake Winton <bwinton at latte.ca>
- *   Dan Mosedale <dmose at mozillamessaging.com>
  *   Joachim Herb <Joachim.Herb at gmx.de>
  *
  * Alternatively, the contents of this file may be used under the terms of
@@ -83,8 +81,7 @@ function setupModule(module) {
   let chh = collector.getModule('compactheader-helpers');
   chh.installInto(module);
 
-  folder1 = create_folder("MessageWindowC");
-  folder2 = create_folder("MessageWindowD");
+  folder1 = create_folder("MessageWindowE");
 
   // create a message that has the interesting headers that commonly
   // show up in the message header pane for testing
@@ -99,90 +96,94 @@ function setupModule(module) {
 
   add_message_to_folder(folder1, msg);
 
-  // create a message that has umlauts
-  addToFolder("test encoded ISO-8859-1", messageBodyISO8859_1, folder1, "iso-8859-1");
-  addToFolder("test encoded UTF-8", messageBodyUTF8, folder1, "utf-8");
+  let msg = create_message({cc: msgGen.makeNamesAndAddresses(2), // YYY
+    subject: "This is a really, really, really, really, really, really, really, really, long subject.",
+    clobberHeaders: {
+      "Newsgroups": "alt.test",
+      "Reply-To": "J. Doe <j.doe at momo.invalid>",
+      "Content-Base": "http://example.com/",
+      "Bcc": "Richard Roe <richard.roe at momo.invalid>"
+    }});
 
-  let msg = create_message();
   add_message_to_folder(folder1, msg);
-
-  let msg = create_message();
-  add_message_to_folder(folder2, msg);
 }
 
-
-/**
- *  Make sure that opening the header toolbar customization dialog
- *  does not break the get messages button in main toolbar
- */
-function test_double_preference_change_ISO(){
-  select_message_in_folder(folder1, 2, mc);
-  assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
-  open_preferences_dialog(mc, subtest_change_twoline_linkify);
+function test_toggle_header_view_twoline(){
+  select_message_in_folder(folder1, 0, mc);
+  open_preferences_dialog(mc, set_preferences_twoline);
   mc.sleep(10);
-  assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
+  open_preferences_dialog(mc, set_preferences_twoline);
+  mc.sleep(10);
+  collapse_and_assert_header(mc);
+  collapse_and_assert_header(mc);
+  expand_and_assert_header(mc);
+  expand_and_assert_header(mc);
+  collapse_and_assert_header(mc);
 }
 
-function test_double_preference_change_UTF(){
-  select_message_in_folder(folder1, 3, mc);
-  assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
-  open_preferences_dialog(mc, subtest_change_twoline_linkify);
+function test_toggle_header_view_oneline(){
+  select_message_in_folder(folder1, 0, mc);
+  open_preferences_dialog(mc, set_preferences_oneline);
+  mc.sleep(10);
+  open_preferences_dialog(mc, set_preferences_oneline);
   mc.sleep(10);
-  assert_browser_text_present(mc.e("messagepane"), messageBodyISO8859_1);
+  collapse_and_assert_header(mc);
+  collapse_and_assert_header(mc);
+  expand_and_assert_header(mc);
+  expand_and_assert_header(mc);
+  collapse_and_assert_header(mc);
 }
 
-function subtest_change_twoline_linkify(aController) {
-  aController.click(aController.eid("checkboxCompactTwolineView"));
-  aController.click(aController.eid("checkboxLinkify"));
-  close_preferences_dialog(aController);
-}
 
-function test_single_preference_change_folder(){
-  select_message_in_folder(folder1, 3, mc);
-  open_preferences_dialog(mc, subtest_change_twoline);
-  select_message_in_folder(folder2, 0, mc);
+function test_address_type_format(){
+  select_message_in_folder(folder1, 1, mc);
+  open_preferences_dialog(mc, set_preferences_twoline);
+  mc.sleep(10);
+  collapse_and_assert_header(mc);
+  collapse_and_assert_header(mc);
+
+  // Check the mode of the header.
+  let headerBox = mc.eid("collapsedHeaderView");
+  let previousHeaderMode = headerBox.node.getAttribute("show_header_mode");
+
+  // Click the "more" button.
+  let moreIndicator = mc.eid("collapsed2LtoCcBccBox");
+  moreIndicator = mc.window.document.getAnonymousElementByAttribute(
+                    moreIndicator.node, "anonid", "more");
+  moreIndicator = new elementslib.Elem(moreIndicator);
+  if (moreIndicator) {
+    mc.click(moreIndicator);
+  }
+
+  // Check the new mode of the header.
+  // FIXME: In the expanded header mode pressing the more button
+  // makes the header scrollable.
+//  if (headerBox.node.getAttribute("show_header_mode") != "all")
+//    throw new Error("Header Mode didn't change to 'all'!  " + "old=" +
+//                    previousHeaderMode + ", new=" +
+//                    headerBox.node.getAttribute("show_header_mode"));
+
+
+  let toDescription = mc.a('collapsed2LtoCcBccBox', {class: "headerValue"});
+  let addrs = toDescription.getElementsByTagName('mail-emailaddress');
+  for (let i=0; i<addrs.length; i++) {
+    assert_true(addrs[i].hasAttribute("addressType"));
+  }
 }
 
-function subtest_change_twoline(aController) {
-  aController.click(aController.eid("checkboxCompactTwolineView"));
+function set_preferences_twoline(aController) {
+  let checkboxCompactTwolineView = aController.eid("checkboxCompactTwolineView");
+  if (!checkboxCompactTwolineView.node.getAttribute("checked")) {
+    aController.click(checkboxCompactTwolineView);
+  }
   close_preferences_dialog(aController);
 }
 
-function addToFolder(aSubject, aBody, aFolder, aCharset) {
-
-  let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
-                          .getService(Components.interfaces.nsIUUIDGenerator)
-                          .generateUUID() +"@mozillamessaging.invalid";
-
-  let source = "From - Sat Nov  1 12:39:54 2008\n" +
-               "X-Mozilla-Status: 0001\n" +
-               "X-Mozilla-Status2: 00000000\n" +
-               "Message-ID: <" + msgId + ">\n" +
-               "Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
-               "From: Tester <tests at mozillamessaging.invalid>\n" +
-               "User-Agent: Thunderbird 3.0a2pre (Macintosh/2008052122)\n" +
-               "MIME-Version: 1.0\n" +
-               "To: recipient at mozillamessaging.invalid\n" +
-               "Subject: " + aSubject + "\n" +
-               "Content-Type: text/html; charset=" + aCharset + "\n" +
-               "Content-Transfer-Encoding: 8bit\n" +
-               "\n" + aBody + "\n";
-
-  aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
-  aFolder.gettingNewMessages = true;
-
-  aFolder.addMessage(source);
-  aFolder.gettingNewMessages = false;
-
-  return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
+function set_preferences_oneline(aController) {
+  let checkboxCompactTwolineView = aController.eid("checkboxCompactTwolineView");
+  if (checkboxCompactTwolineView.node.getAttribute("checked")) {
+    aController.click(checkboxCompactTwolineView);
+  }
+  close_preferences_dialog(aController);
 }
 
-/**
- * Asserts that the given text is present on the message pane.
- */
-function assert_browser_text_present(aBrowser, aText) {
-  let html = aBrowser.contentDocument.documentElement.innerHTML;
-  if (html.indexOf(aText) == -1) {
-    throw new Error("Unable to find string \"" + escape(aText) + "\" on the message pane");
-  }
-}
\ No newline at end of file
diff --git a/test/compactheader/test-compactheader-preferences.js b/test/compactheader/test-compactheader-preferences.js
index dc0b313..da49b8f 100644
--- a/test/compactheader/test-compactheader-preferences.js
+++ b/test/compactheader/test-compactheader-preferences.js
@@ -19,8 +19,6 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Blake Winton <bwinton at latte.ca>
- *   Dan Mosedale <dmose at mozillamessaging.com>
  *   Joachim Herb <Joachim.Herb at gmx.de>
  *
  * Alternatively, the contents of this file may be used under the terms of
diff --git a/test/compactheader/test-compactheader-toolbar.js b/test/compactheader/test-compactheader-toolbar.js
index 4d63181..0426c32 100644
--- a/test/compactheader/test-compactheader-toolbar.js
+++ b/test/compactheader/test-compactheader-toolbar.js
@@ -19,8 +19,6 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Blake Winton <bwinton at latte.ca>
- *   Dan Mosedale <dmose at mozillamessaging.com>
  *   Joachim Herb <Joachim.Herb at gmx.de>
  *
  * Alternatively, the contents of this file may be used under the terms of
@@ -98,6 +96,7 @@ function setupModule(module) {
  */
 function test_get_msg_button_customize_header_toolbar(){
   select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(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"}));
@@ -134,6 +133,7 @@ function test_customize_header_toolbar_check_default()
   let curMessage = select_message_in_folder(folder, 0, mc);
   let hdrToolbar = mc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
+  expand_and_assert_header(mc);
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
   // In a fresh profile the currentset attribute does not
   // exist, i.e. it returns empty. So check for both valid
@@ -149,6 +149,7 @@ function test_customize_header_toolbar_check_default()
   // buttons are shown there.
   let msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
+  expand_and_assert_header(msgc);
   let hdrToolbar = msgc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
@@ -174,6 +175,7 @@ function test_customize_header_toolbar_reorder_buttons()
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
+  expand_and_assert_header(mc);
 
   // Save the currentSet of the toolbar before opening the
   // customization dialog, to get out of the way of the
@@ -203,6 +205,7 @@ function test_customize_header_toolbar_reorder_buttons()
   // buttons are shown there.
   let msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
+  expand_and_assert_header(msgc);
   let hdrToolbar = msgc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
@@ -220,6 +223,7 @@ function test_customize_header_toolbar_reorder_buttons()
 function test_customize_header_toolbar_separate_window()
 {
   let curMessage = select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -228,6 +232,7 @@ function test_customize_header_toolbar_separate_window()
   // buttons are shown there.
   let msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
+  expand_and_assert_header(msgc);
   let hdrToolbar = msgc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
@@ -295,6 +300,7 @@ function test_customize_header_toolbar_remove_buttons(){
   var lCurrentset;
 
   select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -325,6 +331,8 @@ function test_customize_header_toolbar_remove_buttons(){
   // buttons are shown there.
   let msgc = open_selected_message_in_new_window();
   assert_selected_and_displayed(msgc, curMessage);
+  expand_and_assert_header(msgc);
+
   let hdrToolbar = msgc.eid("header-view-toolbar").node;
   let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset");
   assert_equals(hdrToolbar.currentSet, hdrBarDefaultSet);
@@ -374,6 +382,7 @@ function test_customize_header_toolbar_remove_buttons(){
 function test_customize_header_toolbar_add_all_buttons(){
 
   select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -494,6 +503,7 @@ function test_customize_header_toolbar_add_all_buttons(){
  */
 function test_customize_header_toolbar_dialog_style(){
   select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
@@ -531,6 +541,7 @@ function test_customize_header_toolbar_dialog_style(){
  */
 function test_customize_header_toolbar_change_button_style(){
   select_message_in_folder(folder, 0, mc);
+  expand_and_assert_header(mc);
 
   // Restore the default buttons to get defined starting conditions.
   restore_and_check_default_buttons(mc);
diff --git a/test/download.sh b/test/download.sh
index 48f861b..eb94b7d 100644
--- a/test/download.sh
+++ b/test/download.sh
@@ -1,5 +1,42 @@
 #! /bin/bash
 
+# ***** BEGIN LICENSE BLOCK *****
+#   Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Thunderbird Mail Client.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2009
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Joachim Herb <Joachim.Herb at gmx.de>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK ***** */
+
 if [ $OSTYPE == msys ] ; then
   export FTP_DIR=https://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/5.0-candidates/build1/unsigned/win32/en-US/
   export APP=thunderbird-5.0.zip
@@ -19,8 +56,11 @@ else
   echo "OS not supported"
   return 1;
 fi
+
+VERSION=`grep 'version>' ../install.rdf | sed -e 's/.*version>\(.*\)<\/em.*/\1/'`
+
 export TESTS=thunderbird-5.0.tests.zip
-export XPI=../../../AMO/CompactHeader-1.4.2beta5.xpi
+export XPI=../../../AMO/CompactHeader-$VERSION.xpi
 export TESTDIR=test-5.0
 
 wget -P ftp -N $FTP_DIR/$APP
diff --git a/test/executeTests.pl b/test/executeTests.pl
index 1056c50..5122fcc 100644
--- a/test/executeTests.pl
+++ b/test/executeTests.pl
@@ -1,5 +1,42 @@
 #! /usr/bin/env perl
 
+# ***** BEGIN LICENSE BLOCK *****
+#   Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Thunderbird Mail Client.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2009
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Joachim Herb <Joachim.Herb at gmx.de>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK ***** */
+
 use strict;
 use warnings;
 use File::Copy;
@@ -7,7 +44,11 @@ use POSIX;
 use Cwd;
 
 my $file = 'testapps.csv';
-my $xpi = "../../../AMO/CompactHeader-1.4.2beta5.xpi";
+my $xpiversion = `grep 'version>' ../install.rdf | sed -e 's/.*version>\\(.*\\)<\\/em.*/\\1/'`;
+chomp($xpiversion);
+my $xpi = "../../../AMO/CompactHeader-${xpiversion}.xpi";
+print "xpi: $xpi\n";
+
 my $ftpdir = "ftp";
 
 my ($ostype,$hosttype,$version,$ftppath,$app,$tests,$lightning);
@@ -76,8 +117,8 @@ while (my $line = <F>)
     system "pwd";
 
     my $log;
-#   $log = `python runtest.py --binary=../thunderbird/$appbin --showall --show-errors -a $xpi -t compactheader 2>&1`;
-    $log = $log . `python runtest.py --binary=../thunderbird/$appbin --showall --show-errors -a $xpi -t compactheader/test-compactheader-toolbar.js 2>&1`;
+   $log = $log . `python runtest.py --binary=../thunderbird/$appbin --showall --show-errors -a $xpi -t compactheader 2>&1`;
+#    $log = $log . `python runtest.py --binary=../thunderbird/$appbin --showall --show-errors -a $xpi -t compactheader/test-compactheader-toolbar.js 2>&1`;
     $log = $log . `python runtest.py --binary=../thunderbird/$appbin --showall --show-errors -a $xpi,../../ftp//$ostype-$hosttype-$version/lightning.xpi -t compactheader/test-compactheader-preferences.js 2>&1`;
 
     chdir "$currentdir";
diff --git a/test/shared-modules/test-compactheader-helpers.js b/test/shared-modules/test-compactheader-helpers.js
index f09d693..0a1d313 100644
--- a/test/shared-modules/test-compactheader-helpers.js
+++ b/test/shared-modules/test-compactheader-helpers.js
@@ -70,6 +70,8 @@ function installInto(module) {
   module.open_preferences_dialog = open_preferences_dialog;
   module.close_preferences_dialog = close_preferences_dialog;
   module.select_message_in_folder = select_message_in_folder;
+  module.collapse_and_assert_header = collapse_and_assert_header;
+  module.expand_and_assert_header = expand_and_assert_header;
 }
 
 
@@ -144,3 +146,24 @@ function select_message_in_folder(aFolder, aMessageNum, aController)
 
   return curMessage;
 }
+
+function collapse_and_assert_header(aController) {
+  let collapsedHeaderView = aController.e("collapsedHeaderView");
+  let expandedHeaderView = aController.e("expandedHeaderView");
+  if (collapsedHeaderView.getAttribute("collapsed")) {
+    aController.click(aController.eid("hideDetailsButton"));
+  }
+  folderDisplayHelper.assert_true(!collapsedHeaderView.hasAttribute("collapsed"));
+  folderDisplayHelper.assert_true(expandedHeaderView.getAttribute("collapsed"));
+}
+
+function expand_and_assert_header(aController) {
+  let collapsedHeaderView = aController.e("collapsedHeaderView");
+  let expandedHeaderView = aController.e("expandedHeaderView");
+  if (!collapsedHeaderView.hasAttribute("collapsed") ||
+      !collapsedHeaderView.getAttribute("collapsed")) {
+    aController.click(aController.eid("showDetailsButton"));
+  }
+  folderDisplayHelper.assert_true(collapsedHeaderView.getAttribute("collapsed"));
+  folderDisplayHelper.assert_true(!expandedHeaderView.hasAttribute("collapsed"));
+}

-- 
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