mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 14:37:58 +01:00
command line machinery. It's orders of magnitude faster, on the one hand, but also runs the display machinery for all results, which may catch more errors. Errors in the command line completion machinery should be tested elsewhere. Fix some sidebar test bugs. Move dactyl.js and utils.js files out of sandboxes and into modules so we can pass XML objects in and out of them. --HG-- rename : common/tests/functional/dactyl.js => common/tests/functional/dactyl.jsm rename : common/tests/functional/utils.js => common/tests/functional/utils.jsm
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
var dactyllib = require("utils").module("dactyl");
|
|
|
|
const FIND_TEST_PAGE = collector.addHttpResource("./data/") + "find.html";
|
|
|
|
var setupModule = function (module) {
|
|
controller = mozmill.getBrowserController();
|
|
dactyl = new dactyllib.Controller(controller);
|
|
};
|
|
|
|
var teardownModule = function (module) {
|
|
dactyl.teardown();
|
|
}
|
|
|
|
var setupTest = function (test) {
|
|
controller.open(FIND_TEST_PAGE);
|
|
controller.waitForPageLoad(controller.tabs.activeTab);
|
|
controller.sleep(1000);
|
|
};
|
|
|
|
var testFindCommand_PresentAlphabeticText_TextSelected = function () {
|
|
assertTextFoundInPage("letter")
|
|
};
|
|
|
|
var testFindCommand_PresentNumericText_TextSelected = function () {
|
|
assertTextFoundInPage("3.141")
|
|
};
|
|
|
|
var testFindCommand_MissingText_ErrorMessageDisplayed = function () {
|
|
const MISSING_TEXT = "8c307545a017f60add90ef08955e148e";
|
|
const PATTERN_NOT_FOUND_ERROR = "E486: Pattern not found: " + MISSING_TEXT;
|
|
|
|
runTextSearchCommand(MISSING_TEXT);
|
|
|
|
dactyl.assertErrorMessage(PATTERN_NOT_FOUND_ERROR);
|
|
};
|
|
|
|
function runTextSearchCommand(str) {
|
|
dactyl.runViCommand("/" + str);
|
|
dactyl.runViCommand([["VK_RETURN"]]);
|
|
|
|
controller.sleep(0);
|
|
}
|
|
|
|
function assertTextFoundInPage(text) {
|
|
runTextSearchCommand(text);
|
|
dactyl.assertSelection(text);
|
|
}
|
|
|
|
// vim: sw=4 ts=8 et:
|