Bug 700656 - Include new user responsiveness peptest in packaged tests r=ctalbert

This commit is contained in:
Andrew Halberstadt 2011-11-16 08:58:30 -08:00
Родитель 94ddecfc05
Коммит 92a095b7f2
13 изменённых файлов: 442 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,56 @@
# ***** 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 peptest.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Andrew Halberstadt <ahalberstadt@mozilla.com> (Original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of 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 *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = testing_peptest
include $(topsrcdir)/config/rules.mk
TEST_FILES = \
tests \
$(NULL)
stage-package: PKG_STAGE = $(DIST)/test-package-stage
stage-package:
$(NSINSTALL) -D $(PKG_STAGE)/peptest
@(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(TEST_FILES)) | (cd $(PKG_STAGE)/peptest && tar -xf -)

Просмотреть файл

@ -0,0 +1,6 @@
[test_contextMenu.js]
[test_openBlankTab.js]
[test_openBookmarksMenu.js]
[test_searchGoogle.js]
[test_openWindow.js]
[test_resizeWindow.js]

Просмотреть файл

@ -0,0 +1,107 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
/**
* This test is designed to test responsiveness while performing actions
* on various context menus in both content and chrome.
*/
// Import mozmill and initialize a controller
Components.utils.import("resource://mozmill/driver/mozmill.js")
let c = getBrowserController();
// Open mozilla.org and wait for the page to load
c.open("http://mozilla.org");
c.waitForPageLoad();
// Grab reference to element on page (this is the <body> element in this case)
let page = findElement.ID(c.tabs.activeTab, 'home');
// Perform our first action, reload.
// It is very important to only place things that we
// are interested in testing inside of a performAction call
performAction('content_reload', function() {
page.rightClick();
page.keypress('r');
});
c.waitForPageLoad();
c.open("http://google.com");
c.waitForPageLoad();
page = findElement.ID(c.tabs.activeTab, 'main');
// Perform our second action, go back
performAction('content_back', function() {
page.rightClick();
page.keypress('b');
});
// Bug 699400 - waitForPageLoad times out when pressing back button
c.sleep(10);
page = findElement.ID(c.tabs.activeTab, 'home');
// Perform our third action, scroll through context menu
performAction('content_scroll', function() {
page.rightClick();
for (let i = 0; i < 15; ++i) {
page.keypress('VK_DOWN');
// Sleep to better emulate a user
c.sleep(10);
}
});
// Now test context menus in chrome
let bar = findElement.ID(c.window.document, "appmenu-toolbar-button");
bar.click();
performAction('chrome_menu', function() {
bar.rightClick();
bar.keypress('m');
});
performAction('chrome_addon', function() {
bar.rightClick();
bar.keypress('a');
});
performAction('chrome_scroll', function() {
bar.rightClick();
for (let i = 0; i < 15; ++i) {
page.keypress('VK_DOWN');
// Sleep to better emulate a user
c.sleep(10);
}
});

Просмотреть файл

@ -0,0 +1,53 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
// Initialize mozmill
Components.utils.import('resource://mozmill/driver/mozmill.js');
let c = getBrowserController();
c.open('http://mozilla.org');
c.waitForPageLoad();
// Only put things you want to test for responsiveness inside a perfom action call
let page = findElement.ID(c.tabs.activeTab, "home");
performAction('open_blank_tab', function() {
page.keypress('t', {'ctrlKey': true});
});
performAction('close_blank_tab', function() {
page.keypress('w', {'ctrlKey': true});
});

Просмотреть файл

@ -0,0 +1,58 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
// Import mozmill and initialize a controller
Components.utils.import('resource://mozmill/driver/mozmill.js');
let c = getBrowserController();
c.open('http://mozilla.org');
c.waitForPageLoad();
let bookmark = findElement.ID(c.window.document, "bookmarksMenu");
performAction('scroll_bookmarks', function() {
bookmark.click();
for (let i = 0; i < 15; ++i) {
bookmark.keypress('VK_DOWN');
// Sleep to better emulate a user
c.sleep(10);
}
});
let showall = findElement.ID(c.window.document, "bookmarksShowAll");
performAction('show_all_bookmarks', function() {
showall.click();
});

Просмотреть файл

@ -0,0 +1,45 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
// Import mozmill and initialize a controller
Components.utils.import("resource://mozmill/driver/mozmill.js");
let controller = getBrowserController();
let win = findElement.ID(controller.window.document, 'main-window');
performAction("open_window", function() {
win.keypress("n", {"ctrlKey":true});
});

