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 tell application "Safari" to activate | |
6 | |
7 delay 3.0 | |
8 | |
9 tell application "System Events" | |
10 | |
11 keystroke "n" using command down | |
12 | |
13 delay 1.0 | |
14 | |
15 keystroke "l" using command down | |
16 | |
17 keystroke "http://localhost:8080/" | |
18 -- Simulate Enter key. | |
19 key code 36 | |
20 | |
21 delay 5.0 | |
22 | |
23 keystroke "l" using command down | |
24 -- Simulate Tab key. | |
25 key code 48 | |
26 key code 48 | |
27 | |
28 delay 0.2 | |
29 | |
30 -- Simulate Down. | |
31 key code 125 | |
32 | |
33 delay 0.2 | |
34 | |
35 -- Simulate Down. | |
36 key code 125 | |
37 | |
38 delay 0.2 | |
39 | |
40 -- Simulate Enter key. | |
41 key code 36 | |
42 | |
43 delay 0.2 | |
44 | |
45 -- Simulate Tab key. | |
46 key code 48 | |
47 | |
48 -- Simulate Cmd-Up. | |
49 key code 126 using command down | |
50 | |
51 -- Simulate Down. | |
52 key code 125 | |
53 key code 125 | |
54 key code 125 | |
55 key code 125 | |
56 key code 125 | |
57 | |
58 -- Simulate Cmd-Right. | |
59 key code 124 using command down | |
60 | |
61 -- Simulate Delete | |
62 key code 51 | |
63 | |
64 delay 0.1 | |
65 keystroke "a" using command down | |
66 delay 0.2 | |
67 keystroke "c" using command down | |
68 | |
69 delay 0.2 | |
70 set clipboardData to (the clipboard as text) | |
71 | |
72 if ("main() {" is in (clipboardData as string)) then | |
73 error "main() { in clipboardData" | |
74 end if | |
75 | |
76 if ("main() " is not in (clipboardData as string)) then | |
77 error "main() is not in clipboardData" | |
78 end if | |
79 | |
80 keystroke "l" using command down | |
81 delay 0.2 | |
82 | |
83 keystroke "http://localhost:8080/" | |
84 -- Simulate Enter key. | |
85 key code 36 | |
86 | |
87 delay 5.0 | |
88 | |
89 keystroke "l" using command down | |
90 -- Simulate Tab key. | |
91 key code 48 | |
92 key code 48 | |
93 | |
94 delay 0.2 | |
95 | |
96 -- Simulate Down. | |
97 key code 125 | |
98 | |
99 delay 0.2 | |
100 | |
101 -- Simulate Down. | |
102 key code 125 | |
103 | |
104 delay 0.2 | |
105 | |
106 -- Simulate Enter key. | |
107 key code 36 | |
108 | |
109 delay 0.2 | |
110 | |
111 -- Simulate Tab key. | |
112 key code 48 | |
113 | |
114 -- Simulate Cmd-Down. | |
115 key code 125 using command down | |
116 | |
117 repeat 203 times | |
118 -- Simulate Delete | |
119 key code 51 | |
120 end repeat | |
121 delay 5.0 | |
122 repeat 64 times | |
123 -- Simulate Delete | |
124 key code 51 | |
125 end repeat | |
126 | |
127 | |
128 delay 0.1 | |
129 keystroke "a" using command down | |
130 delay 0.5 | |
131 keystroke "c" using command down | |
132 | |
133 delay 0.5 | |
134 set clipboardData to (the clipboard as text) | |
135 | |
136 if ("/" is not (clipboardData as string)) then | |
137 error "/ is not clipboardData" | |
138 end if | |
139 | |
140 end tell | |
141 | |
142 tell application "Safari" to quit | |
143 | |
144 display notification "Test passed" with title "Safari test" sound name "Glass" | |
OLD | NEW |