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 /// Whitebox integration/end-to-end test of Try Dart! site. | |
6 /// | |
7 /// This test opens Try Dart! in an iframe. When opened the first time, Try | |
8 /// Dart! will display a simple hello-world example, color tokens, compile the | |
9 /// example, and run the result. We've instrumented Try Dart! to use | |
10 /// window.parent.postMessage when the running program prints anything. So this | |
11 /// test just waits for a "Hello, World!" message. | |
12 library trydart.end_to_end_test; | |
13 | |
14 import 'dart:html'; | |
15 | |
16 import 'package:async_helper/async_helper.dart' show | |
17 asyncTest; | |
18 | |
19 import 'sandbox.dart' show | |
20 appendIFrame, | |
21 listener; | |
22 | |
23 void main() => asyncTest(() { | |
24 listener.start(); | |
25 | |
26 // Disable analytics for testing. | |
27 document.cookie = 'org-trydart-AutomatedTest=true;path=/'; | |
28 | |
29 // Clearing localStorage makes Try Dart! think it is opening for the first | |
30 // time. | |
31 window.localStorage.clear(); | |
32 | |
33 IFrameElement iframe = | |
34 appendIFrame('/root_build/try_dartlang_org/index.html', document.body) | |
35 ..style.width = '90vw' | |
36 ..style.height = '90vh'; | |
37 | |
38 return listener.expect('Hello, World!\n').then((_) { | |
39 // Remove the iframe to work around a bug in test.dart. | |
40 iframe.remove(); | |
41 | |
42 // Clean up after ourselves. | |
43 window.localStorage.clear(); | |
44 }); | |
45 }); | |
OLD | NEW |