OLD | NEW |
| (Empty) |
1 -- Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 -- for details. All rights reserved. Use of this source code is governed by a | |
3 -- BSD-style license that can be found in the LICENSE file. | |
4 | |
5 -- This: 'tell application "Firefox" to activate' doesn't seem to bring | |
6 -- application in focus if it's not already open. | |
7 do shell script "open -a Firefox" | |
8 | |
9 delay 3.0 | |
10 | |
11 tell application "System Events" | |
12 --- Open Incognito window to avoid effect of caching of pages. | |
13 keystroke "p" using {command down, shift down} | |
14 | |
15 delay 1.0 | |
16 | |
17 keystroke "l" using command down | |
18 | |
19 keystroke "http://localhost:8080/" | |
20 -- Simulate Enter key. | |
21 key code 36 | |
22 | |
23 delay 10.0 | |
24 | |
25 -- Refresh the page to reload the scripts | |
26 keystroke "r" using command down | |
27 | |
28 keystroke "l" using command down | |
29 | |
30 delay 1.0 | |
31 | |
32 -- Simulate Tab key to get to 'Pick an example' dropdown | |
33 repeat 8 times | |
34 key code 48 | |
35 end repeat | |
36 | |
37 -- Simulate Down then Enter to select Hello, World | |
38 key code 125 | |
39 key code 36 | |
40 | |
41 delay 1.0 | |
42 | |
43 keystroke "l" using command down | |
44 | |
45 delay 1.0 | |
46 | |
47 -- Simulate Tab key to get to Code editor. | |
48 repeat 9 times | |
49 key code 48 | |
50 end repeat | |
51 | |
52 -- Simulate sequence of Down keys to get to "print(greeting);" line | |
53 repeat 8 times | |
54 key code 125 | |
55 end repeat | |
56 | |
57 -- Simulate Cmd-Right. | |
58 key code 124 using command down | |
59 | |
60 keystroke "print('c');" | |
61 | |
62 -- Simulate Left*11 to get to the beginning of "print('c');" | |
63 repeat 11 times | |
64 key code 123 | |
65 end repeat | |
66 | |
67 -- Simulate Enter to split lines | |
68 key code 36 | |
69 | |
70 -- Simulate Delete to join lines | |
71 key code 51 | |
72 | |
73 -- Simulate Enter to split lines | |
74 key code 36 | |
75 | |
76 -- Simulate Right*8 to get to right after the c in "print('c');" | |
77 repeat 8 times | |
78 key code 124 | |
79 end repeat | |
80 | |
81 keystroke "d" | |
82 | |
83 delay 0.1 | |
84 keystroke "a" using command down | |
85 delay 0.2 | |
86 keystroke "c" using command down | |
87 | |
88 delay 1 | |
89 set clipboardData to (the clipboard as text) | |
90 | |
91 if ("print('cd')" is not in (clipboardData as string)) then | |
92 error "print('cd') is not in clipboardData: " | |
93 end if | |
94 end tell | |
95 | |
96 tell application "Firefox" to quit | |
97 | |
98 display notification "Test passed" with title "Firefox test" sound name "Glass" | |
OLD | NEW |