diff --git a/test/sanity/src/context.ts b/test/sanity/src/context.ts index a117b617e78..a96aa070ce9 100644 --- a/test/sanity/src/context.ts +++ b/test/sanity/src/context.ts @@ -584,4 +584,18 @@ export class TestContext { } return url.toString(); } + + /** + * Returns a random alphanumeric token of length 10. + */ + public getRandomToken(): string { + return Array.from({ length: 10 }, () => Math.floor(Math.random() * 36).toString(36)).join(''); + } + + /** + * Returns a random port number between 3000 and 9999. + */ + public getRandomPort(): string { + return String(Math.floor(Math.random() * 7000) + 3000); + } } diff --git a/test/sanity/src/desktop.test.ts b/test/sanity/src/desktop.test.ts index 20c1d7c1f47..8a4cac1b102 100644 --- a/test/sanity/src/desktop.test.ts +++ b/test/sanity/src/desktop.test.ts @@ -11,7 +11,7 @@ import { UITest } from './uiTest'; export function setup(context: TestContext) { describe('Desktop', () => { if (context.platform === 'darwin-x64') { - it('desktop-darwin', async () => { + it('desktop-darwin-x64', async () => { const dir = await context.downloadAndUnpack('darwin'); const entryPoint = context.installMacApp(dir); await testDesktopApp(entryPoint); diff --git a/test/sanity/src/server.test.ts b/test/sanity/src/server.test.ts index 03550918b2b..d0f8e2dad2c 100644 --- a/test/sanity/src/server.test.ts +++ b/test/sanity/src/server.test.ts @@ -85,7 +85,11 @@ export function setup(context: TestContext) { } async function testServer(entryPoint: string) { - const args = ['--accept-server-license-terms', '--connection-token', '12345']; + const args = [ + '--accept-server-license-terms', + '--connection-token', context.getRandomToken(), + '--port', context.getRandomPort() + ]; context.log(`Starting server ${entryPoint} with args ${args.join(' ')}`); const server = spawn(entryPoint, args, { shell: true, detached: os.platform() !== 'win32' }); diff --git a/test/sanity/src/serverWeb.test.ts b/test/sanity/src/serverWeb.test.ts index 836f0ad2551..397b48b6c60 100644 --- a/test/sanity/src/serverWeb.test.ts +++ b/test/sanity/src/serverWeb.test.ts @@ -86,12 +86,11 @@ export function setup(context: TestContext) { } async function testServer(entryPoint: string) { - const token = Array.from({ length: 10 }, () => Math.floor(Math.random() * 36).toString(36)).join(''); - const port = String(Math.floor(Math.random() * 7000) + 3000); + const token = context.getRandomToken(); const test = new UITest(context); const args = [ '--accept-server-license-terms', - '--port', port, + '--port', context.getRandomPort(), '--connection-token', token, '--server-data-dir', context.createTempDir(), '--extensions-dir', test.extensionsDir,