Skip to content

Commit

Permalink
Try to have tests work again in v8
Browse files Browse the repository at this point in the history
  • Loading branch information
vbfox committed Sep 9, 2024
1 parent b451f57 commit 488073a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/v8TypesAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Options } from '@wdio/types';

/** Adapter to allow capabilities field for tests that should be compatible between WebDriverIO v8 and v9 */
export type TestRunnerOptionsForTests = Options.Testrunner & { capabilities?: object };
export type TestRunnerOptionsForTests = Options.Testrunner & { capabilities: object };
30 changes: 15 additions & 15 deletions src/launcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('onPrepare', () => {
it('defaults are as expected for array of capabilities', async () => {
const service = new WaldoWdioLauncherService({});
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{ 'appium:app': 'appv-12345', ...PRODUCTION_CONNECTION, 'waldo:options': {} },
Expand All @@ -36,7 +36,7 @@ describe('onPrepare', () => {
firstMatch: [{ platformName: 'macos' }, { platformName: 'linux' }],
},
];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -55,7 +55,7 @@ describe('onPrepare', () => {
it('can be specified as an option', async () => {
const service = new WaldoWdioLauncherService({ environment: 'staging' });
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{ 'appium:app': 'appv-12345', ...STAGING_CONNECTION, 'waldo:options': {} },
Expand All @@ -67,7 +67,7 @@ describe('onPrepare', () => {
vi.stubEnv('WALDO_ENVIRONMENT', 'staging');
const service = new WaldoWdioLauncherService({ environment: 'production' });
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{ 'appium:app': 'appv-12345', ...STAGING_CONNECTION, 'waldo:options': {} },
Expand All @@ -81,7 +81,7 @@ describe('onPrepare', () => {
await writeTestProfile('user_token: profile-token');
const service = new WaldoWdioLauncherService({});
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -102,7 +102,7 @@ describe('onPrepare', () => {

const service = new WaldoWdioLauncherService({});
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = { key: 'runner-token' };
const config: TestRunnerOptionsForTests = { capabilities: {}, key: 'runner-token' };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -124,7 +124,7 @@ describe('onPrepare', () => {

const service = new WaldoWdioLauncherService({ token: 'service-token' });
const remoteCapabilities: TestrunnerCapabilities = [{ 'appium:app': 'appv-12345' }];
const config: TestRunnerOptionsForTests = { key: 'runner-token' };
const config: TestRunnerOptionsForTests = { capabilities: {}, key: 'runner-token' };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -148,7 +148,7 @@ describe('onPrepare', () => {
const remoteCapabilities: TestrunnerCapabilities = [
{ 'appium:app': 'appv-12345', key: 'cap-key-token' },
];
const config: TestRunnerOptionsForTests = { key: 'runner-token' };
const config: TestRunnerOptionsForTests = { capabilities: {}, key: 'runner-token' };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('onPrepare', () => {
'waldo:options': { token: 'cap-waldo-token' },
},
];
const config: TestRunnerOptionsForTests = { key: 'runner-token' };
const config: TestRunnerOptionsForTests = { capabilities: {}, key: 'runner-token' };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand Down Expand Up @@ -205,7 +205,7 @@ describe('onPrepare', () => {
'waldo:options': { token: 'cap-waldo-token' },
},
];
const config: TestRunnerOptionsForTests = { key: 'runner-token' };
const config: TestRunnerOptionsForTests = { capabilities: {}, key: 'runner-token' };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -227,7 +227,7 @@ describe('onPrepare', () => {
it("can be specified in service options 'versionId'", async () => {
const service = new WaldoWdioLauncherService({ versionId: 'service-versionId' });
const remoteCapabilities: TestrunnerCapabilities = [{}];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -243,7 +243,7 @@ describe('onPrepare', () => {
const remoteCapabilities: TestrunnerCapabilities = [
{ 'appium:app': 'cap-appium-versionId' },
];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -262,7 +262,7 @@ describe('onPrepare', () => {
'waldo:options': { versionId: 'cap-waldo-versionId' },
},
];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -282,7 +282,7 @@ describe('onPrepare', () => {
'waldo:options': { versionId: 'cap-waldo-versionId' },
},
];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand All @@ -303,7 +303,7 @@ describe('onPrepare', () => {
'waldo:options': { versionId: 'cap-waldo-versionId' },
},
];
const config: TestRunnerOptionsForTests = {};
const config: TestRunnerOptionsForTests = { capabilities: {} };
await service.onPrepare(config, remoteCapabilities);
expect(remoteCapabilities).toEqual([
{
Expand Down

0 comments on commit 488073a

Please sign in to comment.