2017 © Pedro Peláez
 

library appium-codeception

Codeception appium driver

image

me-io/appium-codeception

Codeception appium driver

  • Friday, February 2, 2018
  • by meabed
  • Repository
  • 34 Watchers
  • 7 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Appium Driver for Codeception

Appium driver for codeception for writing mobile tests., (*1)


Build Status ![downloads][downloads-badge] ![MIT License][license-badge] ![Donate][donate-badge], (*2)

All Contributors ![PRs Welcome][prs-badge] ![Code of Conduct][coc-badge] ![Watch on GitHub][github-watch-badge] ![Star on GitHub][github-star-badge] [Tweet][twitter], (*3)

Requirement

  1. PHP >= 7.0
  2. Appium
  3. Inspect App with Appium Desktop
  4. Devices:
    • Android
    • iOS
      • Install Xcode from the following link or run the following command inside your terminal: bash xcode-select --install
      • Install the Carthage dependency manager: bash brew install carthage

Table of Contents

Install

Just add me-io/appium-driver-codeception to your project's composer.json file:, (*4)

{
    "require": {
        "me-io/appium-driver-codeception": "~1"
    }
}

and then run composer install. This will install codeception appium driver and all it's dependencies. Or run the following command, (*5)

composer require me-io/appium-driver-codeception

Tests

Now lets run the following command at the root directory of your project:, (*6)

codecept bootstrap

This command will creates a configuration file for codeception and tests directory and default test suites., (*7)

Writing tests for Android

Now, lets create a new configuration file android.suite.yml inside tests directory and put the following contents inside of it., (*8)

class_name: AndroidGuy
modules:
  enabled:
    # Enable appium driver
    - \Appium\AppiumDriver 
    -  Asserts
  config:
    # Configuration for appium driver
    \Appium\AppiumDriver:
      host: 0.0.0.0
      port: 4723
      dummyRemote: false
      resetAfterSuite: true
      resetAfterCest: false
      resetAfterTest: false
      resetAfterStep: false
      capabilities:
        platformName: 'Android'
        deviceName: 'Android device'
        automationName: 'Appium'
        appPackage: io.selendroid.testapp
        fullReset: false
        noReset: false
        newCommandTimeout: 7200
        nativeInstrumentsLib: true
        connection_timeout: 500
        request_timeout: 500
        autoAcceptAlerts: true
        appActivity: io.selendroid.testapp.HomeScreenActivity
        skipUnlock: true

Note: deviceName should be set as Android device only for real device. For Android Emulator use the name of the virtual device., (*9)

Writing tests for iOS

Now, lets create a new configuration file ios.suite.yml inside tests directory and put the following contents inside of it., (*10)

class_name: IosGuy
modules:
  enabled:
    # Enable appium driver
    - \Appium\AppiumDriver
    -  Asserts
  config:
    # Configuration for appium driver
    \Appium\AppiumDriver:
      host: 0.0.0.0
      port: 4723
      dummyRemote: false
      resetAfterSuite: true
      resetAfterCest: false
      resetAfterTest: false
      resetAfterStep: false
      capabilities:
        # PATH OF YOUR APP (something like  /Users/username/Documents/ios.app)
        app: ''
        # xcideOrgId is Apple developer team identifier string.
        xcodeOrgId: ''
        # xcodeSigningId is a string representing a signing certificate. iPhone Developer by default.
        xcodeSigningId: 'iPhone Developer'
        platformName: 'iOS'
        platformVersion: '11.2'
        deviceName: 'iPhone8'
        # Your device udid
        udid: ''
        useNewWDA: false
        newCommandTimeout: 7200
        automationName: 'XCUITest'
        autoAcceptAlerts: true
        fullReset: false
        noReset: true
        nativeInstrumentsLib: true
        connection_timeout: 500
        request_timeout: 500
        skipUnlock: true
        clearSystemFiles: true
        showIOSLog: true

Generating Actor classes

Now we need to generate actor class for the AndroidGuy/IosGuy that we defined in android.suite.yml/ios.suite.yml. To generate the actor class for AndroidGuy/IosGuy run the following command inside your terminal:, (*11)

codecept build

Your First Android Test

To create your first android test create a new directory android inside tests folder. After creating the android folder create a new file FirstAndroidCest.php and put the following contents inside of it:, (*12)

class FirstAndroidCest
{
    public function changeLanguage(AndroidGuy $I)
    {
        $I->implicitWait([
            'ms' => 3500,
        ]);
        $text = $I->byId('id_of_button')->getText();
        $I->assertEquals('Hello, World!', $text);
    }
}

Your First iOS Test

To create your first iOS test create a new directory ios inside tests folder. After creating the ios directory create a new file FirstIosCest.php and put the following contents inside of it:, (*13)

class FirstIosCest
{
    public function lockPhone(Ios $I)
    {
        $I->implicitWait([
            'ms' => 10000,
        ]);
        $I->assertEquals('Hello, World!', 'Hello, World!');
        $I->amGoingTo("lock phone");
        $I->lock([null]);
    }
}

Running tests

Run the appium server by running the following command:, (*14)

appium

NOTE: If you want to change IP/Port run the appium command like this:, (*15)

appium -a <IP Address> -p <Port>

After running the appium server now you need to start android emulator and install the application that you want to test. If you don't know how to start the emulator you can follow the following guide Setup Genymotion Android Emulators on Mac OS , (*16)

Now run the following command inside your terminal to run the tests:, (*17)

# For Android
codecept run android FirstAndroidCest.php --steps

# For iOS
codecept run ios FirstIosCest.php --steps

Note: While following the steps that are mentioned here if you get codecept command not found error try to run codecept command like this ./vendor/bin/codecept., (*18)

Contributors

A huge thanks to all of our contributors:, (*19)

|
Mohamed Meabed

💻 📢 |
Zeeshan Ahmad

💻 🐛 ⚠️ 📖 | | :---: | :---: | , (*20)

License

The code is available under the MIT license., (*21)

The Versions

02/02 2018

dev-master

9999999-dev

Codeception appium driver

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd unit testing functional testing acceptance testing codeception appium

02/02 2018

1.0.0

1.0.0.0

Codeception appium driver

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd unit testing functional testing acceptance testing codeception appium

01/02 2018

dev-touch_actions

dev-touch_actions

Codeception appium driver

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd unit testing functional testing acceptance testing codeception appium

31/01 2018

dev-appium-codeception-cli

dev-appium-codeception-cli

Codeception appium driver

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd unit testing functional testing acceptance testing codeception appium

30/01 2018

dev-makefile

dev-makefile

Codeception appium driver

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd unit testing functional testing acceptance testing codeception appium

30/01 2018

dev-develop

dev-develop

Codeception appium driver

  Sources   Download

MIT

The Requires

 

bdd tdd unit testing functional testing acceptance testing codeception appium

27/12 2017

dev-refactor

dev-refactor

Codeception appium driver model

  Sources   Download

MIT

The Requires

 

by Mohamed Meabed

bdd tdd unit testing functional testing acceptance testing codeception appium