UNPKG

systelab-components-wdio-test

Version:
27 lines (26 loc) 986 B
import { ApplicationRemoteClient } from "../remote/client/application-remote-client.js"; export class RemoteApplicationManager { static async start(remoteHost, browserType, options) { const id = this.nextId; this.nextId += 1; const remoteId = await ApplicationRemoteClient.start(remoteHost, browserType, options); const application = { id, host: remoteHost, remoteId }; this.applications.push(application); return application; } static async stop(id) { const app = this.get(id); if (app) { await ApplicationRemoteClient.stop(app); this.applications = this.applications.filter(app => app.id !== id); } else { throw new Error(`Remote application with id ${id} not found`); } } static get(id) { return this.applications.find(app => app.id === id); } } RemoteApplicationManager.nextId = 1; RemoteApplicationManager.applications = [];