Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions packages/contracts/src/dispatch-disclosure.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export const DISPATCH_DISCLOSURE_DRIVER_OWNERS: Readonly<Record<string, string>>
'packages/platform-apple/src/runner/__tests__/runner-lifecycle-dispatch-disclosure.test.ts',
'ios-runner.transport.':
'packages/platform-apple/src/runner/__tests__/runner-lifecycle-dispatch-disclosure.test.ts',
'android-adb.': 'packages/platform-android/src/__tests__/dispatch-disclosure.test.ts',
'android-helper.': 'packages/platform-android/src/__tests__/dispatch-disclosure.test.ts',
'android-adb.': 'packages/platform-android/src/__tests__/index-dispatch-disclosure.test.ts',
'android-helper.': 'packages/platform-android/src/__tests__/index-dispatch-disclosure.test.ts',
'android-helper.gesture-session.':
'packages/platform-android/src/__tests__/touch-helper-session.test.ts',
'webdriver.': 'packages/provider-webdriver/src/webdriver-transport.test.ts',
'webdriver.orientation.': 'packages/provider-webdriver/src/webdriver-orientation.test.ts',
'web-agent-browser.':
'packages/platform-web/src/__tests__/agent-browser-dispatch-disclosure.test.ts',
'packages/platform-web/src/__tests__/agent-browser-provider-dispatch-disclosure.test.ts',
'maestro-direct.':
'src/__tests__/daemon-composition/interaction/interaction-touch-direct-ios.test.ts',
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import { test } from 'vitest';
import type { DeviceInfo } from '@agent-device/kernel/device';
import { vegaPlugin } from '@agent-device/platform-vega';
import { vegaPlugin } from './index.ts';

const VEGA_VVD = {
platform: 'vega',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// produce one for a current provider argv, that row's driver says so.
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { test, vi } from 'vitest';
import { test } from 'vitest';
import {
assertDispatchDisclosureDriversMatchRows,
DISPATCH_DISCLOSURE_TABLE_PATH,
Expand All @@ -18,19 +18,6 @@ import {
mkdtempForTestSync,
withManagedAgentBrowserProvider,
} from './test-utils.ts';

const { providerStartupCleanupMock } = vi.hoisted(() => ({
providerStartupCleanupMock: vi.fn(async () => undefined),
}));

vi.mock('../agent-browser-lifecycle.ts', async (importOriginal) => {
const actual = await importOriginal<typeof import('../agent-browser-lifecycle.ts')>();
return {
...actual,
cleanupManagedAgentBrowserOrphansForProviderStartup: providerStartupCleanupMock,
};
});

import { createAgentBrowserWebProvider } from '../agent-browser-provider.ts';
import type { WebProvider } from '../provider.ts';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { test } from 'vitest';
import assert from 'node:assert/strict';
import { AWS_DEVICE_FARM_PROFILE_FIELDS } from './aws-device-farm.ts';
import { consumedProfileFields } from './profile-fields.fixtures.ts';

test('AWS Device Farm consumes only its own fields and the session name', () => {
assert.deepEqual(consumedProfileFields(AWS_DEVICE_FARM_PROFILE_FIELDS), [
'awsAppArn',
'awsDeviceArn',
'awsInteractionMode',
'awsProjectArn',
'awsRegion',
'providerSessionName',
]);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test } from 'vitest';
import assert from 'node:assert/strict';
import type { ProviderProfileField } from '@agent-device/contracts/provider-profile-fields';
import { BROWSERSTACK_PROFILE_FIELDS } from './browserstack.ts';
import { BROWSERSTACK_DEVICE_FEATURE_SPECS } from './browserstack-device-features.ts';
import { consumedProfileFields } from './profile-fields.fixtures.ts';

// Fields a hub reads directly while building its session, outside the device-feature table.
const HUB_SESSION_FIELDS: readonly ProviderProfileField[] = [
'providerApp',
'providerOsVersion',
'providerProject',
'providerBuild',
'providerSessionName',
];

// A consumed device feature with no capability row would be accepted and then dropped at the hub.
test('BrowserStack consumes exactly the fields its capability builder reads', () => {
assert.deepEqual(
consumedProfileFields(BROWSERSTACK_PROFILE_FIELDS),
[...HUB_SESSION_FIELDS, ...BROWSERSTACK_DEVICE_FEATURE_SPECS.map((spec) => spec.field)].sort(),
);
});
18 changes: 18 additions & 0 deletions packages/provider-webdriver/src/index-profile-fields.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'vitest';
import assert from 'node:assert/strict';
import { BUNDLED_CLOUD_WEBDRIVER_PROVIDERS } from './index.ts';

test('every bundled runtime reads the profile fields declared under its provider id', () => {
const host = {
env: {},
clientVersion: 'test',
runHostCommand: async () => {
throw new Error('declarations need no host command');
},
};
for (const bundled of BUNDLED_CLOUD_WEBDRIVER_PROVIDERS) {
const { webDriver } = bundled.create(host);
assert.equal(webDriver.provider, bundled.declaration.provider);
assert.equal(webDriver.profileFields.provider, bundled.declaration.provider);
}
});
11 changes: 10 additions & 1 deletion packages/provider-webdriver/src/profile-fields.fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { ProviderProfileFieldDeclaration } from '@agent-device/contracts/provider-profile-fields';
import type {
ProviderProfileField,
ProviderProfileFieldDeclaration,
} from '@agent-device/contracts/provider-profile-fields';

/** A test hub that reads every profile field, so no flag is refused. */
export function consumeAllProfileFields(provider: string): ProviderProfileFieldDeclaration {
Expand Down Expand Up @@ -29,3 +32,9 @@ export function consumeAllProfileFields(provider: string): ProviderProfileFieldD
},
};
}

export function consumedProfileFields({ fields }: ProviderProfileFieldDeclaration): string[] {
return (Object.keys(fields) as ProviderProfileField[])
.filter((field) => fields[field] === 'consumed')
.sort();
}
59 changes: 0 additions & 59 deletions packages/provider-webdriver/src/provider-profile-fields.test.ts

This file was deleted.

Loading