1.0.3 • Published 3 years ago

flutter-appium-node v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

flutter-appium-node

[NPM - Latest Version]

flutter-appium-node is a library that helps to find the flutter elements present on the flutter app build, and later any action can be perfomed on that element using the webdriverIo driver. This library helps user to create an automation framework using node, Appium and WebdriverIo for Flutter application.

Quick start in-depth Documentation will be published soon

Assuming you have an existing Appium setup using WebdriverIO:

  • Install the flutter-appium-node package: npm i -D flutter-appium-node
  • Use require function to use the package: require('flutter-appium-node');
  • Call any finder function in your tests (for example): byText("Next")

index.js

const wdio = require('webdriverio');
const { byText } = require('flutter-appium-node');
  
  const opts = {
    port: 4723,
    path: '/wd/hub',
    capabilities: {
        platformName: 'Android',
        deviceName: '',
        // Add your flutter apk build path here and make sure to 
        // enable the flutter driver extension by calling this 
        // enableFlutterDriverExtension() function before runApp()
        app: __dirname +  '/flutterApp.apk',
        automationName: 'Flutter'
    }
  };
  
function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
}

(async () => {
    const nextButton = byText("Next");
    const driver = await wdio.remote(opts);
    await driver.switchContext('FLUTTER');
    await sleep(7000);
    await driver.elementClick(nextButton);
    await sleep(10000);
    driver.deleteSession();
})();