Skip to content

Commit e3f3120

Browse files
saikrishna321SrinivasanTarget
authored andcommitted
Added Initial ci for mac apps
Co-authored-by: SrinivasanTarget <srinivasan.sekar1990@gmail.com>
1 parent 57a2b39 commit e3f3120

File tree

6 files changed

+94
-19
lines changed

6 files changed

+94
-19
lines changed

.github/workflows/appium3._android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88

99
jobs:
1010
Android_E2E_WDIO:
11+
if: ${{ false }}
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:

.github/workflows/appium3_ios.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010

1111
jobs:
1212
wdio_ios:
13+
if: ${{ false }}
1314
runs-on: macos-26
1415
name: WDIO iOS (Xcode 16.4)
1516
steps:
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: macOS WDIO Tests with Appium 3
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
CI: true
8+
SHOW_XCODE_LOG: true
9+
10+
jobs:
11+
wdio_ios:
12+
runs-on: macos-26
13+
name: WDIO iOS (Xcode 16.4)
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install Node.js 22.x
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '22.x'
21+
22+
- name: Select Xcode 16.4
23+
uses: maxim-lobanov/setup-xcode@v1
24+
with:
25+
xcode-version: '16.4'
26+
27+
- name: List Installed Simulators
28+
run: xcrun simctl list devices available
29+
- name: Install jq
30+
run: brew install jq
31+
32+
- run: |
33+
version=$(grep 'appium_flutter_server:' README.md | awk '{print $2}')
34+
ios_app="https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/$version/macos.zip"
35+
echo "Downloading from: $ios_app"
36+
curl -LO "$ios_app"
37+
unzip -o macos.zip
38+
ls -l
39+
echo "APP_PATH=$(pwd)/appium_testing_app.app" >> $GITHUB_ENV
40+
echo $APP_PATH
41+
name: Download sample iOS app
42+
43+
- name: Boot simulator
44+
run: open -Fn $APP_PATH
45+
46+
- run: |
47+
npm install -g appium
48+
npm install --no-package-lock
49+
npm run build-flutter-by-service
50+
npm run build
51+
name: Install Appium and deps

mac.conf.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ts-nocheck
2+
import { config as baseConfig } from './wdio.conf.ts';
3+
4+
export const config: WebdriverIO.Config = {
5+
...baseConfig,
6+
capabilities: [
7+
{
8+
// capabilities for local Appium web tests on an Android Emulator
9+
platformName: 'mac',
10+
'appium:automationName': 'FlutterIntegration',
11+
'appium:orientation': 'PORTRAIT',
12+
'appium:app': "/Users/saikrishna/Documents/git/appium-flutter-server/demo-app/build/macos/Build/Products/Debug/appium_testing_app.app",
13+
'appium:bundleId': "com.example.appiumTestingApp",
14+
'appium:newCommandTimeout': 240,
15+
'appium:flutterServerLaunchTimeout': 25000,
16+
'appium:flutterEnableMockCamera': true
17+
},
18+
],
19+
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"reinstall-driver": "(appium driver uninstall flutter-integration || exit 0) && npm run install-driver",
5050
"wdio-android": "wdio run ./android.conf.ts",
5151
"wdio-ios": "wdio run ./ios.conf.ts",
52+
"wdio-mac": "wdio run ./mac.conf.ts",
5253
"build-flutter-by-service": "cd ./flutter-finder/wdio-flutter-by-service && npm install --no-package-lock && npm run build"
5354
},
5455
"devDependencies": {
@@ -73,6 +74,7 @@
7374
"@wdio/spec-reporter": "^9.19.2",
7475
"@wdio/types": "9.19.2",
7576
"@wdio/utils": "^9.19.2",
77+
"appium-mac2-driver": "^3.0.0",
7678
"chai": "^5.1.1",
7779
"chai-as-promised": "^8.0.0",
7880
"conventional-changelog-conventionalcommits": "^8.0.0",
@@ -99,7 +101,6 @@
99101
"appium-ios-device": "^3.0.0",
100102
"appium-uiautomator2-driver": "^5.0.0",
101103
"appium-xcuitest-driver": "^10.0.0",
102-
"appium-mac2-driver": "^3.0.0",
103104
"async-retry": "^1.3.3",
104105
"asyncbox": "^3.0.0",
105106
"bluebird": "^3.7.2",

src/driver.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
import { desiredCapConstraints } from './desiredCaps';
2-
import { JWProxy, BaseDriver } from '@appium/base-driver';
1+
import { BaseDriver, JWProxy } from '@appium/base-driver';
32
import type {
43
DefaultCreateSessionResult,
4+
DriverCaps,
55
DriverData,
66
W3CDriverCaps,
7-
DriverCaps,
87
} from '@appium/types';
8+
import { desiredCapConstraints } from './desiredCaps';
99
type FlutterDriverConstraints = typeof desiredCapConstraints;
1010
// @ts-ignore
11-
import { XCUITestDriver } from 'appium-xcuitest-driver';
1211
import { AndroidUiautomator2Driver } from 'appium-uiautomator2-driver';
12+
import { XCUITestDriver } from 'appium-xcuitest-driver';
1313
// @ts-ignore
1414
import { Mac2Driver } from 'appium-mac2-driver';
15-
import { createSession as createSessionMixin } from './session';
15+
import { logger, util } from 'appium/support';
16+
import _ from 'lodash';
17+
import { androidPortForward, androidRemovePortForward } from './android';
1618
import {
17-
findElOrEls,
19+
clear,
1820
click,
19-
getText,
21+
ELEMENT_CACHE,
2022
elementDisplayed,
21-
getAttribute,
2223
elementEnabled,
23-
setValue,
24-
clear,
25-
ELEMENT_CACHE,
24+
findElOrEls,
25+
getAttribute,
2626
getElementRect,
27+
getText,
28+
setValue,
2729
constructFindElementPayload,
2830
} from './commands/element';
31+
import { iosPortForward, iosRemovePortForward } from './iOS';
32+
import { createSession as createSessionMixin } from './session';
33+
import type { PortForwardCallback, PortReleaseCallback } from './types';
2934
import {
3035
attachAppLaunchArguments,
3136
fetchFlutterServerPort,
@@ -34,11 +39,6 @@ import {
3439
isFlutterDriverCommand,
3540
waitForFlutterServerToBeActive,
3641
} from './utils';
37-
import { logger, util } from 'appium/support';
38-
import { androidPortForward, androidRemovePortForward } from './android';
39-
import { iosPortForward, iosRemovePortForward } from './iOS';
40-
import type { PortForwardCallback, PortReleaseCallback } from './types';
41-
import _ from 'lodash';
4242

4343
import type { RouteMatcher } from '@appium/types';
4444

@@ -289,14 +289,16 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
289289
caps,
290290
...JSON.parse(JSON.stringify(args)),
291291
);
292+
console.info(`proxydriver: ${JSON.stringify(this.proxydriver)}`);
292293
const packageName =
293294
this.proxydriver instanceof AndroidUiautomator2Driver
294295
? this.proxydriver.opts.appPackage!
295296
: this.proxydriver.opts.bundleId!;
296297

297298
const isIosSimulator =
298-
this.proxydriver instanceof XCUITestDriver &&
299-
!this.proxydriver.isRealDevice();
299+
(this.proxydriver instanceof XCUITestDriver &&
300+
!this.proxydriver.isRealDevice()) ||
301+
this.proxydriver instanceof Mac2Driver;
300302

301303
const portcallbacks: {
302304
portForwardCallback?: PortForwardCallback;

0 commit comments

Comments
 (0)