Closed herby-naidz closed 1 day ago
@herby-naidz Can you please provide a reproducible sample project?
Hi @saikrishna321
Do you need the apk in the project?
No sample wdio project to replicate this problem? Are you using the latest wdio-flutter-service?
Yes, I believe it is the latest version that I am using.
Here's the package.json contents:
{ "name": "wdio_fluter_integration_driver", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "wdio": "wdio run ./wdio.conf.js" }, "keywords": [], "author": "", "license": "ISC", "description": "", "devDependencies": { "@wdio/cli": "^9.0.7", "@wdio/appium-service": "^9.0.1", "@wdio/local-runner": "^9.0.1", "@wdio/mocha-framework": "^9.0.0", "@wdio/spec-reporter": "^9.0.0", "appium": "^2.11.3", "appium-flutter-integration-driver": "^1.1.3", "appium-uiautomator2-driver": "^3.7.7", "ts-node": "^10.9.2", "typescript": "^5.5.4", "wdio-flutter-by-service": "^1.0.13" } }
And this is the spec file:
const { expect, browser, $ } = require('@wdio/globals') const { FlutterIntegrationDriverService } = require('wdio-flutter-by-service')
describe('Open app', () => { it('Open app', async () => { await driver.flutterByText$().click(); }) })
Capabilities in the wdio.conf.js file:
capabilities: [{
// capabilities for local Appium web tests on an Android Emulator
platformName: 'Android',
'appium:deviceName': 'Pixel 6',
'appium:platformVersion': '14',
'appium:automationName': 'FlutterIntegration',
'appium:app': path.join(process.cwd(), 'app/app-debug.apk')
}],
There was another error I missed which I believe was the real issue:
Error: ReferenceError: require is not defined in ES module scope, you can use import instead
In my spec file I changed const { FlutterIntergrationDriverService } = require('wdio-flutter-by-service');
to import FlutterIntegrationDriverService from "wdio-flutter-by-service";
and I think this solved the problem.
Unrelated to this there was something else I missed. I did not realise I needed to add 'flutter-by' to the services array in the wdio.conf file.
Hi
I am trying to use appium-flutter-integration-driver in a WebdriverIO project. I am testing the "test-drive" counter Flutter app on an android emulator. I have prepared the app according to instructions and built the debug apk. When I run wdio run ./wdio.conf.js the app does not load. It looks like it is about to, but all I see is the Flutter logo (splash screen) and then it disappears again.
The error I get in the terminal is:
WARN @wdio/mocha-framework: Unable to load spec files quite likely because they rely on (C:\Users............\project_name\test\specs\test.e2e.js:3:46)
[0-0] RUNNING in Android - file:///C:/Users/.../.../.../.../project_name/test/specs/test.e2e.js
browser
object that is not fully initialized. [0-0]browser
object has onlycapabilities
and some flags likeisMobile
. [0-0] Helper files that use otherbrowser
commands have to be moved tobefore
hook. [0-0] Spec file(s): file:///C:/Users/.../.../.../.../project_name/test/specs/test.e2e.js [0-0] Error: Error: No "exports" main defined in C:\Users............\project_name\node_modules\wdio-flutter-by-service\package.json [0-0] at exportsNotFound (node:internal/modules/esm/resolve:304:10) [0-0] at packageExportsResolve (node:internal/modules/esm/resolve:594:13) [0-0] at resolveExports (node:internal/modules/cjs/loader:592:36) [0-0] at Function.Module._findPath (node:internal/modules/cjs/loader:669:31) [0-0] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1131:27) [0-0] at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users............\project_name\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30) [0-0] at Function.Module._load (node:internal/modules/cjs/loader:986:27) [0-0] at Module.require (node:internal/modules/cjs/loader:1233:19) [0-0] at require (node:internal/modules/helpers:179:18) [0-0] at Object.It looks like the issue is related to wdio-flutter-by-service, but I cannot figure out how to fix it.
I do want to mention that when I built the apk the gradle command did not work for me. I selected the file in VS Code and clicked Start Debugging to build the apk.