Просмотреть файл

@ -0,0 +1,56 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
// Most of the other example tests use Mozmill to perform various
// automation. Note that this is not necessary.
//
// This test will check responsiveness while resizing the window
let window = getWindow();
let width = window.outerWidth;
let height = window.outerHeight;
performAction('resize_by', function() {
window.resizeBy(100, 100);
});
performAction('resize_to', function() {
window.resizeTo(800, 600);
});
// Tests should clean up after themselves
window.resizeTo(width, height);

Просмотреть файл

@ -0,0 +1,50 @@
/* ***** 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 peptest.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andrew Halberstadt <halbersa@gmail.com>
*
* 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 ***** */
// Import mozmill and initialize a controller
Components.utils.import("resource://mozmill/driver/mozmill.js");
let controller = getBrowserController();
controller.open("http://google.ca");
controller.waitForPageLoad();
let textbox = findElement.ID(controller.tabs.activeTab, 'lst-ib');
let button = findElement.Name(controller.tabs.activeTab, 'btnK');
performAction('enterText', function() {
textbox.sendKeys('foobar');
button.click();
});

Просмотреть файл

@ -0,0 +1,2 @@
# All Firefox tests - include other manifests here
[include:examples/example_tests.ini]

Просмотреть файл

@ -0,0 +1 @@
[include:examples/example_tests.ini]

Просмотреть файл

@ -233,7 +233,7 @@ include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
ifndef UNIVERSAL_BINARY
PKG_STAGE = $(DIST)/test-package-stage
package-tests: stage-mochitest stage-reftest stage-xpcshell stage-jstests stage-jetpack stage-firebug
package-tests: stage-mochitest stage-reftest stage-xpcshell stage-jstests stage-jetpack stage-firebug stage-peptest
else
# This staging area has been built for us by universal/flight.mk
PKG_STAGE = $(DIST)/universal/test-package-stage
@ -255,7 +255,7 @@ package-tests: stage-android
endif
make-stage-dir:
rm -rf $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE)/bin && $(NSINSTALL) -D $(PKG_STAGE)/bin/components && $(NSINSTALL) -D $(PKG_STAGE)/certs && $(NSINSTALL) -D $(PKG_STAGE)/jetpack && $(NSINSTALL) -D $(PKG_STAGE)/firebug
rm -rf $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE)/bin && $(NSINSTALL) -D $(PKG_STAGE)/bin/components && $(NSINSTALL) -D $(PKG_STAGE)/certs && $(NSINSTALL) -D $(PKG_STAGE)/jetpack && $(NSINSTALL) -D $(PKG_STAGE)/firebug && $(NSINSTALL) -D $(PKG_STAGE)/peptest
stage-mochitest: make-stage-dir
$(MAKE) -C $(DEPTH)/testing/mochitest stage-package
@ -280,9 +280,12 @@ stage-jetpack: make-stage-dir
stage-firebug: make-stage-dir
$(MAKE) -C $(DEPTH)/testing/firebug stage-package
stage-peptest: make-stage-dir
$(MAKE) -C $(DEPTH)/testing/peptest stage-package
.PHONY: \
mochitest mochitest-plain mochitest-chrome mochitest-a11y mochitest-ipcplugins \
reftest crashtest \
xpcshell-tests \
jstestbrowser \
package-tests make-stage-dir stage-mochitest stage-reftest stage-xpcshell stage-jstests stage-android stage-jetpack stage-firebug
package-tests make-stage-dir stage-mochitest stage-reftest stage-xpcshell stage-jstests stage-android stage-jetpack stage-firebug stage-peptest

Просмотреть файл

@ -891,6 +891,7 @@ if [ "$ENABLE_TESTS" ]; then
testing/xpcshell/Makefile
testing/xpcshell/example/Makefile
testing/firebug/Makefile
testing/peptest/Makefile
toolkit/components/alerts/test/Makefile
toolkit/components/autocomplete/tests/Makefile
toolkit/components/commandlines/test/Makefile

Просмотреть файл

@ -267,5 +267,6 @@ ifdef ENABLE_TESTS
tier_platform_dirs += testing/mochitest
tier_platform_dirs += testing/xpcshell
tier_platform_dirs += testing/tools/screenshot
tier_platform_dirs += testing/peptest
endif