1919 *
2020 */
2121
22- /*global describe, it, expect, beforeAll, afterAll, awaitsForDone, awaits */
22+ /*global describe, it, expect, beforeAll, afterAll, awaitsForDone, awaits, awaitsFor */
2323
2424define ( function ( require , exports , module ) {
2525
2626
2727 var SpecRunnerUtils = brackets . getModule ( "spec/SpecRunnerUtils" ) ;
2828
29- describe ( "extension:JSHint" , function ( ) {
30- var testFolder = SpecRunnerUtils . getTestPath ( "/spec/Extension-test-project-files/" ) ,
31- testProjectsFolder = SpecRunnerUtils . getTestPath ( "/spec/JSHintExtensionTest-files/" ) ,
29+ describe ( "integration:JSHint" , function ( ) {
30+ let testProjectsFolder = SpecRunnerUtils . getTestPath ( "/spec/JSHintExtensionTest-files/" ) ,
3231 testWindow ,
3332 $ ,
3433 CodeInspection ;
@@ -43,8 +42,8 @@ define(function (require, exports, module) {
4342 $ = testWindow . $ ;
4443 CodeInspection = testWindow . brackets . test . CodeInspection ;
4544 CodeInspection . toggleEnabled ( true ) ;
46-
47- await SpecRunnerUtils . loadProjectInTestWindow ( testFolder ) ;
45+ await awaitsFor ( ( ) => testWindow . _JsHintExtensionReadyToIntegTest ,
46+ "JsHint extension to be loaded" , 10000 ) ;
4847 } , 30000 ) ;
4948
5049 afterAll ( async function ( ) {
@@ -54,62 +53,71 @@ define(function (require, exports, module) {
5453 } , 30000 ) ;
5554
5655 it ( "status icon should toggle Errors panel when errors present" , async function ( ) {
57- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "errors.js" ] ) , "open test file" ) ;
58- await awaits ( 100 ) ;
59-
60- expect ( $ ( "#problems-panel" ) . is ( ":visible" ) ) . toBe ( true ) ;
56+ await SpecRunnerUtils . loadProjectInTestWindow ( testProjectsFolder + "valid-config-error" ) ;
57+ await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "es8.js" ] ) , "open test file with error" ) ;
58+ await awaitsFor ( ( ) => {
59+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
60+ } , "Problems panel to be visible" ) ;
6161
6262 toggleJSLintResults ( ) ;
63- expect ( $ ( "#problems-panel" ) . is ( ":visible" ) ) . toBe ( false ) ;
63+ await awaitsFor ( ( ) => {
64+ return ! $ ( "#problems-panel" ) . is ( ":visible" ) ;
65+ } , "Problems panel to be hidden" ) ;
6466
6567 toggleJSLintResults ( ) ;
66- expect ( $ ( "#problems-panel" ) . is ( ":visible" ) ) . toBe ( true ) ; //JSHintExtensionTest-files
68+ await awaitsFor ( ( ) => {
69+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
70+ } , "Problems panel to be visible" ) ;
6771 } ) ;
6872
6973 it ( "should show errors if invalid .jshintrc detected" , async function ( ) {
7074 await SpecRunnerUtils . loadProjectInTestWindow ( testProjectsFolder + "invalid-config" ) ;
7175 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "no-errors.js" ] ) , "open test file" ) ;
72- await awaits ( 100 ) ;
73-
74- expect ( $ ( "#problems- panel" ) . is ( ": visible") ) . toBe ( true ) ;
76+ await awaitsFor ( ( ) => {
77+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
78+ } , "Problems panel to be visible") ;
7579 } ) ;
7680
7781 it ( "should load valid es6 .jshintrc in project" , async function ( ) {
7882 await SpecRunnerUtils . loadProjectInTestWindow ( testProjectsFolder + "valid-config-es6" ) ;
7983 // es6 file should have no errors in problems panel
8084 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "es6.js" ] ) , "open test file es6.js" ) ;
81- await awaits ( 100 ) ;
8285
83- expect ( $ ( "#problems-panel" ) . is ( ":visible" ) ) . toBe ( false ) ;
86+ await awaits ( 100 ) ;
87+ await awaitsFor ( ( ) => {
88+ return ! $ ( "#problems-panel" ) . is ( ":visible" ) ;
89+ } , "Problems panel to be hidden" ) ;
8490
8591 // using es8 async feature in es6 jshint mode should have errors in problems panel
8692 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "es8.js" ] ) , "open test file es8.js" ) ;
87- await awaits ( 100 ) ;
88-
89- expect ( $ ( "#problems- panel" ) . is ( ": visible") ) . toBe ( true ) ;
93+ await awaitsFor ( ( ) => {
94+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
95+ } , "Problems panel to be visible") ;
9096 } ) ;
9197
9298 it ( "should extend valid es6 .jshintrc in project" , async function ( ) {
9399 await SpecRunnerUtils . loadProjectInTestWindow ( testProjectsFolder + "valid-config-es6-extend" ) ;
94100 // es6 file should have no errors in problems panel
95101 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "es6.js" ] ) , "open test file es6.js" ) ;
96- await awaits ( 100 ) ;
97102
98- expect ( $ ( "#problems-panel" ) . is ( ":visible" ) ) . toBe ( false ) ;
103+ await awaits ( 100 ) ;
104+ await awaitsFor ( ( ) => {
105+ return ! $ ( "#problems-panel" ) . is ( ":visible" ) ;
106+ } , "Problems panel to be hidden" ) ;
99107
100108 // using es8 async feature in es6 jshint mode should have errors in problems panel
101109 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "es8.js" ] ) , "open test file es8.js" ) ;
102- await awaits ( 100 ) ;
103-
104- expect ( $ ( "#problems- panel" ) . is ( ": visible") ) . toBe ( true ) ;
110+ await awaitsFor ( ( ) => {
111+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
112+ } , "Problems panel to be visible") ;
105113 } ) ;
106114
107115 it ( "should show errors if invalid .jshintrc extend file detected" , async function ( ) {
108116 await SpecRunnerUtils . loadProjectInTestWindow ( testProjectsFolder + "invalid-config-extend" ) ;
109117 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "no-errors.js" ] ) , "open test file" ) ;
110- await awaits ( 100 ) ;
111-
112- expect ( $ ( "#problems- panel" ) . is ( ": visible") ) . toBe ( true ) ;
118+ await awaitsFor ( ( ) => {
119+ return $ ( "#problems-panel" ) . is ( ":visible" ) ;
120+ } , "Problems panel to be visible") ;
113121 } ) ;
114122 } ) ;
115123} ) ;
0 commit comments