Skip to content

Commit 6891ec3

Browse files
committed
test: integ test custom server should show error page if path outside serve root
1 parent 1567d25 commit 6891ec3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/spec/LiveDevelopmentCustomServer-test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,34 @@ define(function (require, exports, module) {
617617
}
618618
}, 30000);
619619

620+
it("should custom server show error page if path outside serve root", async function () {
621+
await _setupSimpleProject("doesntExist/", false);
622+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["sub/sub.html"]),
623+
"open sub.html");
624+
testWindow.$("#toolbar-go-live").click();
625+
testWindow.$("#toolbar-go-live").click();
626+
await awaitsFor(()=>{
627+
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");
628+
if(!iFrame.src) {
629+
return false;
630+
}
631+
const url = new URL(iFrame.src);
632+
const jsonStr = url.searchParams.get("jsonInput");
633+
if(!jsonStr){
634+
return false;
635+
}
636+
const message = JSON.parse(decodeURIComponent(jsonStr));
637+
return message.details.includes("Live preview settings is configured to only serve files from folder 'doesntExist/'");
638+
}, "Live preview settings is configured to only serve files from folder 'doesntExist/'");
639+
640+
// should still show markdown previews with internal live preview server!
641+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["readme.md"]),
642+
"open sub.html");
643+
await _waitForIframeMDFile('readme.md');
644+
645+
await endPreviewSession();
646+
}, 30000);
647+
620648
async function _forSVGLivePreview() {
621649
await awaitsFor(()=>{
622650
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");

0 commit comments

Comments
 (0)