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
2 changes: 2 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ jobs:
name: Install dev dependencies
- run: npm run lint
name: Run linter
- run: npm run format:check
name: Run Prettier check
- run: npm run test
name: Run unit tests
34 changes: 20 additions & 14 deletions lib/check-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
import { fs } from '@appium/support';
import { exec } from 'teen_process';
import {fs} from '@appium/support';
import {exec} from 'teen_process';
import path from 'node:path';
import {
WDA_SCHEME, SDK_SIMULATOR, WDA_RUNNER_APP
} from './constants';
import { BOOTSTRAP_PATH } from './utils';
import type { XcodeBuild } from './xcodebuild';
import {WDA_SCHEME, SDK_SIMULATOR, WDA_RUNNER_APP} from './constants';
import {BOOTSTRAP_PATH} from './utils';
import type {XcodeBuild} from './xcodebuild';

async function buildWDASim (): Promise<void> {
async function buildWDASim(): Promise<void> {
const args = [
'-project', path.join(BOOTSTRAP_PATH, 'WebDriverAgent.xcodeproj'),
'-scheme', WDA_SCHEME,
'-sdk', SDK_SIMULATOR,
'-project',
path.join(BOOTSTRAP_PATH, 'WebDriverAgent.xcodeproj'),
'-scheme',
WDA_SCHEME,
'-sdk',
SDK_SIMULATOR,
'CODE_SIGN_IDENTITY=""',
'CODE_SIGNING_REQUIRED="NO"',
'GCC_TREAT_WARNINGS_AS_ERRORS=0',
];
await exec('xcodebuild', args);
}

export async function bundleWDASim (xcodebuild: XcodeBuild): Promise<string> {
export async function bundleWDASim(xcodebuild: XcodeBuild): Promise<string> {
const derivedDataPath = await xcodebuild.retrieveDerivedDataPath();
if (!derivedDataPath) {
throw new Error('Cannot retrieve the path to the Xcode derived data folder');
}
const wdaBundlePath = path.join(derivedDataPath, 'Build', 'Products', 'Debug-iphonesimulator', WDA_RUNNER_APP);
const wdaBundlePath = path.join(
derivedDataPath,
'Build',
'Products',
'Debug-iphonesimulator',
WDA_RUNNER_APP,
);
if (await fs.exists(wdaBundlePath)) {
return wdaBundlePath;
}
await buildWDASim();
return wdaBundlePath;
}

1 change: 0 additions & 1 deletion lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ export const SDK_SIMULATOR = 'iphonesimulator';
export const SDK_DEVICE = 'iphoneos';

export const WDA_UPGRADE_TIMESTAMP_PATH = path.join('.appium', 'webdriveragent', 'upgrade.time');

2 changes: 1 addition & 1 deletion lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { logger } from '@appium/support';
import {logger} from '@appium/support';

export const log = logger.getLogger('WebDriverAgent');
12 changes: 5 additions & 7 deletions lib/no-session-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { JWProxy } from '@appium/base-driver';
import type { ProxyOptions } from '@appium/types';

import {JWProxy} from '@appium/base-driver';
import type {ProxyOptions} from '@appium/types';

export class NoSessionProxy extends JWProxy {
constructor (opts: ProxyOptions = {}) {
constructor(opts: ProxyOptions = {}) {
super(opts);
}

override getUrlForProxy (url: string): string {
override getUrlForProxy(url: string): string {
if (url === '') {
url = '/';
}
const proxyBase = `${this.scheme}://${this.server}:${this.port}${this.base}`;
let remainingUrl = '';
if ((new RegExp('^/')).test(url)) {
if (new RegExp('^/').test(url)) {
remainingUrl = url;
} else {
throw new Error(`Did not know what to do with url '${url}'`);
Expand All @@ -22,4 +21,3 @@ export class NoSessionProxy extends JWProxy {
return proxyBase + remainingUrl;
}
}

7 changes: 6 additions & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export interface WDASettings {
defaultAlertAction?: 'accept' | 'dismiss';
acceptAlertButtonSelector?: string;
dismissAlertButtonSelector?: string;
screenshotOrientation?: 'auto' | 'portrait' | 'portraitUpsideDown' | 'landscapeRight' | 'landscapeLeft'
screenshotOrientation?:
| 'auto'
| 'portrait'
| 'portraitUpsideDown'
| 'landscapeRight'
| 'landscapeLeft';
waitForIdleTimeout?: number;
animationCoolOffTimeout?: number;
maxTypingFrequency?: number;
Expand Down
Loading
Loading