Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 3.23 KB

webdriver.md

File metadata and controls

65 lines (44 loc) · 3.23 KB
layout group subgroup title menu_title version github_link
default
mtf-guide
45_Features
Web Driver Replacement in the Functional Testing Framework
Web driver replacement
2.0
mtf/features/webdriver.md

Overview

The Functional Testing Framework (FTF) enables you to change a web driver library used for communication with Selenium Server, PhantomJS or any other web page automation tool.

Web drivers provided with the FTF are the following:

Both implement the DriverInterface.php interface. The interface declares methods that are used in web page automation such as click(), isVisible(), setValue(), dragAndDrop() etc.

To use a custom web driver, you must implement the DriverInterface.php interface.

Use provided in the FTF web drivers as examples.

Set up the Facebook web driver {#ftf-facebook-driver-install}

To set up the Facebook web driver, use the following steps:

  1. In <magento2_root_dir>/dev/tests/functional/etc/di.xml, add the <preference for="Magento\Mtf\Client\DriverInterface" type="Magento\Mtf\Client\Driver\Facebook\Driver" /> element.

  2. In <magento2_root_dir>/dev/tests/functional/composer.json, move the "facebook/webdriver": "dev-master" entry from the "suggest" list to the "require" list.

  3. Run in your terminal:

     cd <magento2_root_dir>/dev/tests/functional
     composer update
    
  

You still need to run the Selenium Server in order to run the tests, because at this point the test run procedure is not yet changed.

Add and setup a custom web driver

To add a custom web driver, you must implement the DriverInterface.php interface.

  1. Create the <magento2_root_dir>/dev/tests/functional/lib/Magento/Mtf/Client/Driver/<Your_driver> directory.
  2. In the directory, create the Driver.php class which implements DriverInterface.php.

To setup the custom web driver, follow:

  1. In <magento2_root_dir>/dev/tests/functional/etc/di.xml, add the <preference for="Magento\Mtf\Client\DriverInterface" type="Magento\Mtf\Client\Driver\<Your_driver>\Driver" /> element.

  2. In <magento2_root_dir>/dev/tests/functional/composer.json, add corresponding entry to the "require" list (if related module is available on Packagist). And run in your terminal:

     cd <magento2_root_dir>/dev/tests/functional
     composer update
    
  

You still need to run the Selenium Server in order to run the tests, because at this point the test run procedure is not yet changed.