diff --git a/src/host/main.js b/src/host/main.js index 6031bce..6092f48 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -82,7 +82,7 @@ export async function hostMain(options) { emitter.on(HostMessage.STOP_RUNNER, () => resolve()); }), timesOption, - baseUrl: serverDirectory.baseUrl, + baseUrl: new URL(serverDirectory.baseUrl.toString()), mock: runnerMockOptions({ mock: runnerMock, mockOpenPage: runnerMockOpenPage, diff --git a/src/runner/create-test-runner.js b/src/runner/create-test-runner.js index 4d72573..4dde0d4 100644 --- a/src/runner/create-test-runner.js +++ b/src/runner/create-test-runner.js @@ -13,7 +13,7 @@ import { createATDriver } from './at-driver.js'; /** * @param {object} options * @param {{hostname: string, port: number | string, pathname: string}} options.atDriverUrl - * @param {AriaATCIShared.BaseURL} options.baseUrl + * @param {URL} options.baseUrl * @param {AriaATCIHost.Log} options.log * @param {Promise} options.abortSignal * @param {AriaATCIRunner.MockOptions} [options.mock] diff --git a/src/runner/driver-test-runner.js b/src/runner/driver-test-runner.js index a50a93c..c438a1d 100644 --- a/src/runner/driver-test-runner.js +++ b/src/runner/driver-test-runner.js @@ -14,7 +14,7 @@ import { RunnerMessage } from './messages.js'; export class DriverTestRunner { /** * @param {object} options - * @param {AriaATCIShared.BaseURL} options.baseUrl + * @param {URL} options.baseUrl * @param {AriaATCIHost.Log} options.log * @param {BrowserDriver} options.browserDriver * @param {ATDriver} options.atDriver @@ -288,10 +288,8 @@ export class DriverTestRunner { } _appendBaseUrl(pathname) { - // protocol ends with a ':' and pathname starts with a '/' - const base = `${this.baseUrl.protocol}://${this.baseUrl.hostname}:${this.baseUrl.port}${this.baseUrl.pathname}`; const newPath = `${this.baseUrl.pathname ? `${this.baseUrl.pathname}/` : ''}${pathname}`; - return new URL(newPath, base); + return new URL(newPath, this.baseUrl.toString()); } } diff --git a/src/runner/mock-test-runner.js b/src/runner/mock-test-runner.js index 31254fe..d93c891 100644 --- a/src/runner/mock-test-runner.js +++ b/src/runner/mock-test-runner.js @@ -16,7 +16,7 @@ import { validateKeysFromCommand } from './driver-test-runner.js'; export class MockTestRunner { /** * @param {object} options - * @param {AriaATCIShared.BaseURL} options.baseUrl + * @param {URL} options.baseUrl * @param {AriaATCIHost.Log} options.log * @param {AriaATCIRunner.MockOptions} options.mock */ @@ -64,11 +64,10 @@ export class MockTestRunner { * @param {AriaATCIData.CollectedTest} task */ async run(task) { - const base = `${this.baseUrl.protocol}://${this.baseUrl.hostname}:${this.baseUrl.port}${this.baseUrl.pathname}`; await this.openPage( new URL( `${this.baseUrl.pathname ? `${this.baseUrl.pathname}/` : ''}${task.target.referencePage}`, - base + this.baseUrl.toString() ) );