Automation test work, for upitech. Using Codeception - BDD-styled PHP testing framework. More info about framework can be found here - https://codeception.com/ .
These instructions will get you a copy of the project up and running on your local machine for testing purposes.
Download and install following:
- Install php - http://www.php.net/
- Install composer (Dependency Manager for PHP) - https://getcomposer.org/
- In order to run Selenium Server install Java - https://www.java.com
- Download latest Selenium Standalone Server - https://www.seleniumhq.org/download/
- Download latest ChromeDriver - https://sites.google.com/a/chromium.org/chromedriver/downloads
- Download latest GeckoDriver - https://github.com/mozilla/geckodriver/releases
Next steps that you need to do before run test:
- From terminal go to project folder.
- From terminal run
composer install,this should add all needed dependencies to the project. - Open with any coding editor file
RemoteWebDriver.php, which should be located in project directoryvendor/facebook/webdriver/lib/Remote - On lines 190 and 210 from change variable:
$raw_element['ELEMENT'], to this:$raw_element['ELEMENT'] ?? $raw_element[\key($raw_element)]as in given examplehttps://github.com/facebook/php-webdriver/pull/575/commits/0357dc2497e0611accd46748cf0ee6120127cce6(Mozilla firefox geckodriver fix), dont forget to save it. This is needed in order to make test work with firefox, more details can be found here - php-webdriver/php-webdriver#469 - Put ChromeDriver, GeckoDriver and Selenium Standalone Server in project folder
How to run the automation test:
- Form terminal go to directory where Selenium Standalone Server
located, and start it like this
java -jar selenium-server-standalone-3.14.59.jar - From different terminal go to project directory
and start test
vendor/bin/codecept run --env chrome --env firefox --debug --html
Test doing following:
- User navigates to www.google.com website
- User types „Opus Online“ into searchbox
- Press Enter button
- Waits until Opus Online company overview block being displayed on the right.
- Checks that Block has correct:
- Company name
- Address
- Phone number
- Website button
- Click on Website button
- Checks that slogan present in opened company website
Test developed in a way that it should have:
- Multiple browsers support, can be specified by
--env chromeor/and--env firefox - Page Object Pattern
- Readable test report, can be specified by
--html. When test will finish its execution, then report can be found heretests/_output/report.html
Test missing:
- Tests missing parallel execution. It can be achieved by using docker solution, as described here - https://codeception.com/docs/12-ParallelExecution. Another option would be to use service as - https://www.browserstack.com/automate/codeception.
Test itself located tests/acceptance/UpiTech/opusOnlineCest.php
, classes that extend it located tests/_support/Page/UpiTech.
Configuration file located tests/acceptance.suite.yml.