source: Dev/trunk/src/client/dojox/mvc/tests/1.7/robot/mobile-demo-test.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 14.3 KB
Line 
1<!DOCTYPE html>
2<html>
3                <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4                <title>doh.robot MVC demo-shipto-billto-simple Declarative Test</title>
5
6                <style>
7                        @import "../../../../../util/doh/robot/robot.css";
8                </style>
9
10                <!-- required: dojo.js -->
11                <script type="text/javascript" src="../../../../../dojo/dojo.js"
12                        djConfig="isDebug: true, parseOnLoad: true"></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.addOnLoad(function(){
20                                doh.robot.initRobot('../mobile/demo/demo.html');
21
22                                doh.register("test_Mobile-Demo", [                                                                                                                         
23                                        {
24                                                name: "initial conditions",
25                                                timeout: 9000,
26                                                runTest: function(){
27                                                        var d = new doh.Deferred();
28                                                        console.debug("dojo.version() is "+dojo.version);
29                                                       
30                                                        doh.robot.sequence(d.getTestCallback(function(){
31                                                                //"ShipTo" selected
32                                                                //doh.is("123 Valley Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
33                                                        }), 1000);
34                                                        return d;
35                                                }
36                                         },
37                                         {                                             
38                                                name: "testSimpleDataBinding",
39                                                timeout: 18000,
40                                                runTest: function(){
41                                                        var d = new doh.Deferred();
42                                                       
43                                                        doh.robot.mouseMoveAt("sdb", 500, 0);
44                                                        doh.robot.mouseClick({left:true}, 500);
45                                                        doh.robot.mouseMoveAt("cityInput", 500, 0);
46                                                        doh.robot.mouseClick({left:true}, 500);
47                                                       
48                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {shift:true});                                                   
49                                                        doh.robot.keyPress(dojo.keys.DELETE, 500, {});                                                 
50                                                       
51                                                        doh.robot.typeKeys("456 Mountain Rd", 300, 800);                                                       
52                                                        doh.robot.keyPress(dojo.keys.TAB, 300, {shift:true});                                                   
53                                                       
54                                                        doh.robot.mouseMoveAt("billto", 500, 0);
55                                                        doh.robot.mouseClick({left:true}, 500);
56                                                       
57                                                        doh.robot.mouseMoveAt("shipto", 500, 0);
58                                                        doh.robot.mouseClick({left:true}, 500);
59
60                                                        doh.robot.mouseMoveAt("streetInput", 500, 0);
61                                                        doh.robot.mouseClick({left:true}, 500);
62                                                       
63                                                        doh.robot.sequence(d.getTestCallback(function(){
64                                                                var w = dijit.byId("streetInput");
65                                                                var v  = w.get('value');
66                                                                doh.is("456 Mountain Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
67                                                        }), 1000);
68                                                       
69                                                //      doh.robot.sequence(d.getTestCallback(function(){
70                                                                //"SendTo" selected
71                                                                //"BillTo" selected
72                                                //              doh.is("123 Valley Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
73                                                                //doh.is("17 Skyline Dr", dijit.byId("streetInput").get('value'),"streetInput should be set");
74                                                //      }), 1000);
75                                                        return d;
76                                                }
77                                        },
78                                         {                                             
79                                                name: "testSimpleDataBinding - billTo",
80                                                timeout: 9000,
81                                                runTest: function(){
82                                                        var d = new doh.Deferred();
83                                                       
84                                                        doh.robot.mouseMoveAt("billto", 500, 0);
85                                                        doh.robot.mouseClick({left:true}, 500);
86                                                       
87                                                        doh.robot.sequence(d.getTestCallback(function(){
88                                                                //"BillTo" selected
89                                                                doh.is("17 Skyline Dr", dijit.byId("streetInput").get('value'),"streetInput should be set");
90                                                        }), 1000);
91                                                        return d;
92                                                }
93                                        },
94                                        {
95                                                name: "shipto",
96                                                timeout: 9000,
97                                                runTest: function(){
98                                                        var d = new doh.Deferred();
99
100                                                        doh.robot.mouseMoveAt("shipto", 500, 0);
101                                                        doh.robot.mouseClick({left:true}, 500);
102                                                       
103                                                        doh.robot.sequence(d.getTestCallback(function(){
104                                                                //"ShipTo" selected
105                                                                doh.is("456 Mountain Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
106                                                        }), 1000);
107                                                        return d;
108                                                }
109                                        },                                     
110/*                                      {
111                                                name: "changeShipToAddress",
112                                                timeout: 9000,
113                                                runTest: function(){
114                                                        var d = new doh.Deferred();
115
116                                                        doh.robot.mouseMoveAt("cityInput", 500, 0);
117                                                        doh.robot.mouseClick({left:true}, 500);
118                                                       
119                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {shift:true});                                                   
120                                                        doh.robot.keyPress(dojo.keys.DELETE, 500, {});                                                 
121                                                       
122                                                        doh.robot.typeKeys("456 Mountain Rd", 500, 1000);                                                       
123                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {shift:true});                                                   
124                                                       
125                                                        doh.robot.mouseMoveAt("billto", 500, 0);
126                                                        doh.robot.mouseClick({left:true}, 500);
127                                                       
128                                                        doh.robot.mouseMoveAt("shipto", 500, 0);
129                                                        doh.robot.mouseClick({left:true}, 500);
130
131                                                        doh.robot.mouseMoveAt("streetInput", 500, 0);
132                                                        doh.robot.mouseClick({left:true}, 500);
133                                                       
134                                                        doh.robot.sequence(d.getTestCallback(function(){
135                                                                var w = dijit.byId("streetInput");
136                                                                var v  = w.get('value');
137                                                                doh.is("456 Mountain Rd", dijit.byId("streetInput").get('value'),"streetInput should be set");
138                                                        }), 1000);
139                                                        return d;
140                                                }
141                                         },
142                                */
143                                         {                                             
144                                                name: "testRepeatDataBinding",
145                                                timeout: 9000,
146                                                runTest: function(){
147                                                        var d = new doh.Deferred();
148                                                       
149                                                        //doh.robot.mouseMoveAt("home", 500, 0);
150                                                        var t1 = dojo.query('.mblToolBarButtonLeftArrow')[0];
151                                                        doh.robot.mouseMoveAt(dojo.query('.mblToolBarButtonLeftArrow')[0], 500);                                                       
152                                                        doh.robot.mouseClick({left:true}, 500);
153                                                       
154                                                        doh.robot.mouseMoveAt("rdb", 1500, 0);
155                                                        doh.robot.mouseClick({left:true}, 500);
156                                                       
157                                                        doh.robot.sequence(d.getTestCallback(function(){
158                                                        doh.is("Chad", dijit.byId("nameInput0").get('value'),"nameInput0 should be Chad");
159                                                        doh.is("Irene", dijit.byId("nameInput1").get('value'),"nameInput1 should be Irene");
160                                                        doh.is("John", dijit.byId("nameInput2").get('value'),"nameInput2 should be John");
161                                                        doh.is("Chad", dijit.byId("firstInput").get('value'),"firstInput should be Chad");
162                                                        doh.is("Chapman", dijit.byId("lastInput").get('value'),"lastInput should be Chapman");
163                                                        doh.is("c.c@test.com", dijit.byId("emailInput2").get('value'),"emailInput2 should be c.c@test.com");
164                                                        }), 1000);
165                                                       
166                                                        return d;
167                                                }
168                                        },
169                        /*              {
170                                                name: "selectIrene",
171                                                timeout: 9000,
172                                                runTest: function(){
173                                                        var d = new doh.Deferred();
174                                                       
175                                                        doh.robot.mouseMoveAt("details1", 500, 0);
176                                                        doh.robot.mouseClick({left:true}, 500);
177                                                       
178                                                        doh.robot.sequence(d.getTestCallback(function(){
179                                                                doh.is("Irene", dijit.byId("firstInput").get('value'),"firstInput should be Irene");
180                                                                doh.is("Ira", dijit.byId("lastInput").get('value'),"lastInput should be Ira");
181                                                                doh.is("i.i@test.com", dijit.byId("emailInput2").get('value'),"emailInput2 should be h.h@test.com");
182                                                        }), 1000);
183                                                        return d;
184                                                }
185                                        },
186                        */             
187                                        {
188                                                name: "selectJohn",
189                                                timeout: 9000,
190                                                runTest: function(){
191                                                        var d = new doh.Deferred();
192                                                       
193                                                        doh.robot.mouseMoveAt("details2", 500, 0);
194                                                        doh.robot.mouseClick({left:true}, 500);
195                                                       
196                                                        doh.robot.sequence(d.getTestCallback(function(){
197                                                                doh.is("John", dijit.byId("firstInput").get('value'),"firstInput should be John");
198                                                                doh.is("Jacklin", dijit.byId("lastInput").get('value'),"lastInput should be Jacklin");
199                                                                doh.is("j.j@test.com", dijit.byId("emailInput2").get('value'),"emailInput2 should be j.j@test.com");
200                                                        }), 1000);
201                                                        return d;
202                                                }
203                                        },
204                                        {
205                                                name: "changeJohn",
206                                                timeout: 9000,
207                                                runTest: function(){
208                                                        var d = new doh.Deferred();
209                                                       
210                                                        doh.robot.mouseMoveAt("firstInput", 500, 0);
211                                                        doh.robot.mouseClick({left:true}, 500);
212
213                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 500, {});                                                 
214                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});                                                 
215                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});                                                 
216                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});                                                 
217                                                        doh.robot.typeKeys("Johnny", 1000, 2000);                                                                                                         
218                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {});                                                     
219                                                       
220                                                        doh.robot.sequence(d.getTestCallback(function(){
221                                                                doh.is("Johnny", dijit.byId("firstInput").get('value'),"firstInput should be Johnny");
222                                                                doh.is("Johnny", dijit.byId("nameInput2").get('value'),"nameInput2 should be Johnny");
223                                                        }), 1000);
224                                                        return d;
225                                                }
226                                        },
227                                        {
228                                                name: "changeIrene",
229                                                timeout: 9000,
230                                                runTest: function(){
231                                                        var d = new doh.Deferred();
232                                                       
233                                                        doh.robot.mouseMoveAt("details1", 500, 0);
234                                                        doh.robot.mouseClick({left:true}, 500);
235                                                       
236                                                        doh.robot.mouseMoveAt("nameInput1", 500, 0);
237                                                        doh.robot.mouseClick({left:true}, 500);
238
239                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 500, {});                                                 
240                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
241                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
242                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
243                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
244                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});                                                 
245                                                        doh.robot.typeKeys("Howard", 300, 800);                                                                                                 
246                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {});                                                     
247                                                       
248                                                        doh.robot.sequence(d.getTestCallback(function(){
249                                                                doh.is("Howard", dijit.byId("firstInput").get('value'),"check for firstInput set to Howard");
250                                                                doh.is("Howard", dijit.byId("nameInput1").get('value'),"check for nameInput1 set to Howard");
251                                                        }), 1500);
252                                                        return d;
253                                                }
254                                        },
255                                        {
256                                                name: "AddKen",
257                                                timeout: 20000,
258                                                runTest: function(){
259                                                        var d = new doh.Deferred();
260                                                       
261                                                        //doh.robot.mouseMoveAt("dijit_form_Button_29", 500, 0);
262                                                        //doh.robot.mouseClick({left:true}, 500);
263
264                                                        doh.robot.mouseMoveAt("add", 1000, 0);
265                                                        doh.robot.mouseClick({left:true}, 500);
266                                                       
267                                                        doh.robot.mouseMoveAt("firstInput", 500, 0);
268                                                        doh.robot.mouseClick({left:true}, 500);
269
270                                                        doh.robot.typeKeys("Ken", 300, 600);                                                                                                     
271                                                        doh.robot.keyPress(dojo.keys.TAB, 300, {});     
272                                                        doh.robot.typeKeys("Kelly", 300, 600);                                                                                                         
273                                                        doh.robot.keyPress(dojo.keys.TAB, 300, {});     
274                                                        doh.robot.typeKeys("k.k@test.com", 300, 600);                                                                                                     
275                                                        doh.robot.keyPress(dojo.keys.TAB, 300, {});     
276                                                        doh.robot.typeKeys("408-764-3454", 300, 600);                                                                                                     
277
278                                                        doh.robot.sequence(d.getTestCallback(function(){
279                                                                doh.is("Ken", dijit.byId("firstInput").get('value'),"firstInput should be Ken");
280                                                                doh.is("Ken", dijit.byId("nameInput3").get('value'),"nameInput4 should be Ken");
281                                                                doh.is("Kelly", dijit.byId("lastInput").get('value'),"lastInput should be set");
282                                                                doh.is("k.k@test.com", dijit.byId("emailInput2").get('value'),"emailInput2 should be set");
283                                                                doh.is("408-764-3454", dijit.byId("telInput").get('value'),"telInput should be set");
284                                                        }), 1000);
285                                                        return d;
286                                                }
287                               
288                                         },
289                               
290                                         {                                             
291                                                name: "testGenerateDataBinding",
292                                                timeout: 9000,
293                                                runTest: function(){
294                                                        var d = new doh.Deferred();
295
296                                                        // move back to Home
297                                                        doh.robot.mouseMoveAt(dojo.query('.mblToolBarButtonLeftArrow')[1], 500);                                                       
298                                                        doh.robot.mouseClick({left:true}, 500);
299                                                       
300                                                        doh.robot.mouseMoveAt("sfg", 1000, 0);
301                                                        doh.robot.mouseClick({left:true}, 500);
302                                                       
303                                                        doh.robot.mouseMoveAt("generate1", 1000, 0);
304                                                        doh.robot.mouseClick({left:true}, 500);
305                                                       
306                                                        doh.robot.sequence(d.getTestCallback(function(){
307                                                                doh.is("11111", dijit.byId("TB0").get('value'),"TB0 should be set");
308                                                                doh.is("John", dijit.byId("TB1").get('value'),"TB1 should be set");
309                                                                doh.is("Doe", dijit.byId("TB2").get('value'),"TB2 should be set");
310                                                                doh.is("jdoe@example.com", dijit.byId("TB3").get('value'),"TB3 should be set");                 
311                                                        }), 1000);
312                                                       
313                                                        return d;
314                                                }
315                                        },
316                                        {
317                                                name: "changeJohnGenerate",
318                                                timeout: 9000,
319                                                runTest: function(){
320                                                        var d = new doh.Deferred();
321                                                       
322                                                        doh.robot.mouseMoveAt("TB1", 500, 0); //updateModel
323                                                        doh.robot.mouseClick({left:true}, 500);
324
325                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 500, {});                                                 
326                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
327                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
328                                                        doh.robot.keyPress(dojo.keys.BACKSPACE, 100, {});                                                 
329                                                        doh.robot.typeKeys("Johnny", 200, 800);                                                                                                   
330                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {});                                                     
331                                                        doh.robot.keyPress(dojo.keys.TAB, 500, {});                                                     
332                                                       
333                                                        doh.robot.sequence(d.getTestCallback(function(){
334                                                                doh.is("Johnny", dijit.byId("TB1").get('value'),"TB1 should be Johnny");
335                                                        }), 1000);
336                                                        return d;
337                                                }
338                                        },
339                                        {
340                                                name: "updateModelGenerate",
341                                                timeout: 9000,
342                                                runTest: function(){
343                                                        var d = new doh.Deferred();
344                                                       
345                                                        doh.robot.mouseMoveAt("updateModel", 500, 0);
346                                                        doh.robot.mouseClick({left:true}, 500);
347                                                        doh.robot.keyPress(dojo.keys.TAB, 1000, {});                                                   
348                                                       
349                                                        doh.robot.sequence(d.getTestCallback(function(){
350                                                                var ttt = dijit.byId("modelArea").get('value');
351                                                                var txa = ttt.substring(33,39);
352                                                                if (txa !== "Johnny"){ //IE has a diff offset
353                                                                        txa = ttt.substring(35,41);
354                                                                }
355                                                                doh.is("Johnny", txa,"textarea should have Johnny");
356                                                        }), 2000);
357                                                        return d;
358                                                }
359                                        },
360                                        {
361                                                name: "updateFormGenerate",
362                                                timeout: 9000,
363                                                runTest: function(){
364                                                        var d = new doh.Deferred();
365                                                        var ttt2 = dijit.byId("modelArea2").get('value');
366                                                        dijit.byId("modelArea").set('value',ttt2);
367                                                       
368                                                        doh.robot.mouseMoveAt("generate1", 500, 0);
369                                                        doh.robot.mouseClick({left:true}, 500);
370                                                       
371                                                        doh.robot.sequence(d.getTestCallback(function(){
372                                                                doh.is("11111", dijit.byId("TB0").get('value'),"TB0 should be set");
373                                                                doh.is("John", dijit.byId("TB1").get('value'),"TB1 should be set");
374                                                                doh.is("J", dijit.byId("TB2").get('value'),"TB2 should be set");
375                                                                doh.is("Doe", dijit.byId("TB3").get('value'),"TB3 should be set");
376                                                                doh.is("jdoe@example.com", dijit.byId("TB4").get('value'),"TB4 should be set");                 
377                                                        }), 1000);
378                                                        return d;
379                                                }
380                                        },
381                                         {                                             
382                                                name: "testBackToHome",
383                                                timeout: 9000,
384                                                runTest: function(){
385                                                        var d = new doh.Deferred();
386
387                                                        // move back to Home
388                                                        var t = dojo.query('.mblToolBarButtonLeftArrow');
389                                                        doh.robot.mouseMoveAt(dojo.query('.mblToolBarButtonLeftArrow')[2], 500);                                                       
390                                                        doh.robot.mouseClick({left:true}, 500);
391                                                       
392                                                        doh.robot.sequence(d.getTestCallback(function(){
393                                                                doh.is("11111", dijit.byId("TB0").get('value'),"TB0 should be set");
394                                                        }), 1000);
395                                                       
396                                                        return d;
397                                                }
398                                        }
399                                       
400                                ]);
401                                doh.run();
402                        });
403                </script>
404</html>
Note: See TracBrowser for help on using the repository browser.