@@ -12,3 +12,53 @@ def strip_heredoc
12
12
gsub ( /^[ \t ]{#{ indent } }/ , "" )
13
13
end
14
14
end
15
+
16
+ Dir . glob ( File . join ( __dir__ , "support" , "**" , "*.rb" ) ) . each { |f | require f }
17
+
18
+ class IntegrationTest < Minitest ::Test
19
+ include Capybara ::DSL
20
+ include Capybara ::Minitest ::Assertions
21
+
22
+ def setup
23
+ @server = TestServer . new
24
+
25
+ switch_to_window ( windows . last )
26
+
27
+ assert_selector ".tab-label" , text : /\A Welcome\z / , wait : 10
28
+ end
29
+
30
+ def teardown
31
+ evaluate_script "electron.remote.app.quit()"
32
+
33
+ puts @server . stderr . read unless passed?
34
+ end
35
+
36
+ def create_and_open_new_file ( filename )
37
+ find ( ".explorer-viewlet" ) . click
38
+ find ( ".action-label.new-file" ) . click
39
+ find ( ".explorer-item input" ) . send_keys ( filename )
40
+ find ( ".explorer-item input" ) . send_keys ( :enter )
41
+ end
42
+
43
+ def input_contents ( *contents )
44
+ find ( ".monaco-editor textarea" ) . send_keys ( *contents )
45
+ end
46
+
47
+ def focus_text ( text )
48
+ input_contents :escape
49
+
50
+ find ( "span" , text : /\A #{ Regexp . escape ( text ) } \z / ) . hover
51
+ end
52
+
53
+ def assert_error_message_on ( text , message : nil )
54
+ focus_text text
55
+
56
+ options = message ? { text : /\A #{ Regexp . escape ( message ) } \z / } : { }
57
+
58
+ assert_selector ".monaco-tokenized-source" , options
59
+ end
60
+
61
+ def assert_no_error_message
62
+ assert_selector ".task-statusbar-item-label-error+.task-statusbar-item-label-counter" , text : /\A 0\z /
63
+ end
64
+ end
0 commit comments