|
6 | 6 | import { expect, test } from '../fixtures/baseTest.js'; |
7 | 7 | import * as boundaryHttp from '../../helpers/boundary-http.js'; |
8 | 8 | import { textToMatch } from '../fixtures/tesseractTest.js'; |
| 9 | +import { |
| 10 | + isRdpClientInstalled, |
| 11 | + isRdpRunning, |
| 12 | + killRdpProcesses, |
| 13 | + isOSForRdpSupported, |
| 14 | +} from '../../helpers/rdp.js'; |
9 | 15 |
|
10 | 16 | const hostName = 'Host name for test'; |
11 | 17 | let org; |
@@ -117,7 +123,6 @@ test.beforeEach( |
117 | 123 | }); |
118 | 124 |
|
119 | 125 | // Create an RDP target and add host source and credential sources |
120 | | - // TODO: A test for RDP target connection will be added later when the Proxy is in place. |
121 | 126 | rdpTarget = await boundaryHttp.createTarget(request, { |
122 | 127 | scopeId: project.id, |
123 | 128 | type: 'rdp', |
@@ -285,4 +290,37 @@ test.describe('Targets tests', () => { |
285 | 290 | authedPage.getByRole('link', { name: targetWithHost.name }), |
286 | 291 | ).toBeVisible(); |
287 | 292 | }); |
| 293 | + |
| 294 | + test('Launches RDP client when connecting to an RDP target', async ({ |
| 295 | + authedPage, |
| 296 | + }) => { |
| 297 | + const isRdpClientInstalledCheck = await isRdpClientInstalled(); |
| 298 | + const isOSForRdpSupportedCheck = await isOSForRdpSupported(); |
| 299 | + |
| 300 | + test.skip( |
| 301 | + !isRdpClientInstalledCheck || !isOSForRdpSupportedCheck, |
| 302 | + 'RDP client is not installed/supported on this system', |
| 303 | + ); |
| 304 | + |
| 305 | + const beforeLaunchRunning = await isRdpRunning(); |
| 306 | + expect(beforeLaunchRunning).toBe(false); |
| 307 | + |
| 308 | + await authedPage.getByRole('link', { name: rdpTarget.name }).click(); |
| 309 | + await authedPage.getByRole('button', { name: 'Open' }).click(); |
| 310 | + |
| 311 | + await expect( |
| 312 | + authedPage.getByRole('heading', { name: 'Sessions' }), |
| 313 | + ).toBeVisible(); |
| 314 | + |
| 315 | + const afterLaunchRunning = await isRdpRunning(); |
| 316 | + expect(afterLaunchRunning).toBe(true); |
| 317 | + |
| 318 | + await authedPage.getByRole('button', { name: 'End Session' }).click(); |
| 319 | + await expect(authedPage.getByText('Canceled successfully.')).toBeVisible(); |
| 320 | + |
| 321 | + killRdpProcesses(); |
| 322 | + |
| 323 | + const afterKillRunning = await isRdpRunning(); |
| 324 | + expect(afterKillRunning).toBe(false); |
| 325 | + }); |
288 | 326 | }); |
0 commit comments