Skip to content

Commit 15e2695

Browse files
committed
style: format virtual-desktop.spec.ts
1 parent f4d214d commit 15e2695

1 file changed

Lines changed: 65 additions & 21 deletions

File tree

tests/e2e/virtual-desktop.spec.ts

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,16 @@ test.describe("Virtual Desktop Server - Basic", () => {
102102
await page.goto("/");
103103

104104
// Wait for servers to connect
105-
await expect(page.locator("select").first()).toBeEnabled({ timeout: 30000 });
105+
await expect(page.locator("select").first()).toBeEnabled({
106+
timeout: 30000,
107+
});
106108

107109
// Get all options from the server dropdown
108-
const options = await page.locator("select").first().locator("option").allTextContents();
110+
const options = await page
111+
.locator("select")
112+
.first()
113+
.locator("option")
114+
.allTextContents();
109115

110116
// Virtual Desktop Server should be in the list
111117
expect(options).toContain("Virtual Desktop Server");
@@ -115,25 +121,33 @@ test.describe("Virtual Desktop Server - Basic", () => {
115121
await page.goto("/");
116122

117123
// Wait for servers to connect
118-
await expect(page.locator("select").first()).toBeEnabled({ timeout: 30000 });
124+
await expect(page.locator("select").first()).toBeEnabled({
125+
timeout: 30000,
126+
});
119127

120128
// Select the Virtual Desktop Server
121-
await page.locator("select").first().selectOption({ label: "Virtual Desktop Server" });
129+
await page
130+
.locator("select")
131+
.first()
132+
.selectOption({ label: "Virtual Desktop Server" });
122133

123134
// Wait for tools to load
124135
await page.waitForTimeout(500);
125136

126137
// Select list-desktops tool
127-
await page.locator("select").nth(1).selectOption({ label: "list-desktops" });
138+
await page
139+
.locator("select")
140+
.nth(1)
141+
.selectOption({ label: "list-desktops" });
128142

129143
// Call the tool
130144
await page.click('button:has-text("Call Tool")');
131145

132146
// Should show a result (either no desktops or Docker not available)
133147
await expect(
134-
page.locator('text="No virtual desktops found"').or(
135-
page.locator('text="Docker is not available"'),
136-
),
148+
page
149+
.locator('text="No virtual desktops found"')
150+
.or(page.locator('text="Docker is not available"')),
137151
).toBeVisible({ timeout: 10000 });
138152
});
139153
});
@@ -142,7 +156,10 @@ test.describe("Virtual Desktop Server - Basic", () => {
142156
test.describe("Virtual Desktop Server - Docker", () => {
143157
// Skip unless explicitly enabled via environment variable
144158
const enableDockerTests = process.env.ENABLE_DOCKER_TESTS === "1";
145-
test.skip(!enableDockerTests || !dockerAvailable, "Docker tests disabled or Docker unavailable");
159+
test.skip(
160+
!enableDockerTests || !dockerAvailable,
161+
"Docker tests disabled or Docker unavailable",
162+
);
146163

147164
// Run tests serially to share the container
148165
test.describe.configure({ mode: "serial" });
@@ -170,10 +187,15 @@ test.describe("Virtual Desktop Server - Docker", () => {
170187
await page.goto("/");
171188

172189
// Wait for servers to connect
173-
await expect(page.locator("select").first()).toBeEnabled({ timeout: 30000 });
190+
await expect(page.locator("select").first()).toBeEnabled({
191+
timeout: 30000,
192+
});
174193

175194
// Select the Virtual Desktop Server
176-
await page.locator("select").first().selectOption({ label: "Virtual Desktop Server" });
195+
await page
196+
.locator("select")
197+
.first()
198+
.selectOption({ label: "Virtual Desktop Server" });
177199

178200
// The tool dropdown should now show view-desktop
179201
await page.waitForTimeout(500);
@@ -192,7 +214,9 @@ test.describe("Virtual Desktop Server - Docker", () => {
192214

193215
// Verify the VNC viewer is displayed
194216
const appFrame = getAppFrame(page);
195-
await expect(appFrame.locator('[class*="container"]')).toBeVisible({ timeout: 30000 });
217+
await expect(appFrame.locator('[class*="container"]')).toBeVisible({
218+
timeout: 30000,
219+
});
196220
});
197221

198222
test("screenshot matches golden", async ({ page }) => {
@@ -201,10 +225,15 @@ test.describe("Virtual Desktop Server - Docker", () => {
201225
await page.goto("/");
202226

203227
// Wait for servers to connect
204-
await expect(page.locator("select").first()).toBeEnabled({ timeout: 30000 });
228+
await expect(page.locator("select").first()).toBeEnabled({
229+
timeout: 30000,
230+
});
205231

206232
// Select the Virtual Desktop Server
207-
await page.locator("select").first().selectOption({ label: "Virtual Desktop Server" });
233+
await page
234+
.locator("select")
235+
.first()
236+
.selectOption({ label: "Virtual Desktop Server" });
208237

209238
// Select view-desktop tool
210239
await page.waitForTimeout(500);
@@ -225,7 +254,9 @@ test.describe("Virtual Desktop Server - Docker", () => {
225254
const appFrame = getAppFrame(page);
226255

227256
// Wait for the VNC canvas to appear (indicates connection)
228-
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({ timeout: 30000 });
257+
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({
258+
timeout: 30000,
259+
});
229260

230261
// Extra wait for VNC to fully render
231262
await page.waitForTimeout(3000);
@@ -243,36 +274,49 @@ test.describe("Virtual Desktop Server - Docker", () => {
243274
await page.goto("/");
244275

245276
// Wait for servers to connect
246-
await expect(page.locator("select").first()).toBeEnabled({ timeout: 30000 });
277+
await expect(page.locator("select").first()).toBeEnabled({
278+
timeout: 30000,
279+
});
247280

248281
// Select the Virtual Desktop Server and view-desktop tool
249-
await page.locator("select").first().selectOption({ label: "Virtual Desktop Server" });
282+
await page
283+
.locator("select")
284+
.first()
285+
.selectOption({ label: "Virtual Desktop Server" });
250286
await page.waitForTimeout(500);
251287
await page.locator("select").nth(1).selectOption({ label: "view-desktop" });
252288

253289
// Fill in the desktop name and call tool
254-
await page.locator("textarea").fill(JSON.stringify({ name: TEST_CONTAINER_NAME }));
290+
await page
291+
.locator("textarea")
292+
.fill(JSON.stringify({ name: TEST_CONTAINER_NAME }));
255293
await page.click('button:has-text("Call Tool")');
256294

257295
// Wait for app to load
258296
await waitForAppLoad(page);
259297
const appFrame = getAppFrame(page);
260298

261299
// Wait for VNC to connect
262-
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({ timeout: 30000 });
300+
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({
301+
timeout: 30000,
302+
});
263303

264304
// Click disconnect button
265305
const disconnectButton = appFrame.locator('button[title="Disconnect"]');
266306
await disconnectButton.click();
267307

268308
// Verify disconnected state shows
269-
await expect(appFrame.locator('[class*="disconnected"]')).toBeVisible({ timeout: 10000 });
309+
await expect(appFrame.locator('[class*="disconnected"]')).toBeVisible({
310+
timeout: 10000,
311+
});
270312

271313
// Click reconnect button
272314
const reconnectButton = appFrame.locator('button:has-text("Reconnect")');
273315
await reconnectButton.click();
274316

275317
// Verify VNC reconnects
276-
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({ timeout: 30000 });
318+
await expect(appFrame.locator('[class*="vncCanvas"]')).toBeVisible({
319+
timeout: 30000,
320+
});
277321
});
278322
});

0 commit comments

Comments
 (0)