diff --git a/.github/workflows/appium3._android.yml b/.github/workflows/appium3._android.yml index 61f0535..7860c8c 100644 --- a/.github/workflows/appium3._android.yml +++ b/.github/workflows/appium3._android.yml @@ -8,6 +8,7 @@ env: jobs: Android_E2E_WDIO: + if: ${{ false }} runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/appium3_ios.yml b/.github/workflows/appium3_ios.yml index f9cc41c..ec2c20b 100644 --- a/.github/workflows/appium3_ios.yml +++ b/.github/workflows/appium3_ios.yml @@ -10,6 +10,7 @@ env: jobs: wdio_ios: + if: ${{ false }} runs-on: macos-26 name: WDIO iOS (Xcode 16.4) steps: diff --git a/.github/workflows/appium3_macos.yml b/.github/workflows/appium3_macos.yml new file mode 100644 index 0000000..5ee446e --- /dev/null +++ b/.github/workflows/appium3_macos.yml @@ -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 \ No newline at end of file diff --git a/flutter-finder/wdio-flutter-by-service/test_remove/specs/test.e2e.js b/flutter-finder/wdio-flutter-by-service/test_remove/specs/test.e2e.js index 3f116da..1a11d9a 100644 --- a/flutter-finder/wdio-flutter-by-service/test_remove/specs/test.e2e.js +++ b/flutter-finder/wdio-flutter-by-service/test_remove/specs/test.e2e.js @@ -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(); diff --git a/mac.conf.ts b/mac.conf.ts new file mode 100644 index 0000000..907083f --- /dev/null +++ b/mac.conf.ts @@ -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 + }, + ], +}; diff --git a/package.json b/package.json index 94173ae..fdfa409 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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", @@ -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", diff --git a/src/driver.ts b/src/driver.ts index 5197d7e..188484d 100644 --- a/src/driver.ts +++ b/src/driver.ts @@ -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, @@ -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'; @@ -289,14 +289,16 @@ export class AppiumFlutterDriver extends BaseDriver { 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; diff --git a/test/specs/test.e2e.js b/test/specs/test.e2e.js index aa95e5f..49b8a14 100644 --- a/test/specs/test.e2e.js +++ b/test/specs/test.e2e.js @@ -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(); @@ -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