source: Dev/branches/rest-dojo-ui/client/dijit/tests/robot/BgIframe.html @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 4.2 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2                "http://www.w3.org/TR/html4/strict.dtd">
3<html>
4        <head>
5                <title>doh.robot bgIframe Test</title>
6
7                <style>
8                        @import "../../../util/doh/robot/robot.css";
9                </style>
10
11                <!-- required: dojo.js -->
12                <script type="text/javascript" src="../../../dojo/dojo.js"></script>
13                       
14                <script type="text/javascript" src="../helpers.js"></script>
15                       
16                <script type="text/javascript">
17                        dojo.require("dijit.robotx");
18
19                        dojo.ready(function(){
20                                doh.robot.initRobot('../test_bgIframe.html');
21       
22                                dojo.forEach(["applet", "xapp"], function(xId){
23                                        doh.register(xId, [
24                                        {
25                                                name: "dialog_" + xId,
26                                                timeout: 15000,
27                                                runTest: function(){
28                                                        if(dojo.isWebKit){ return; }  // TODO: Remove skip-test for non-WebKit after #11822 is fixed
29                                                        var d = new doh.Deferred();
30
31                                                        var wasClicked = false;
32                                                        var connection;
33                                                       
34                                                        //Show the dialog
35                                                        doh.robot.mouseMoveAt("showDialog", 500,  1);
36                                                        doh.robot.mouseClick({left:true}, 500);
37                                                       
38                                                        //drag the dialog on top of the applet
39                                                        doh.robot.mouseMoveAt(dijit.byId("dialog").titleNode, 2000,  1);
40                                                        doh.robot.mousePress({left:true}, 500);
41                                                        doh.robot.mouseMoveAt(xId, 500,  1000);
42                                                        doh.robot.mouseRelease({left:true}, 500);
43                                                       
44                                                        doh.robot.sequence(function(){
45                                                                connection = dojo.connect(dijit.byId("dialog").containerNode, "onclick", function(e){ wasClicked = true; });
46                                                        }, 500);
47                                                       
48                                                        //Click on the dialog
49                                                        doh.robot.mouseMoveAt(dijit.byId("dialog").containerNode, 1, 1);
50                                                        doh.robot.mouseClick({left:true}, 500);
51                                                       
52                                                        doh.robot.sequence(d.getTestCallback(function(){
53                                                                dojo.disconnect(connection);
54                                                                //verify the native select did not disappear
55                                                                doh.t(isVisible(dojo.byId("dropDown_" + xId)), "The native select is not visible");
56                                                               
57                                                                dijit.byId("dialog").hide();
58                                                               
59                                                                doh.t(wasClicked, "Dialog was not visible because the onclick did not fire.");
60                                                        }), 1000);
61
62                                                        return d;
63                                                }
64                                        },
65                                        {
66                                                name: "tooltip_" + xId,
67                                                timeout: 8000,
68                                                runTest: function(){
69                                                        if(!dojo.isIE){ return; }  // TODO: Remove skip-test for non-IE after #11822 is fixed
70                                                        var d = new doh.Deferred();
71
72                                                        var tooltipWasClicked = false;
73                                                        var connection, oldHide;
74                                                       
75                                                        //Show the tooltip
76                                                        doh.robot.mouseMoveAt("two_" + xId, 500, 1);
77                                                       
78                                                        doh.robot.sequence(function(){
79                                                                var tooltip = dijit.byId("dijit__MasterTooltip_0");
80                                                                oldHide = tooltip.hide;
81                                                                tooltip.hide = function(aroundNode){
82                                                                        //don't allow the tooltip to be hidden                                                 
83                                                                };
84                                                                connection = dojo.connect(tooltip.domNode, "onclick",
85                                                                        function(e){
86                                                                                tooltipWasClicked = true;
87                                                                                tooltip.hide = oldHide;
88                                                                                tooltip.hide(tooltip.aroundNode);
89                                                                        }
90                                                                );
91                                                        }, 2000);
92                                                       
93                                                        //Click on the tooltip
94                                                        doh.robot.mouseMoveAt("dijit__MasterTooltip_0", 1, 1);
95                                                        doh.robot.mouseClick({left:true}, 500);
96                                                       
97                                                        doh.robot.sequence(d.getTestCallback(function(){
98                                                                dojo.disconnect(connection);
99                                                                doh.t(tooltipWasClicked, "The tooltip is not visible because the onclick event was not fired.");
100                                                        }), 1000);
101
102                                                        return d;
103                                                }
104                                        },
105                                        {
106                                                name: "dateTextBox_" + xId,
107                                                timeout: 7000,
108                                                runTest: function(){
109                                                        if(!dojo.isIE){ return; }  // TODO: Remove skip-test for non-IE after #11822 is fixed
110                                                        var d = new doh.Deferred();
111
112                                                        var wasClicked = false;
113                                                        var connection;
114                                                       
115                                                        //Show the popup
116                                                        doh.robot.mouseMoveAt("dateText_" + xId, 500, 1);
117                                                        doh.robot.mouseClick({left:true}, 500);
118                                                       
119                                                        doh.robot.sequence(function(){
120                                                                connection = dojo.connect(dijit.byId("dateText_"+xId+"_popup").domNode, "onclick", function(e){ wasClicked = true; });
121                                                        }, 2000);
122                                                       
123                                                        //Click on the popup
124                                                        doh.robot.mouseMoveAt("dateText_"+xId+"_popup", 1, 1, 10, 10);
125                                                        doh.robot.mouseClick({left:true}, 500);
126                                                       
127                                                        doh.robot.sequence(d.getTestCallback(function(){
128                                                                dojo.disconnect(connection);
129                                                                doh.t(wasClicked);
130                                                        }), 1000);
131
132                                                        return d;
133                                                }
134                                        }
135                                        ]);
136                                });
137                                doh.run();
138                        });
139                </script>
140        </head>
141</html>
Note: See TracBrowser for help on using the repository browser.