Create the Page Objects of your Web application under pageobjects package, call those Page Objects in PHPUnit tests under tests package (Sample Page Objects, testcase included in this template)
- Make sure PHP is installed. NOTE: We have specified PHPUnit v7 in composer.json, so you need PHP 7 installed. However if your PHP version is different then you have to change the PHPUnit version in composer.json
- install composer using:
$ brew install composer
- Move to Project directory.
- Install project dependencies using command:
$ composer update
, After successfully installing this you can observe that vendor directory will be created in project root directory. - Install Standalone Selenium Jar from: https://www.seleniumhq.org/download/
- Download latest version of WebDriver binary, for example chromedriver binary from: http://chromedriver.chromium.org/
- Start Selenium server with required WebDriver binaries, for example with chromedriver binary:
$ java -Dwebdriver.chrome.driver=/path/to/chromedriver -jar /path/to//selenium-server-standalone.jar
- Check Selenium server is up and Running on: http://localhost:4444/
- Execute test cases(Mentioned on Test.php, and make sure you are at root of project directory which by default you are as you have follwed above steps):
$ ./vendor/bin/phpunit tests
By default it runs in Chrome browser, you can specify which browser to use as well like $ ./vendor/bin/phpunit tests firefox
Browsers added in this template are
- chrome
- firefox
- ie
- opera
- edge
- safari
- phantomjs
Feel free to modify it to your own needs :)