Skip to content

Commit 9367368

Browse files
committed
fix: url code hinting desktop tests fails
1 parent 8828f85 commit 9367368

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

src/extensions/default/UrlCodeHints/unittests.js

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -262,65 +262,6 @@ define(function (require, exports, module) {
262262
});
263263
});
264264

265-
describe("Project root relative Url Code Hints", function () {
266-
267-
var testWindow,
268-
brackets,
269-
CodeHintManager,
270-
CommandManager,
271-
Commands,
272-
FileViewController,
273-
EditorManager;
274-
275-
it("should hint site root '/'", async function () {
276-
if(Phoenix.browser.isTauri && brackets.platform === "linux") {
277-
// This tests breaks in github actions only in linux desktop builds for no reason i can fid out.
278-
// no problem if we try to run it locally.
279-
// so we disable this tests in linux desktop builds for now.
280-
return;
281-
}
282-
testWindow = await SpecRunnerUtils.createTestWindowAndRun();
283-
brackets = testWindow.brackets;
284-
CodeHintManager = brackets.test.CodeHintManager;
285-
CommandManager = brackets.test.CommandManager;
286-
FileViewController = brackets.test.FileViewController;
287-
Commands = brackets.test.Commands;
288-
EditorManager = brackets.test.EditorManager;
289-
290-
await SpecRunnerUtils.loadProjectInTestWindow(extensionTestPath);
291-
292-
await awaitsForDone(
293-
FileViewController.openAndSelectDocument(testHtmlPath, FileViewController.WORKING_SET_VIEW));
294-
295-
testEditor = EditorManager.getActiveEditor();
296-
testEditor.setCursorPos({ line: 22, ch: 12 });
297-
298-
let hintList;
299-
await awaitsFor(async function () {
300-
// we have to exec command in loop as the file system scan may be ongoing and will reflect
301-
// hints as the scans get complete only. <We had an issue in slow test runners, so this>.
302-
await awaitsForDone(CommandManager.execute(Commands.SHOW_CODE_HINTS));
303-
hintList = CodeHintManager._getCodeHintList();
304-
return hintList && hintList.hints && hintList.hints.includes("/testfiles/");
305-
}, "waiting for code hints to be there", 5000, 100);
306-
expect(hintList).toBeTruthy();
307-
expect(hintList.hints).toBeTruthy();
308-
expect(hintList.hints).toContain("/testfiles/");
309-
310-
// cleanup
311-
testEditor = null;
312-
testDocument = null;
313-
testWindow = null;
314-
brackets = null;
315-
CodeHintManager = null;
316-
FileViewController = null;
317-
CommandManager = null;
318-
Commands = null;
319-
EditorManager = null;
320-
await SpecRunnerUtils.closeTestWindow();
321-
}, 30000);
322-
});
323-
324265
describe("Url Insertion", function () {
325266

326267
// These tests edit doc, so we need to setup/tear-down for each test
@@ -754,5 +695,64 @@ define(function (require, exports, module) {
754695
});
755696
});
756697

698+
describe("Project root relative Url Code Hints", function () {
699+
700+
var testWindow,
701+
brackets,
702+
CodeHintManager,
703+
CommandManager,
704+
Commands,
705+
FileViewController,
706+
EditorManager;
707+
708+
it("should hint site root '/'", async function () {
709+
if(Phoenix.browser.isTauri && Phoenix.platform === "linux") {
710+
// This tests breaks in github actions only in linux desktop builds for no reason i can fid out.
711+
// no problem if we try to run it locally.
712+
// so we disable this tests in linux desktop builds for now.
713+
return;
714+
}
715+
testWindow = await SpecRunnerUtils.createTestWindowAndRun();
716+
brackets = testWindow.brackets;
717+
CodeHintManager = brackets.test.CodeHintManager;
718+
CommandManager = brackets.test.CommandManager;
719+
FileViewController = brackets.test.FileViewController;
720+
Commands = brackets.test.Commands;
721+
EditorManager = brackets.test.EditorManager;
722+
723+
await SpecRunnerUtils.loadProjectInTestWindow(extensionTestPath);
724+
725+
await awaitsForDone(
726+
FileViewController.openAndSelectDocument(testHtmlPath, FileViewController.WORKING_SET_VIEW));
727+
728+
testEditor = EditorManager.getActiveEditor();
729+
testEditor.setCursorPos({ line: 22, ch: 12 });
730+
731+
let hintList;
732+
await awaitsFor(async function () {
733+
// we have to exec command in loop as the file system scan may be ongoing and will reflect
734+
// hints as the scans get complete only. <We had an issue in slow test runners, so this>.
735+
await awaitsForDone(CommandManager.execute(Commands.SHOW_CODE_HINTS));
736+
hintList = CodeHintManager._getCodeHintList();
737+
return hintList && hintList.hints && hintList.hints.includes("/testfiles/");
738+
}, "waiting for code hints to be there", 5000, 100);
739+
expect(hintList).toBeTruthy();
740+
expect(hintList.hints).toBeTruthy();
741+
expect(hintList.hints).toContain("/testfiles/");
742+
743+
// cleanup
744+
testEditor = null;
745+
testDocument = null;
746+
testWindow = null;
747+
brackets = null;
748+
CodeHintManager = null;
749+
FileViewController = null;
750+
CommandManager = null;
751+
Commands = null;
752+
EditorManager = null;
753+
await SpecRunnerUtils.closeTestWindow();
754+
}, 30000);
755+
});
756+
757757
}); // describe("Url Code Hinting"
758758
});

0 commit comments

Comments
 (0)