Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/appium3._android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:

jobs:
Android_E2E_WDIO:
if: ${{ false }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/appium3_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:

jobs:
wdio_ios:
if: ${{ false }}
runs-on: macos-26
name: WDIO iOS (Xcode 16.4)
steps:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/appium3_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: macOS WDIO Tests with Appium 3

on:
pull_request:

env:
CI: true
SHOW_XCODE_LOG: true

jobs:
wdio_ios:
runs-on: macos-26
name: WDIO iOS (Xcode 16.4)
steps:
- uses: actions/checkout@v4

- name: Install Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: '22.x'

- name: Select Xcode 16.4
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.4'

- name: List Installed Simulators
run: xcrun simctl list devices available
- name: Install jq
run: brew install jq

- run: |
version=$(grep 'appium_flutter_server:' README.md | awk '{print $2}')
ios_app="https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/$version/macos.zip"
echo "Downloading from: $ios_app"
curl -LO "$ios_app"
unzip -o macos.zip
ls -l
echo "APP_PATH=$(pwd)/appium_testing_app.app" >> $GITHUB_ENV
echo $APP_PATH
name: Download sample iOS app

- name: Boot simulator
run: open -Fn $APP_PATH

- run: |
npm install -g appium
npm install --no-package-lock
npm run build-flutter-by-service
npm run build
appium driver list
name: Install Appium and deps
- run: |
APP_PATH=$APP_PATH npm run wdio-mac
name: Run WDIO macOS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { browser, expect } from '@wdio/globals';
import path from "path";

async function performLogin(userName = 'admin', password = '1234') {
await browser.takeScreenshot();
// await browser.takeScreenshot();
const att = await browser.flutterByValueKey$('username_text_field');
console.log(await att.getAttribute('all'));
await browser.flutterByValueKey$('username_text_field').clearValue();
Expand Down
19 changes: 19 additions & 0 deletions mac.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ts-nocheck
import { config as baseConfig } from './wdio.conf.ts';

export const config: WebdriverIO.Config = {
...baseConfig,
capabilities: [
{
// capabilities for local Appium web tests on an Android Emulator
platformName: 'mac',
'appium:automationName': 'FlutterIntegration',
'appium:orientation': 'PORTRAIT',
'appium:app': process.env.APP_PATH,
'appium:bundleId': "com.example.appiumTestingApp",
'appium:newCommandTimeout': 240,
'appium:flutterServerLaunchTimeout': 25000,
'appium:flutterEnableMockCamera': true
},
],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"reinstall-driver": "(appium driver uninstall flutter-integration || exit 0) && npm run install-driver",
"wdio-android": "wdio run ./android.conf.ts",
"wdio-ios": "wdio run ./ios.conf.ts",
"wdio-mac": "wdio run ./mac.conf.ts",
"build-flutter-by-service": "cd ./flutter-finder/wdio-flutter-by-service && npm install --no-package-lock && npm run build"
},
"devDependencies": {
Expand All @@ -73,6 +74,7 @@
"@wdio/spec-reporter": "^9.19.2",
"@wdio/types": "9.19.2",
"@wdio/utils": "^9.19.2",
"appium-mac2-driver": "^3.0.0",
"chai": "^5.1.1",
"chai-as-promised": "^8.0.0",
"conventional-changelog-conventionalcommits": "^8.0.0",
Expand All @@ -99,7 +101,6 @@
"appium-ios-device": "^3.0.0",
"appium-uiautomator2-driver": "^5.0.0",
"appium-xcuitest-driver": "^10.0.0",
"appium-mac2-driver": "^3.0.0",
"async-retry": "^1.3.3",
"asyncbox": "^3.0.0",
"bluebird": "^3.7.2",
Expand Down
38 changes: 20 additions & 18 deletions src/driver.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
import { desiredCapConstraints } from './desiredCaps';
import { JWProxy, BaseDriver } from '@appium/base-driver';
import { BaseDriver, JWProxy } from '@appium/base-driver';
import type {
DefaultCreateSessionResult,
DriverCaps,
DriverData,
W3CDriverCaps,
DriverCaps,
} from '@appium/types';
import { desiredCapConstraints } from './desiredCaps';
type FlutterDriverConstraints = typeof desiredCapConstraints;
// @ts-ignore
import { XCUITestDriver } from 'appium-xcuitest-driver';
import { AndroidUiautomator2Driver } from 'appium-uiautomator2-driver';
import { XCUITestDriver } from 'appium-xcuitest-driver';
// @ts-ignore
import { Mac2Driver } from 'appium-mac2-driver';
import { createSession as createSessionMixin } from './session';
import { logger, util } from 'appium/support';
import _ from 'lodash';
import { androidPortForward, androidRemovePortForward } from './android';
import {
findElOrEls,
clear,
click,
getText,
ELEMENT_CACHE,
elementDisplayed,
getAttribute,
elementEnabled,
setValue,
clear,
ELEMENT_CACHE,
findElOrEls,
getAttribute,
getElementRect,
getText,
setValue,
constructFindElementPayload,
} from './commands/element';
import { iosPortForward, iosRemovePortForward } from './iOS';
import { createSession as createSessionMixin } from './session';
import type { PortForwardCallback, PortReleaseCallback } from './types';
import {
attachAppLaunchArguments,
fetchFlutterServerPort,
Expand All @@ -34,11 +39,6 @@ import {
isFlutterDriverCommand,
waitForFlutterServerToBeActive,
} from './utils';
import { logger, util } from 'appium/support';
import { androidPortForward, androidRemovePortForward } from './android';
import { iosPortForward, iosRemovePortForward } from './iOS';
import type { PortForwardCallback, PortReleaseCallback } from './types';
import _ from 'lodash';

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

Expand Down Expand Up @@ -289,14 +289,16 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
caps,
...JSON.parse(JSON.stringify(args)),
);
console.info(`proxydriver: ${JSON.stringify(this.proxydriver)}`);
const packageName =
this.proxydriver instanceof AndroidUiautomator2Driver
? this.proxydriver.opts.appPackage!
: this.proxydriver.opts.bundleId!;

const isIosSimulator =
this.proxydriver instanceof XCUITestDriver &&
!this.proxydriver.isRealDevice();
(this.proxydriver instanceof XCUITestDriver &&
!this.proxydriver.isRealDevice()) ||
this.proxydriver instanceof Mac2Driver;

const portcallbacks: {
portForwardCallback?: PortForwardCallback;
Expand Down
4 changes: 2 additions & 2 deletions test/specs/test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { browser, expect } from '@wdio/globals';
import path from 'path';

async function performLogin(userName = 'admin', password = '1234') {
await browser.takeScreenshot();
// await browser.takeScreenshot();
const att = await browser.flutterByValueKey$('username_text_field');
console.log(await att.getAttribute('all'));
await browser.flutterByValueKey$('username_text_field').clearValue();
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('My Login application', () => {
await handleAppManagement();
});

it('Create Session with Flutter Integration Driver', async () => {
it.only('Create Session with Flutter Integration Driver', async () => {
await performLogin();
await openScreen('Double Tap');
const element = await browser
Expand Down
Loading