Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calls test runner directly from host process #62

Merged
merged 19 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/host/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/runner/create-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>} options.abortSignal
* @param {AriaATCIRunner.MockOptions} [options.mock]
Expand Down
6 changes: 2 additions & 4 deletions src/runner/driver-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
ChrisC marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/runner/mock-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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()
)
);

Expand Down
Loading