]> git.donarmstrong.com Git - dactyl.git/blob - common/tests/functional/testFindCommands.js
Initial import of 1.0~b6
[dactyl.git] / common / tests / functional / testFindCommands.js
1 var dactyllib = require("utils").module("dactyl");
2
3 const FIND_TEST_PAGE = collector.addHttpResource("./data/") + "find.html";
4
5 var setupModule = function (module) {
6     controller = mozmill.getBrowserController();
7     dactyl = new dactyllib.Controller(controller);
8 };
9
10 var teardownModule = function (module) {
11     dactyl.teardown();
12 }
13
14 var setupTest = function (test) {
15     controller.open(FIND_TEST_PAGE);
16     controller.waitForPageLoad(controller.tabs.activeTab);
17     controller.sleep(1000);
18 };
19
20 var testFindCommand_PresentAlphabeticText_TextSelected = function () {
21     assertTextFoundInPage("letter")
22 };
23
24 var testFindCommand_PresentNumericText_TextSelected = function () {
25     assertTextFoundInPage("3.141")
26 };
27
28 var testFindCommand_MissingText_ErrorMessageDisplayed = function () {
29     const MISSING_TEXT = "8c307545a017f60add90ef08955e148e";
30     const PATTERN_NOT_FOUND_ERROR = "E486: Pattern not found: " + MISSING_TEXT;
31
32     runTextSearchCommand(MISSING_TEXT);
33
34     dactyl.assertErrorMessage(PATTERN_NOT_FOUND_ERROR);
35 };
36
37 function runTextSearchCommand(str) {
38     dactyl.runViCommand("/" + str);
39     dactyl.runViCommand([["VK_RETURN"]]);
40
41     controller.sleep(0);
42 }
43
44 function assertTextFoundInPage(text) {
45     runTextSearchCommand(text);
46     dactyl.assertSelection(text);
47 }
48
49 // vim: sw=4 ts=8 et: