Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 3.14 KB

webdriver.md

File metadata and controls

66 lines (45 loc) · 3.14 KB
group title
functional-testing-framework-guide
Web Driver Replacement in the Functional Testing Framework

Overview

The Functional Testing Framework (FTF) enables you to change a web driver {% glossarytooltip 08968dbb-2eeb-45c7-ae95-ffca228a7575 %}library{% endglossarytooltip %} 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

{: .bs-callout .bs-callout-info } You still need to [run the Selenium Server]({{ page.baseurl }}/mtf/mtf_quickstart/mtf_quickstart_environment.html#mtf_quickstart_env_selenium) 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

{: .bs-callout .bs-callout-info } You still need to [run the Selenium Server]({{ page.baseurl }}/mtf/mtf_quickstart/mtf_quickstart_environment.html#mtf_quickstart_env_selenium) in order to run the tests, because at this point the test run procedure is not yet changed.