Skip to content

Commit 3b7154a

Browse files
committed
test: for custom server banner to be shown only if live preview panel shown
1 parent 2f023c7 commit 3b7154a

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
@@ -917,6 +917,34 @@ define(function (require, exports, module) {
917917
await endPreviewSession();
918918
}, 30000);
919919

920+
it("should custom server banner appear on SSR files only if live preview panel is open", async function () {
921+
const testPath = await SpecRunnerUtils.getTempTestDirectory(
922+
"/spec/LiveDevelopment-MultiBrowser-test-files", true);
923+
await SpecRunnerUtils.loadProjectInTestWindow(testPath);
924+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
925+
"open simple1.html");
926+
await waitsForLiveDevelopmentToOpen();
927+
928+
// now close the live preview panel by clicking on live preview extension icon
929+
let livePreviewBtn = testWindow.$(testWindow.document.getElementById("toolbar-go-live"));
930+
livePreviewBtn.click();
931+
expect(WorkspaceManager.isPanelVisible('live-preview-panel')).toBeFalse();
932+
const serverFile = `php.php`;
933+
await _createAnOpenFile(testPath, serverFile);
934+
await awaits(50);
935+
// the banner should not be shown
936+
expect(testWindow.$(".live-preview-settings").is(":visible")).toBeFalse();
937+
938+
// now bring back the live preview panel, the banner should become visible
939+
livePreviewBtn.click();
940+
expect(WorkspaceManager.isPanelVisible('live-preview-panel')).toBeTrue();
941+
await _forBannerAppear(serverFile);
942+
testWindow.$(".close-icon").click();
943+
await _forBannerClose(serverFile);
944+
945+
await endPreviewSession();
946+
}, 30000);
947+
920948
it("should custom server banner close on project switch", async function () {
921949
const testPath = await SpecRunnerUtils.getTempTestDirectory(
922950
"/spec/LiveDevelopment-MultiBrowser-test-files", true);

0 commit comments

Comments
 (0)