From 95a93b1df8982ceb48c8ac2b8ab9684afa506572 Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Sun, 8 Feb 2015 19:26:49 +0100 Subject: [PATCH 1/6] Basic skeleton with tests --- .gitignore | 1 + Features/bootstrap/MainContext.php | 40 + Features/login.feature | 16 + Fixtures/account.html | 35 + Fixtures/additional.css | 7 + Fixtures/index.html | 52 + Fixtures/login.php | 23 + LICENSE | 0 README.md | 0 behat.yml | 18 + composer.json | 27 + composer.lock | 1091 +++++++++++++++++++++ src/QATools/Example/Pages/AccountPage.php | 25 + src/QATools/Example/Pages/LoginPage.php | 75 ++ 14 files changed, 1410 insertions(+) mode change 100644 => 100755 .gitignore create mode 100755 Features/bootstrap/MainContext.php create mode 100755 Features/login.feature create mode 100755 Fixtures/account.html create mode 100755 Fixtures/additional.css create mode 100755 Fixtures/index.html create mode 100755 Fixtures/login.php mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md create mode 100755 behat.yml create mode 100755 composer.json create mode 100755 composer.lock create mode 100755 src/QATools/Example/Pages/AccountPage.php create mode 100755 src/QATools/Example/Pages/LoginPage.php diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 16cb7d6..b511f03 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea bin vendor +composer.lock \ No newline at end of file diff --git a/Features/bootstrap/MainContext.php b/Features/bootstrap/MainContext.php new file mode 100755 index 0000000..c0474aa --- /dev/null +++ b/Features/bootstrap/MainContext.php @@ -0,0 +1,40 @@ +page->fillForm($username, $password); + } + + /** + * @Then /^the login should fail$/ + */ + public function loginFail() + { + $this->page = $this->page->loginFailure(); + } + + /** + * @Then /^the login should succeed/ + */ + public function loginSucceed() + { + $this->page = $this->page->loginSuccess(); + } + + /** + * @Given /^the user waits for ([0-9]+) seconds$/ + */ + public function waitFor($seconds) + { + sleep($seconds); + } + +} diff --git a/Features/login.feature b/Features/login.feature new file mode 100755 index 0000000..06250e3 --- /dev/null +++ b/Features/login.feature @@ -0,0 +1,16 @@ +Feature: Login + In order to use the website site + As a website user + I need to login successfully + + @javascript @login @failing-login + Scenario: Failing login due wrong password + Given the user visits the "Login Page" + When the user enters user and invalidpassword + And the login should fail + + @javascript @login @successful-login + Scenario: Successful login of user + Given the user visits the "Login Page" + When the user enters user and validpassword + And the login should succeed \ No newline at end of file diff --git a/Fixtures/account.html b/Fixtures/account.html new file mode 100755 index 0000000..b83c13c --- /dev/null +++ b/Fixtures/account.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +
+
+

Caption Column 1

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum + dolor sit amet. +
+
+

Caption Column 2

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum + dolor sit amet. +
+
+ + \ No newline at end of file diff --git a/Fixtures/additional.css b/Fixtures/additional.css new file mode 100755 index 0000000..099d88d --- /dev/null +++ b/Fixtures/additional.css @@ -0,0 +1,7 @@ +.margin-top { + margin-top: 20px; +} + +.margin-bottom { + margin-bottom: 20px; +} \ No newline at end of file diff --git a/Fixtures/index.html b/Fixtures/index.html new file mode 100755 index 0000000..c291278 --- /dev/null +++ b/Fixtures/index.html @@ -0,0 +1,52 @@ + + + + + + + + + + + + + +
+
+
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+

Caption Column 1

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum + dolor sit amet. +
+
+

Caption Column 2

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum + dolor sit amet. +
+
+ + + \ No newline at end of file diff --git a/Fixtures/login.php b/Fixtures/login.php new file mode 100755 index 0000000..f30da06 --- /dev/null +++ b/Fixtures/login.php @@ -0,0 +1,23 @@ + + * @link https://github.com/qa-tools/behat-example + */ + +if ( empty($_POST) ) { + header('Location: index.html'); +} + +if ( $_POST['username'] != 'user' ) { + header('Location: index.html'); +} + +if ( $_POST['password'] != 'validpassword' ) { + header('Location: index.html'); +} + +header('Location: account.html'); \ No newline at end of file diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/behat.yml b/behat.yml new file mode 100755 index 0000000..f7cd589 --- /dev/null +++ b/behat.yml @@ -0,0 +1,18 @@ +default: + suites: + standard: + paths: ['Features'] + contexts: [MainContext] + + extensions: + Behat\MinkExtension: + default_session: selenium2 + javascript_session: selenium2 + base_url: 'http://behat-example.qa-tools.io' + + selenium2: ~ + + QATools\BehatExtension: + qa_tools: + base_url: 'http://behat-example.qa-tools.io' + page_namespace_prefix: ['\QATools\Example\Pages'] \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..1b9e9b9 --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "qa-tools/behat-example", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.3.1", + "qa-tools/qa-tools": "~1.0@dev", + "qa-tools/behat-extension": "dev-cleanup", + "mindplay/annotations": "~1.2@dev", + "behat/mink": "~1.5@dev", + "behat/mink-extension": "*@dev", + "behat/mink-selenium2-driver": "~1.1@dev" + }, + "repositories": [ + { + "type": "vcs", + "url": "/Users/michi/Documents/Workspace/behat-extension" + } + ], + "autoload-dev": { + "psr-0": { + "QATools\\Example": "./src" + } + }, + "config": { + "bin-dir": "bin/" + } +} diff --git a/composer.lock b/composer.lock new file mode 100755 index 0000000..e31d2b6 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1091 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "a9783632148b0efb9fe313da335deff8", + "packages": [ + { + "name": "behat/behat", + "version": "v3.0.14", + "source": { + "type": "git", + "url": "https://github.com/Behat/Behat.git", + "reference": "3f097cd577feed73e681fa56cd4e4e1dda9c115d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Behat/zipball/3f097cd577feed73e681fa56cd4e4e1dda9c115d", + "reference": "3f097cd577feed73e681fa56cd4e4e1dda9c115d", + "shasum": "" + }, + "require": { + "behat/gherkin": "~4.3", + "behat/transliterator": "~1.0", + "ext-mbstring": "*", + "php": ">=5.3.3", + "symfony/class-loader": "~2.1", + "symfony/config": "~2.3", + "symfony/console": "~2.1", + "symfony/dependency-injection": "~2.1", + "symfony/event-dispatcher": "~2.1", + "symfony/translation": "~2.1", + "symfony/yaml": "~2.1" + }, + "require-dev": { + "phpspec/prophecy-phpunit": "~1.0", + "phpunit/phpunit": "~4.0.7", + "symfony/process": "~2.1" + }, + "suggest": { + "behat/mink-extension": "for integration with Mink testing framework", + "behat/symfony2-extension": "for integration with Symfony2 web framework", + "behat/yii-extension": "for integration with Yii web framework" + }, + "bin": [ + "bin/behat" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Behat": "src/", + "Behat\\Testwork": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Scenario-oriented BDD framework for PHP 5.3", + "homepage": "http://behat.org/", + "keywords": [ + "Agile", + "BDD", + "ScenarioBDD", + "Scrum", + "StoryBDD", + "User story", + "business", + "development", + "documentation", + "examples", + "symfony", + "testing" + ], + "time": "2014-09-23 10:47:14" + }, + { + "name": "behat/gherkin", + "version": "v4.3.0", + "source": { + "type": "git", + "url": "https://github.com/Behat/Gherkin.git", + "reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Gherkin/zipball/43777c51058b77bcd84a8775b7a6ad05e986b5db", + "reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.1" + }, + "suggest": { + "symfony/yaml": "If you want to parse features, represented in YAML files" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Gherkin": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Gherkin DSL parser for PHP 5.3", + "homepage": "http://behat.org/", + "keywords": [ + "BDD", + "Behat", + "Cucumber", + "DSL", + "gherkin", + "parser" + ], + "time": "2014-06-06 01:24:32" + }, + { + "name": "behat/mink", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/minkphp/Mink.git", + "reference": "1125c2fa97d5b3623786bceadccee7b4bc11335d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/Mink/zipball/1125c2fa97d5b3623786bceadccee7b4bc11335d", + "reference": "1125c2fa97d5b3623786bceadccee7b4bc11335d", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": "~2.0" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Behat\\Mink\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Browser controller/emulator abstraction for PHP", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ], + "time": "2015-02-04 17:30:41" + }, + { + "name": "behat/mink-extension", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkExtension.git", + "reference": "ba5329be65a816adfc2d9ba9b639a92f548371da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/ba5329be65a816adfc2d9ba9b639a92f548371da", + "reference": "ba5329be65a816adfc2d9ba9b639a92f548371da", + "shasum": "" + }, + "require": { + "behat/behat": "~3.0,>=3.0.5", + "behat/mink": "~1.5", + "php": ">=5.3.2", + "symfony/config": "~2.2" + }, + "require-dev": { + "behat/mink-goutte-driver": "~1.1@dev", + "phpspec/phpspec": "~2.0" + }, + "type": "behat-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\MinkExtension": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + }, + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com" + } + ], + "description": "Mink extension for Behat", + "homepage": "http://extensions.behat.org/mink", + "keywords": [ + "browser", + "gui", + "test", + "web" + ], + "time": "2015-01-23 00:01:18" + }, + { + "name": "behat/mink-selenium2-driver", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/minkphp/MinkSelenium2Driver.git", + "reference": "ce4766aa715ebad3a96a73bffb507c8b723e404b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/ce4766aa715ebad3a96a73bffb507c8b723e404b", + "reference": "ce4766aa715ebad3a96a73bffb507c8b723e404b", + "shasum": "" + }, + "require": { + "behat/mink": "~1.7@dev", + "instaclick/php-webdriver": "~1.1", + "php": ">=5.3.1" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Pete Otaqui", + "email": "pete@otaqui.com", + "homepage": "https://github.com/pete-otaqui" + } + ], + "description": "Selenium2 (WebDriver) driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "ajax", + "browser", + "javascript", + "selenium", + "testing", + "webdriver" + ], + "time": "2015-02-05 21:52:17" + }, + { + "name": "behat/transliterator", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Behat/Transliterator.git", + "reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Transliterator/zipball/c93521d3462a554332d1ef5bb0e9b5b8ca4106c4", + "reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Transliterator": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Artistic-1.0" + ], + "description": "String transliterator", + "keywords": [ + "i18n", + "slug", + "transliterator" + ], + "time": "2014-05-15 22:08:22" + }, + { + "name": "instaclick/php-webdriver", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/instaclick/php-webdriver.git", + "reference": "a57b2bcd9467e217134a2248b261b8b3a90ccea0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/a57b2bcd9467e217134a2248b261b8b3a90ccea0", + "reference": "a57b2bcd9467e217134a2248b261b8b3a90ccea0", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.2" + }, + "require-dev": { + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "WebDriver": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Justin Bishop", + "email": "jubishop@gmail.com", + "role": "Developer" + }, + { + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "role": "Fork Maintainer" + } + ], + "description": "PHP WebDriver for Selenium 2", + "homepage": "http://instaclick.com/", + "keywords": [ + "browser", + "selenium", + "webdriver", + "webtest" + ], + "time": "2014-05-12 21:03:05" + }, + { + "name": "mindplay/annotations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-annotations/php-annotations.git", + "reference": "cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-annotations/php-annotations/zipball/cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698", + "reference": "cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/php-code-coverage": "~1.2.1", + "phpunit/php-file-iterator": ">=1.3.0@stable" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "mindplay\\annotations\\": "src\\annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0+" + ], + "authors": [ + { + "name": "Rasmus Schultz", + "email": "rasmus@mindplay.dk" + } + ], + "description": "Industrial-strength annotations for PHP", + "homepage": "http://blog.mindplay.dk/", + "keywords": [ + "annotations", + "framework" + ], + "time": "2015-02-05 09:34:42" + }, + { + "name": "qa-tools/behat-extension", + "version": "dev-cleanup", + "source": { + "type": "git", + "url": "/Users/michi/Documents/Workspace/behat-extension", + "reference": "89e0e7023247d2b617a58d81ade3df6100a528d6" + }, + "require": { + "behat/mink-extension": "~2.0@dev", + "mindplay/annotations": "~1.2@dev", + "php": ">=5.3.1", + "qa-tools/qa-tools": "~1.0@dev", + "symfony/yaml": "*@dev" + }, + "require-dev": { + "aik099/coding-standard": "dev-master", + "mockery/mockery": "~0.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "QATools\\BehatExtension": "src/" + } + }, + "autoload-dev": { + "psr-0": { + "tests\\QATools\\BehatExtension": "tests/" + } + }, + "license": [ + "BSD-3-Clause" + ], + "description": "QA-Tools extension for Behat", + "homepage": "https://github.com/qa-tools/behat-extension", + "keywords": [ + "BDD", + "Behat", + "HtmlElements", + "PageObject", + "QA-Tools", + "page" + ], + "time": "2014-08-21 21:41:54" + }, + { + "name": "qa-tools/qa-tools", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/qa-tools/qa-tools.git", + "reference": "62199337a1711fedbe4ae6dd4883637f230ec252" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/qa-tools/qa-tools/zipball/62199337a1711fedbe4ae6dd4883637f230ec252", + "reference": "62199337a1711fedbe4ae6dd4883637f230ec252", + "shasum": "" + }, + "require": { + "behat/mink": "~1.6", + "mindplay/annotations": "~1.2@dev", + "php": ">=5.3.2" + }, + "replace": { + "aik099/qa-tools": "self.version" + }, + "require-dev": { + "aik099/coding-standard": "dev-master", + "behat/mink-selenium2-driver": "~1.2", + "brianium/paratest": "~0.7", + "mockery/mockery": "~0.9" + }, + "suggest": { + "aik099/phpunit-mink": "Allows to use PageObject inside PHPUnit tests and remotely collect code coverage information" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev", + "dev-develop": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "QATools\\QATools\\": "./library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Alexander Obuhovich", + "email": "aik.bold@gmail.com" + }, + { + "name": "Dmitry Kushnikov", + "email": "dkushnikov@gmail.com" + }, + { + "name": "Michael Geppert", + "email": "evangelion1204@aol.com" + } + ], + "description": "Library that provides easy-to-use way of interaction with web-page elements in functional tests using PageObject pattern.", + "keywords": [ + "BEM", + "HtmlElements", + "Mink", + "PageObject", + "acceptance", + "functional", + "phpunit", + "tests" + ], + "time": "2015-02-01 11:47:19" + }, + { + "name": "symfony/class-loader", + "version": "v2.6.4", + "target-dir": "Symfony/Component/ClassLoader", + "source": { + "type": "git", + "url": "https://github.com/symfony/ClassLoader.git", + "reference": "deac802f76910708ab50d039806cfd1866895b52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/deac802f76910708ab50d039806cfd1866895b52", + "reference": "deac802f76910708ab50d039806cfd1866895b52", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/finder": "~2.0,>=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\ClassLoader\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony ClassLoader Component", + "homepage": "http://symfony.com", + "time": "2015-01-05 14:28:40" + }, + { + "name": "symfony/config", + "version": "v2.6.4", + "target-dir": "Symfony/Component/Config", + "source": { + "type": "git", + "url": "https://github.com/symfony/Config.git", + "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Config/zipball/a9f781ba1221067d1f07c8cec0bc50f81b8d7408", + "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/filesystem": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Config\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Config Component", + "homepage": "http://symfony.com", + "time": "2015-01-21 20:57:55" + }, + { + "name": "symfony/console", + "version": "v2.6.4", + "target-dir": "Symfony/Component/Console", + "source": { + "type": "git", + "url": "https://github.com/symfony/Console.git", + "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Console/zipball/e44154bfe3e41e8267d7a3794cd9da9a51cfac34", + "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.1" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Console Component", + "homepage": "http://symfony.com", + "time": "2015-01-25 04:39:26" + }, + { + "name": "symfony/css-selector", + "version": "v2.6.4", + "target-dir": "Symfony/Component/CssSelector", + "source": { + "type": "git", + "url": "https://github.com/symfony/CssSelector.git", + "reference": "3f80ecc614fec68d5b4a84a0703db3fdf5ce8584" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/3f80ecc614fec68d5b4a84a0703db3fdf5ce8584", + "reference": "3f80ecc614fec68d5b4a84a0703db3fdf5ce8584", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\CssSelector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "http://symfony.com", + "time": "2015-01-03 08:01:59" + }, + { + "name": "symfony/dependency-injection", + "version": "v2.6.4", + "target-dir": "Symfony/Component/DependencyInjection", + "source": { + "type": "git", + "url": "https://github.com/symfony/DependencyInjection.git", + "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/42bbb43fab66292a1865dc9616c299904c3d4d14", + "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "conflict": { + "symfony/expression-language": "<2.6" + }, + "require-dev": { + "symfony/config": "~2.2", + "symfony/expression-language": "~2.6", + "symfony/yaml": "~2.1" + }, + "suggest": { + "symfony/config": "", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DependencyInjection\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "http://symfony.com", + "time": "2015-01-25 04:39:26" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.6.4", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f75989f3ab2743a82fe0b03ded2598a2b1546813", + "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/stopwatch": "~2.3" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com", + "time": "2015-02-01 16:10:57" + }, + { + "name": "symfony/filesystem", + "version": "v2.6.4", + "target-dir": "Symfony/Component/Filesystem", + "source": { + "type": "git", + "url": "https://github.com/symfony/Filesystem.git", + "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7", + "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com", + "time": "2015-01-03 21:13:09" + }, + { + "name": "symfony/translation", + "version": "v2.6.4", + "target-dir": "Symfony/Component/Translation", + "source": { + "type": "git", + "url": "https://github.com/symfony/Translation.git", + "reference": "f289cdf8179d32058c1e1cbac723106a5ff6fa39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Translation/zipball/f289cdf8179d32058c1e1cbac723106a5ff6fa39", + "reference": "f289cdf8179d32058c1e1cbac723106a5ff6fa39", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.3,>=2.3.12", + "symfony/intl": "~2.3", + "symfony/yaml": "~2.2" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Translation Component", + "homepage": "http://symfony.com", + "time": "2015-01-03 15:33:07" + }, + { + "name": "symfony/yaml", + "version": "v2.6.4", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8", + "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2015-01-25 04:39:26" + } + ], + "packages-dev": [ + + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": { + "qa-tools/qa-tools": 20, + "qa-tools/behat-extension": 20, + "mindplay/annotations": 20, + "behat/mink": 20, + "behat/mink-extension": 20, + "behat/mink-selenium2-driver": 20 + }, + "prefer-stable": false, + "platform": { + "php": ">=5.3.1" + }, + "platform-dev": [ + + ] +} diff --git a/src/QATools/Example/Pages/AccountPage.php b/src/QATools/Example/Pages/AccountPage.php new file mode 100755 index 0000000..3acc93f --- /dev/null +++ b/src/QATools/Example/Pages/AccountPage.php @@ -0,0 +1,25 @@ + + * @link https://github.com/qa-tools/behat-example + */ + +namespace QATools\Example\Pages; + + +use QATools\QATools\HtmlElements\Element\Form; +use QATools\QATools\HtmlElements\TypifiedPage; + +/** + * Class LoginPage. + * + * @page-url('/account.html') + */ +class AccountPage extends TypifiedPage +{ + +} diff --git a/src/QATools/Example/Pages/LoginPage.php b/src/QATools/Example/Pages/LoginPage.php new file mode 100755 index 0000000..7d088aa --- /dev/null +++ b/src/QATools/Example/Pages/LoginPage.php @@ -0,0 +1,75 @@ + + * @link https://github.com/qa-tools/behat-example + */ + +namespace QATools\Example\Pages; + + +use QATools\QATools\HtmlElements\Element\Form; +use QATools\QATools\HtmlElements\TypifiedPage; + +/** + * Class LoginPage. + * + * @page-url('/') + */ +class LoginPage extends TypifiedPage +{ + + /** + * The login form. + * + * @var Form + * @find-by('id' => 'login-form') + */ + protected $loginForm; + + /** + * Fill the login form with given data. + * + * @param string $username The username. + * @param string $password The password. + * + * @return static + */ + public function fillForm($username, $password) + { + $this->loginForm->fill(array( + 'username' => $username, + 'password' => $password, + )); + + return $this; + } + + /** + * Does the login. + * + * @return Page + */ + public function loginSuccess() + { + $this->loginForm->submit(); + + return $this->pageFactory->getPage('Account Page'); + } + + /** + * Does a failing login. + * + * @return Page + */ + public function loginFailure() + { + $this->loginForm->submit(); + + return $this; + } + +} From 7a12be21e74604a6c94e2ed14a0c2b1fe3e4792b Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Sun, 8 Feb 2015 22:43:03 +0100 Subject: [PATCH 2/6] Corrected file permissions, removed composer lock, adjusted dependencies and added steps for setup to README.md --- .gitignore | 0 Features/bootstrap/MainContext.php | 0 Features/login.feature | 0 Fixtures/account.html | 0 Fixtures/additional.css | 0 Fixtures/index.html | 0 Fixtures/login.php | 0 LICENSE | 0 README.md | 22 ++++++ behat.yml | 4 +- composer.json | 13 +--- composer.lock | 94 +++++++++++------------ src/QATools/Example/Pages/AccountPage.php | 0 src/QATools/Example/Pages/LoginPage.php | 0 14 files changed, 75 insertions(+), 58 deletions(-) mode change 100755 => 100644 .gitignore mode change 100755 => 100644 Features/bootstrap/MainContext.php mode change 100755 => 100644 Features/login.feature mode change 100755 => 100644 Fixtures/account.html mode change 100755 => 100644 Fixtures/additional.css mode change 100755 => 100644 Fixtures/index.html mode change 100755 => 100644 Fixtures/login.php mode change 100755 => 100644 LICENSE mode change 100755 => 100644 README.md mode change 100755 => 100644 behat.yml mode change 100755 => 100644 composer.json mode change 100755 => 100644 composer.lock mode change 100755 => 100644 src/QATools/Example/Pages/AccountPage.php mode change 100755 => 100644 src/QATools/Example/Pages/LoginPage.php diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/Features/bootstrap/MainContext.php b/Features/bootstrap/MainContext.php old mode 100755 new mode 100644 diff --git a/Features/login.feature b/Features/login.feature old mode 100755 new mode 100644 diff --git a/Fixtures/account.html b/Fixtures/account.html old mode 100755 new mode 100644 diff --git a/Fixtures/additional.css b/Fixtures/additional.css old mode 100755 new mode 100644 diff --git a/Fixtures/index.html b/Fixtures/index.html old mode 100755 new mode 100644 diff --git a/Fixtures/login.php b/Fixtures/login.php old mode 100755 new mode 100644 diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 index b388f9c..2c030de --- a/README.md +++ b/README.md @@ -17,3 +17,25 @@ Install/update your vendors: $ curl http://getcomposer.org/installer | php $ php composer.phar install ``` + +## Configuration and Execution + +1. Installing dependencies via composer +2. Setting up a web-server, with PHP support, pointing to **./Fixtures** +3. In case the **Fixture** directory is not reachable via http://localhost change in **behat.yml** + * `base_url` for `MinkExtension` + * `base_url` for `BehatExtension` + ```yaml + Behat\MinkExtension: + default_session: selenium2 + javascript_session: selenium2 + base_url: 'http://localhost' + + selenium2: ~ + + QATools\BehatExtension: + qa_tools: + base_url: 'http://localhost' + ``` +4. Download lastest Selenium standalone server and run it +5. Execute `./bin/behat` \ No newline at end of file diff --git a/behat.yml b/behat.yml old mode 100755 new mode 100644 index f7cd589..6bdb33a --- a/behat.yml +++ b/behat.yml @@ -8,11 +8,11 @@ default: Behat\MinkExtension: default_session: selenium2 javascript_session: selenium2 - base_url: 'http://behat-example.qa-tools.io' + base_url: 'http://localhost' selenium2: ~ QATools\BehatExtension: qa_tools: - base_url: 'http://behat-example.qa-tools.io' + base_url: 'http://localhost' page_namespace_prefix: ['\QATools\Example\Pages'] \ No newline at end of file diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 index 1b9e9b9..d1f1ef2 --- a/composer.json +++ b/composer.json @@ -3,25 +3,20 @@ "license": "BSD-3-Clause", "require": { "php": ">=5.3.1", - "qa-tools/qa-tools": "~1.0@dev", - "qa-tools/behat-extension": "dev-cleanup", + "behat/mink-selenium2-driver": "~1.2.0", "mindplay/annotations": "~1.2@dev", - "behat/mink": "~1.5@dev", - "behat/mink-extension": "*@dev", - "behat/mink-selenium2-driver": "~1.1@dev" + "qa-tools/qa-tools": "dev-develop", + "qa-tools/behat-extension": "dev-master" }, "repositories": [ { "type": "vcs", - "url": "/Users/michi/Documents/Workspace/behat-extension" + "url": "https://github.com/qa-tools/behat-extension.git" } ], "autoload-dev": { "psr-0": { "QATools\\Example": "./src" } - }, - "config": { - "bin-dir": "bin/" } } diff --git a/composer.lock b/composer.lock old mode 100755 new mode 100644 index e31d2b6..48e4cd6 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a9783632148b0efb9fe313da335deff8", + "hash": "2d750a7c50062f1f65ae979ad62011ba", "packages": [ { "name": "behat/behat", @@ -147,16 +147,16 @@ }, { "name": "behat/mink", - "version": "dev-master", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/minkphp/Mink.git", - "reference": "1125c2fa97d5b3623786bceadccee7b4bc11335d" + "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/1125c2fa97d5b3623786bceadccee7b4bc11335d", - "reference": "1125c2fa97d5b3623786bceadccee7b4bc11335d", + "url": "https://api.github.com/repos/minkphp/Mink/zipball/8b68523a339ec991bcd638b39dc8f04f808da88a", + "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a", "shasum": "" }, "require": { @@ -172,7 +172,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -198,20 +198,20 @@ "testing", "web" ], - "time": "2015-02-04 17:30:41" + "time": "2015-02-04 17:02:06" }, { "name": "behat/mink-extension", - "version": "dev-master", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Behat/MinkExtension.git", - "reference": "ba5329be65a816adfc2d9ba9b639a92f548371da" + "reference": "06a4cb56614b047d8d15ea5cd392d19fd3d856e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/ba5329be65a816adfc2d9ba9b639a92f548371da", - "reference": "ba5329be65a816adfc2d9ba9b639a92f548371da", + "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/06a4cb56614b047d8d15ea5cd392d19fd3d856e8", + "reference": "06a4cb56614b047d8d15ea5cd392d19fd3d856e8", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "symfony/config": "~2.2" }, "require-dev": { - "behat/mink-goutte-driver": "~1.1@dev", + "behat/mink-goutte-driver": "~1.0", "phpspec/phpspec": "~2.0" }, "type": "behat-extension", @@ -257,36 +257,36 @@ "test", "web" ], - "time": "2015-01-23 00:01:18" + "time": "2014-09-23 10:59:27" }, { "name": "behat/mink-selenium2-driver", - "version": "dev-master", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/minkphp/MinkSelenium2Driver.git", - "reference": "ce4766aa715ebad3a96a73bffb507c8b723e404b" + "reference": "8018fee80bf6573f909ece3e0dfc07d0eb352210" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/ce4766aa715ebad3a96a73bffb507c8b723e404b", - "reference": "ce4766aa715ebad3a96a73bffb507c8b723e404b", + "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/8018fee80bf6573f909ece3e0dfc07d0eb352210", + "reference": "8018fee80bf6573f909ece3e0dfc07d0eb352210", "shasum": "" }, "require": { - "behat/mink": "~1.7@dev", + "behat/mink": "~1.6@dev", "instaclick/php-webdriver": "~1.1", "php": ">=5.3.1" }, "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { - "psr-4": { - "Behat\\Mink\\Driver\\": "src/" + "psr-0": { + "Behat\\Mink\\Driver": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -315,7 +315,7 @@ "testing", "webdriver" ], - "time": "2015-02-05 21:52:17" + "time": "2014-09-29 13:12:12" }, { "name": "behat/transliterator", @@ -467,18 +467,22 @@ }, { "name": "qa-tools/behat-extension", - "version": "dev-cleanup", + "version": "dev-master", "source": { "type": "git", - "url": "/Users/michi/Documents/Workspace/behat-extension", - "reference": "89e0e7023247d2b617a58d81ade3df6100a528d6" + "url": "https://github.com/qa-tools/behat-extension.git", + "reference": "2e651b5958cf609984d654581a574521e965a4f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/qa-tools/behat-extension/zipball/2e651b5958cf609984d654581a574521e965a4f1", + "reference": "2e651b5958cf609984d654581a574521e965a4f1", + "shasum": "" }, "require": { "behat/mink-extension": "~2.0@dev", - "mindplay/annotations": "~1.2@dev", "php": ">=5.3.1", - "qa-tools/qa-tools": "~1.0@dev", - "symfony/yaml": "*@dev" + "qa-tools/qa-tools": "*@dev" }, "require-dev": { "aik099/coding-standard": "dev-master", @@ -513,7 +517,11 @@ "QA-Tools", "page" ], - "time": "2014-08-21 21:41:54" + "support": { + "source": "https://github.com/qa-tools/behat-extension/tree/master", + "issues": "https://github.com/qa-tools/behat-extension/issues" + }, + "time": "2014-08-18 08:56:31" }, { "name": "qa-tools/qa-tools", @@ -521,12 +529,12 @@ "source": { "type": "git", "url": "https://github.com/qa-tools/qa-tools.git", - "reference": "62199337a1711fedbe4ae6dd4883637f230ec252" + "reference": "6f676e09d5283adcde6a13cd1f183e5bef941cac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qa-tools/qa-tools/zipball/62199337a1711fedbe4ae6dd4883637f230ec252", - "reference": "62199337a1711fedbe4ae6dd4883637f230ec252", + "url": "https://api.github.com/repos/qa-tools/qa-tools/zipball/6f676e09d5283adcde6a13cd1f183e5bef941cac", + "reference": "6f676e09d5283adcde6a13cd1f183e5bef941cac", "shasum": "" }, "require": { @@ -587,7 +595,7 @@ "phpunit", "tests" ], - "time": "2015-02-01 11:47:19" + "time": "2015-02-08 17:57:00" }, { "name": "symfony/class-loader", @@ -1066,26 +1074,18 @@ "time": "2015-01-25 04:39:26" } ], - "packages-dev": [ - - ], - "aliases": [ - - ], + "packages-dev": [], + "aliases": [], "minimum-stability": "stable", "stability-flags": { - "qa-tools/qa-tools": 20, - "qa-tools/behat-extension": 20, "mindplay/annotations": 20, - "behat/mink": 20, - "behat/mink-extension": 20, - "behat/mink-selenium2-driver": 20 + "qa-tools/qa-tools": 20, + "qa-tools/behat-extension": 20 }, "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.3.1" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/src/QATools/Example/Pages/AccountPage.php b/src/QATools/Example/Pages/AccountPage.php old mode 100755 new mode 100644 diff --git a/src/QATools/Example/Pages/LoginPage.php b/src/QATools/Example/Pages/LoginPage.php old mode 100755 new mode 100644 From 7af829d737ed7ef12ab9e49700be083b6590f60d Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Sun, 22 Mar 2015 17:13:59 +0100 Subject: [PATCH 3/6] Smaller adjustments. --- .gitignore | 2 +- Features/login.feature | 13 +-- behat.yml | 2 +- composer.json | 4 +- composer.lock | 179 +++++++++++++++++++++++------------------ 5 files changed, 113 insertions(+), 87 deletions(-) diff --git a/.gitignore b/.gitignore index b511f03..b7b8b32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea bin vendor -composer.lock \ No newline at end of file +composer.lock diff --git a/Features/login.feature b/Features/login.feature index 06250e3..ca016f9 100644 --- a/Features/login.feature +++ b/Features/login.feature @@ -5,12 +5,13 @@ Feature: Login @javascript @login @failing-login Scenario: Failing login due wrong password - Given the user visits the "Login Page" - When the user enters user and invalidpassword - And the login should fail + Given I'm on 'Login Page' + When I login with 'username' and 'wrong password' + Then I should be on 'Login page' + And I should see 'invalid username or password' error message @javascript @login @successful-login Scenario: Successful login of user - Given the user visits the "Login Page" - When the user enters user and validpassword - And the login should succeed \ No newline at end of file + Given I'm on 'Login Page' + When I login with 'username' and 'password' + Then I should be on 'Account Page' diff --git a/behat.yml b/behat.yml index 6bdb33a..642534e 100644 --- a/behat.yml +++ b/behat.yml @@ -15,4 +15,4 @@ default: QATools\BehatExtension: qa_tools: base_url: 'http://localhost' - page_namespace_prefix: ['\QATools\Example\Pages'] \ No newline at end of file + page_namespace_§prefix: ['\QATools\Example\Pages'] \ No newline at end of file diff --git a/composer.json b/composer.json index d1f1ef2..a1558c9 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,8 @@ "require": { "php": ">=5.3.1", "behat/mink-selenium2-driver": "~1.2.0", + "behat/behat": "~3.0", + "behat/mink-extension": "~2.0", "mindplay/annotations": "~1.2@dev", "qa-tools/qa-tools": "dev-develop", "qa-tools/behat-extension": "dev-master" @@ -11,7 +13,7 @@ "repositories": [ { "type": "vcs", - "url": "https://github.com/qa-tools/behat-extension.git" + "url": "https://github.com/evangelion1204/behat-extension.git" } ], "autoload-dev": { diff --git a/composer.lock b/composer.lock index 48e4cd6..addeeb7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2d750a7c50062f1f65ae979ad62011ba", + "hash": "2bc0ae8818208577207b98b2b15c1203", "packages": [ { "name": "behat/behat", - "version": "v3.0.14", + "version": "v3.0.15", "source": { "type": "git", "url": "https://github.com/Behat/Behat.git", - "reference": "3f097cd577feed73e681fa56cd4e4e1dda9c115d" + "reference": "b35ae3d45332d80c532af69cc36f780a9397a996" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/3f097cd577feed73e681fa56cd4e4e1dda9c115d", - "reference": "3f097cd577feed73e681fa56cd4e4e1dda9c115d", + "url": "https://api.github.com/repos/Behat/Behat/zipball/b35ae3d45332d80c532af69cc36f780a9397a996", + "reference": "b35ae3d45332d80c532af69cc36f780a9397a996", "shasum": "" }, "require": { @@ -30,12 +30,12 @@ "symfony/console": "~2.1", "symfony/dependency-injection": "~2.1", "symfony/event-dispatcher": "~2.1", - "symfony/translation": "~2.1", + "symfony/translation": "~2.3", "symfony/yaml": "~2.1" }, "require-dev": { "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.0.7", + "phpunit/phpunit": "~4.0", "symfony/process": "~2.1" }, "suggest": { @@ -85,7 +85,7 @@ "symfony", "testing" ], - "time": "2014-09-23 10:47:14" + "time": "2015-02-22 14:10:33" }, { "name": "behat/gherkin", @@ -202,16 +202,16 @@ }, { "name": "behat/mink-extension", - "version": "v2.0.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/Behat/MinkExtension.git", - "reference": "06a4cb56614b047d8d15ea5cd392d19fd3d856e8" + "reference": "a448b617c6cc69260eaba248705a4cf2eb0208db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/06a4cb56614b047d8d15ea5cd392d19fd3d856e8", - "reference": "06a4cb56614b047d8d15ea5cd392d19fd3d856e8", + "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/a448b617c6cc69260eaba248705a4cf2eb0208db", + "reference": "a448b617c6cc69260eaba248705a4cf2eb0208db", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "symfony/config": "~2.2" }, "require-dev": { - "behat/mink-goutte-driver": "~1.0", + "behat/mink-goutte-driver": "~1.1@dev", "phpspec/phpspec": "~2.0" }, "type": "behat-extension", @@ -257,7 +257,7 @@ "test", "web" ], - "time": "2014-09-23 10:59:27" + "time": "2015-03-10 09:04:42" }, { "name": "behat/mink-selenium2-driver", @@ -467,22 +467,24 @@ }, { "name": "qa-tools/behat-extension", - "version": "dev-master", + "version": "dev-cleanup", "source": { "type": "git", - "url": "https://github.com/qa-tools/behat-extension.git", - "reference": "2e651b5958cf609984d654581a574521e965a4f1" + "url": "https://github.com/evangelion1204/behat-extension.git", + "reference": "12c1a26e3b3af3210a90b00975e402c42794b816" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qa-tools/behat-extension/zipball/2e651b5958cf609984d654581a574521e965a4f1", - "reference": "2e651b5958cf609984d654581a574521e965a4f1", + "url": "https://api.github.com/repos/evangelion1204/behat-extension/zipball/12c1a26e3b3af3210a90b00975e402c42794b816", + "reference": "12c1a26e3b3af3210a90b00975e402c42794b816", "shasum": "" }, "require": { - "behat/mink-extension": "~2.0@dev", + "behat/mink-extension": "~2.0", + "mindplay/annotations": "~1.2@dev", "php": ">=5.3.1", - "qa-tools/qa-tools": "*@dev" + "qa-tools/qa-tools": "~1.0@dev", + "symfony/yaml": "2.6.4" }, "require-dev": { "aik099/coding-standard": "dev-master", @@ -518,23 +520,22 @@ "page" ], "support": { - "source": "https://github.com/qa-tools/behat-extension/tree/master", - "issues": "https://github.com/qa-tools/behat-extension/issues" + "source": "https://github.com/evangelion1204/behat-extension/tree/cleanup" }, - "time": "2014-08-18 08:56:31" + "time": "2015-02-11 21:36:29" }, { "name": "qa-tools/qa-tools", "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/qa-tools/qa-tools.git", - "reference": "6f676e09d5283adcde6a13cd1f183e5bef941cac" + "url": "https://github.com/evangelion1204/qa-tools.git", + "reference": "5214a6d058d8157474266307e8230a3994e35ff4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qa-tools/qa-tools/zipball/6f676e09d5283adcde6a13cd1f183e5bef941cac", - "reference": "6f676e09d5283adcde6a13cd1f183e5bef941cac", + "url": "https://api.github.com/repos/evangelion1204/qa-tools/zipball/5214a6d058d8157474266307e8230a3994e35ff4", + "reference": "5214a6d058d8157474266307e8230a3994e35ff4", "shasum": "" }, "require": { @@ -566,7 +567,11 @@ "QATools\\QATools\\": "./library/" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-0": { + "tests\\QATools\\QATools\\": "./" + } + }, "license": [ "BSD-3-Clause" ], @@ -575,13 +580,13 @@ "name": "Alexander Obuhovich", "email": "aik.bold@gmail.com" }, - { - "name": "Dmitry Kushnikov", - "email": "dkushnikov@gmail.com" - }, { "name": "Michael Geppert", "email": "evangelion1204@aol.com" + }, + { + "name": "Dmitry Kushnikov", + "email": "dkushnikov@gmail.com" } ], "description": "Library that provides easy-to-use way of interaction with web-page elements in functional tests using PageObject pattern.", @@ -589,34 +594,38 @@ "BEM", "HtmlElements", "Mink", + "PHPUnit", "PageObject", + "Tests", "acceptance", - "functional", - "phpunit", - "tests" + "functional" ], - "time": "2015-02-08 17:57:00" + "support": { + "source": "https://github.com/evangelion1204/qa-tools/tree/develop" + }, + "time": "2015-03-05 13:42:27" }, { "name": "symfony/class-loader", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/ClassLoader", "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader.git", - "reference": "deac802f76910708ab50d039806cfd1866895b52" + "reference": "56bf6fe551ca013471541d866f73a6cc70ece9c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/deac802f76910708ab50d039806cfd1866895b52", - "reference": "deac802f76910708ab50d039806cfd1866895b52", + "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/56bf6fe551ca013471541d866f73a6cc70ece9c5", + "reference": "56bf6fe551ca013471541d866f73a6cc70ece9c5", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/finder": "~2.0,>=2.0.5" + "symfony/finder": "~2.0,>=2.0.5", + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { @@ -645,27 +654,30 @@ ], "description": "Symfony ClassLoader Component", "homepage": "http://symfony.com", - "time": "2015-01-05 14:28:40" + "time": "2015-03-13 17:37:22" }, { "name": "symfony/config", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408" + "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/a9f781ba1221067d1f07c8cec0bc50f81b8d7408", - "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408", + "url": "https://api.github.com/repos/symfony/Config/zipball/7a47189c7667ca69bcaafd19ef8a8941db449a2c", + "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/filesystem": "~2.3" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { @@ -693,21 +705,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2015-01-21 20:57:55" + "time": "2015-03-12 10:28:44" }, { "name": "symfony/console", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34" + "reference": "53f86497ccd01677e22435cfb7262599450a90d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/e44154bfe3e41e8267d7a3794cd9da9a51cfac34", - "reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34", + "url": "https://api.github.com/repos/symfony/Console/zipball/53f86497ccd01677e22435cfb7262599450a90d1", + "reference": "53f86497ccd01677e22435cfb7262599450a90d1", "shasum": "" }, "require": { @@ -716,6 +728,7 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { @@ -750,26 +763,29 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" + "time": "2015-03-13 17:37:22" }, { "name": "symfony/css-selector", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/CssSelector", "source": { "type": "git", "url": "https://github.com/symfony/CssSelector.git", - "reference": "3f80ecc614fec68d5b4a84a0703db3fdf5ce8584" + "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/3f80ecc614fec68d5b4a84a0703db3fdf5ce8584", - "reference": "3f80ecc614fec68d5b4a84a0703db3fdf5ce8584", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/86cf0aa16065ffc4545374e9479dd7878bf1d90f", + "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { @@ -801,21 +817,21 @@ ], "description": "Symfony CssSelector Component", "homepage": "http://symfony.com", - "time": "2015-01-03 08:01:59" + "time": "2015-02-24 11:52:21" }, { "name": "symfony/dependency-injection", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14" + "reference": "a49245b2beebe332924561c30772b16e1d32f13a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/42bbb43fab66292a1865dc9616c299904c3d4d14", - "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/a49245b2beebe332924561c30772b16e1d32f13a", + "reference": "a49245b2beebe332924561c30772b16e1d32f13a", "shasum": "" }, "require": { @@ -827,6 +843,7 @@ "require-dev": { "symfony/config": "~2.2", "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", "symfony/yaml": "~2.1" }, "suggest": { @@ -861,21 +878,21 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" + "time": "2015-03-17 12:44:40" }, { "name": "symfony/event-dispatcher", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813" + "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f75989f3ab2743a82fe0b03ded2598a2b1546813", - "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284", + "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284", "shasum": "" }, "require": { @@ -886,6 +903,7 @@ "symfony/config": "~2.0,>=2.0.5", "symfony/dependency-injection": "~2.6", "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", "symfony/stopwatch": "~2.3" }, "suggest": { @@ -919,26 +937,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2015-02-01 16:10:57" + "time": "2015-03-13 17:37:22" }, { "name": "symfony/filesystem", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7" + "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7", - "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/fdc5f151bc2db066b51870d5bea3773d915ced0b", + "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { @@ -966,21 +987,21 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2015-01-03 21:13:09" + "time": "2015-03-12 10:28:44" }, { "name": "symfony/translation", - "version": "v2.6.4", + "version": "v2.6.5", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "f289cdf8179d32058c1e1cbac723106a5ff6fa39" + "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/f289cdf8179d32058c1e1cbac723106a5ff6fa39", - "reference": "f289cdf8179d32058c1e1cbac723106a5ff6fa39", + "url": "https://api.github.com/repos/symfony/Translation/zipball/043db5f1eef9598d1bc1d75b93304984c003d7d9", + "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9", "shasum": "" }, "require": { @@ -990,6 +1011,7 @@ "psr/log": "~1.0", "symfony/config": "~2.3,>=2.3.12", "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", "symfony/yaml": "~2.2" }, "suggest": { @@ -1024,7 +1046,7 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2015-01-03 15:33:07" + "time": "2015-03-14 11:42:25" }, { "name": "symfony/yaml", @@ -1078,6 +1100,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "behat/mink-extension": 20, "mindplay/annotations": 20, "qa-tools/qa-tools": 20, "qa-tools/behat-extension": 20 From 07019b9f46ef752422ed8414ce5faf6daacec411 Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Mon, 23 Mar 2015 07:31:44 +0100 Subject: [PATCH 4/6] [WIP] improving example. --- Features/bootstrap/MainContext.php | 31 +- Fixtures/account.html | 0 Fixtures/additional.css | 0 Fixtures/index.html | 0 Fixtures/login.php | 0 behat.yml | 4 +- composer.json | 10 +- composer.lock | 1114 --------------------- src/QATools/Example/Pages/AccountPage.php | 1 + src/QATools/Example/Pages/LoginPage.php | 29 +- 10 files changed, 37 insertions(+), 1152 deletions(-) mode change 100644 => 100755 Fixtures/account.html mode change 100644 => 100755 Fixtures/additional.css mode change 100644 => 100755 Fixtures/index.html mode change 100644 => 100755 Fixtures/login.php delete mode 100644 composer.lock diff --git a/Features/bootstrap/MainContext.php b/Features/bootstrap/MainContext.php index c0474aa..cca400b 100644 --- a/Features/bootstrap/MainContext.php +++ b/Features/bootstrap/MainContext.php @@ -6,27 +6,40 @@ class MainContext extends QAToolsContext { /** - * @When /^the user enters (.+?) and (.+?)$/ + * @Given I'm on ':page' */ - public function fillForm($username, $password) + public function openPage($page) { - $this->page->fillForm($username, $password); + $this->page = $this->pageFactory->getPage($page); + $this->page->open(); } /** - * @Then /^the login should fail$/ + * @When I login with ':username' and ':password' */ - public function loginFail() + public function login($username, $password) { - $this->page = $this->page->loginFailure(); + $this->page->login($username, $password); } /** - * @Then /^the login should succeed/ + * @Then I should be on ':page' */ - public function loginSucceed() + public function pageOpen($page) { - $this->page = $this->page->loginSuccess(); + $this->page = $this->pageFactory->getPage($page); + + if ( !$this->page->opened() ) { + throw new Exception($page . ' is not open!'); + } + } + + /** + * @Then I should see ':message' error message + */ + public function errorMessageVisible($message) + { + } /** diff --git a/Fixtures/account.html b/Fixtures/account.html old mode 100644 new mode 100755 diff --git a/Fixtures/additional.css b/Fixtures/additional.css old mode 100644 new mode 100755 diff --git a/Fixtures/index.html b/Fixtures/index.html old mode 100644 new mode 100755 diff --git a/Fixtures/login.php b/Fixtures/login.php old mode 100644 new mode 100755 diff --git a/behat.yml b/behat.yml index 642534e..1f4c9c4 100644 --- a/behat.yml +++ b/behat.yml @@ -14,5 +14,5 @@ default: QATools\BehatExtension: qa_tools: - base_url: 'http://localhost' - page_namespace_§prefix: ['\QATools\Example\Pages'] \ No newline at end of file + base_url: 'http://behat-example.qa-tools.io' + page_namespace_prefix: ['\QATools\Example\Pages'] \ No newline at end of file diff --git a/composer.json b/composer.json index a1558c9..23e12b8 100644 --- a/composer.json +++ b/composer.json @@ -7,11 +7,15 @@ "behat/behat": "~3.0", "behat/mink-extension": "~2.0", "mindplay/annotations": "~1.2@dev", - "qa-tools/qa-tools": "dev-develop", - "qa-tools/behat-extension": "dev-master" + "qa-tools/qa-tools": "dev-121-page-matcher", + "qa-tools/behat-extension": "dev-cleanup" }, "repositories": [ - { + { + "type": "vcs", + "url": "https://github.com/evangelion1204/qa-tools.git" + }, + { "type": "vcs", "url": "https://github.com/evangelion1204/behat-extension.git" } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index addeeb7..0000000 --- a/composer.lock +++ /dev/null @@ -1,1114 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "2bc0ae8818208577207b98b2b15c1203", - "packages": [ - { - "name": "behat/behat", - "version": "v3.0.15", - "source": { - "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "b35ae3d45332d80c532af69cc36f780a9397a996" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/b35ae3d45332d80c532af69cc36f780a9397a996", - "reference": "b35ae3d45332d80c532af69cc36f780a9397a996", - "shasum": "" - }, - "require": { - "behat/gherkin": "~4.3", - "behat/transliterator": "~1.0", - "ext-mbstring": "*", - "php": ">=5.3.3", - "symfony/class-loader": "~2.1", - "symfony/config": "~2.3", - "symfony/console": "~2.1", - "symfony/dependency-injection": "~2.1", - "symfony/event-dispatcher": "~2.1", - "symfony/translation": "~2.3", - "symfony/yaml": "~2.1" - }, - "require-dev": { - "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.0", - "symfony/process": "~2.1" - }, - "suggest": { - "behat/mink-extension": "for integration with Mink testing framework", - "behat/symfony2-extension": "for integration with Symfony2 web framework", - "behat/yii-extension": "for integration with Yii web framework" - }, - "bin": [ - "bin/behat" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Behat": "src/", - "Behat\\Testwork": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Scenario-oriented BDD framework for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "Agile", - "BDD", - "ScenarioBDD", - "Scrum", - "StoryBDD", - "User story", - "business", - "development", - "documentation", - "examples", - "symfony", - "testing" - ], - "time": "2015-02-22 14:10:33" - }, - { - "name": "behat/gherkin", - "version": "v4.3.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/43777c51058b77bcd84a8775b7a6ad05e986b5db", - "reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db", - "shasum": "" - }, - "require": { - "php": ">=5.3.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "symfony/yaml": "~2.1" - }, - "suggest": { - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Gherkin DSL parser for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Cucumber", - "DSL", - "gherkin", - "parser" - ], - "time": "2014-06-06 01:24:32" - }, - { - "name": "behat/mink", - "version": "v1.6.1", - "source": { - "type": "git", - "url": "https://github.com/minkphp/Mink.git", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/8b68523a339ec991bcd638b39dc8f04f808da88a", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.0" - }, - "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Mink\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Browser controller/emulator abstraction for PHP", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "testing", - "web" - ], - "time": "2015-02-04 17:02:06" - }, - { - "name": "behat/mink-extension", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Behat/MinkExtension.git", - "reference": "a448b617c6cc69260eaba248705a4cf2eb0208db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/a448b617c6cc69260eaba248705a4cf2eb0208db", - "reference": "a448b617c6cc69260eaba248705a4cf2eb0208db", - "shasum": "" - }, - "require": { - "behat/behat": "~3.0,>=3.0.5", - "behat/mink": "~1.5", - "php": ">=5.3.2", - "symfony/config": "~2.2" - }, - "require-dev": { - "behat/mink-goutte-driver": "~1.1@dev", - "phpspec/phpspec": "~2.0" - }, - "type": "behat-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\MinkExtension": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - }, - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" - } - ], - "description": "Mink extension for Behat", - "homepage": "http://extensions.behat.org/mink", - "keywords": [ - "browser", - "gui", - "test", - "web" - ], - "time": "2015-03-10 09:04:42" - }, - { - "name": "behat/mink-selenium2-driver", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/MinkSelenium2Driver.git", - "reference": "8018fee80bf6573f909ece3e0dfc07d0eb352210" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/8018fee80bf6573f909ece3e0dfc07d0eb352210", - "reference": "8018fee80bf6573f909ece3e0dfc07d0eb352210", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6@dev", - "instaclick/php-webdriver": "~1.1", - "php": ">=5.3.1" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Pete Otaqui", - "email": "pete@otaqui.com", - "homepage": "https://github.com/pete-otaqui" - } - ], - "description": "Selenium2 (WebDriver) driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "ajax", - "browser", - "javascript", - "selenium", - "testing", - "webdriver" - ], - "time": "2014-09-29 13:12:12" - }, - { - "name": "behat/transliterator", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/Behat/Transliterator.git", - "reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Transliterator/zipball/c93521d3462a554332d1ef5bb0e9b5b8ca4106c4", - "reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Transliterator": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Artistic-1.0" - ], - "description": "String transliterator", - "keywords": [ - "i18n", - "slug", - "transliterator" - ], - "time": "2014-05-15 22:08:22" - }, - { - "name": "instaclick/php-webdriver", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/instaclick/php-webdriver.git", - "reference": "a57b2bcd9467e217134a2248b261b8b3a90ccea0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/a57b2bcd9467e217134a2248b261b8b3a90ccea0", - "reference": "a57b2bcd9467e217134a2248b261b8b3a90ccea0", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.2" - }, - "require-dev": { - "satooshi/php-coveralls": "dev-master" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "WebDriver": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Justin Bishop", - "email": "jubishop@gmail.com", - "role": "Developer" - }, - { - "name": "Anthon Pang", - "email": "apang@softwaredevelopment.ca", - "role": "Fork Maintainer" - } - ], - "description": "PHP WebDriver for Selenium 2", - "homepage": "http://instaclick.com/", - "keywords": [ - "browser", - "selenium", - "webdriver", - "webtest" - ], - "time": "2014-05-12 21:03:05" - }, - { - "name": "mindplay/annotations", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-annotations/php-annotations.git", - "reference": "cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-annotations/php-annotations/zipball/cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698", - "reference": "cf312a2f38ad41a40fc1b51c33c4f78c1ae1a698", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/php-code-coverage": "~1.2.1", - "phpunit/php-file-iterator": ">=1.3.0@stable" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "mindplay\\annotations\\": "src\\annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0+" - ], - "authors": [ - { - "name": "Rasmus Schultz", - "email": "rasmus@mindplay.dk" - } - ], - "description": "Industrial-strength annotations for PHP", - "homepage": "http://blog.mindplay.dk/", - "keywords": [ - "annotations", - "framework" - ], - "time": "2015-02-05 09:34:42" - }, - { - "name": "qa-tools/behat-extension", - "version": "dev-cleanup", - "source": { - "type": "git", - "url": "https://github.com/evangelion1204/behat-extension.git", - "reference": "12c1a26e3b3af3210a90b00975e402c42794b816" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/evangelion1204/behat-extension/zipball/12c1a26e3b3af3210a90b00975e402c42794b816", - "reference": "12c1a26e3b3af3210a90b00975e402c42794b816", - "shasum": "" - }, - "require": { - "behat/mink-extension": "~2.0", - "mindplay/annotations": "~1.2@dev", - "php": ">=5.3.1", - "qa-tools/qa-tools": "~1.0@dev", - "symfony/yaml": "2.6.4" - }, - "require-dev": { - "aik099/coding-standard": "dev-master", - "mockery/mockery": "~0.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "QATools\\BehatExtension": "src/" - } - }, - "autoload-dev": { - "psr-0": { - "tests\\QATools\\BehatExtension": "tests/" - } - }, - "license": [ - "BSD-3-Clause" - ], - "description": "QA-Tools extension for Behat", - "homepage": "https://github.com/qa-tools/behat-extension", - "keywords": [ - "BDD", - "Behat", - "HtmlElements", - "PageObject", - "QA-Tools", - "page" - ], - "support": { - "source": "https://github.com/evangelion1204/behat-extension/tree/cleanup" - }, - "time": "2015-02-11 21:36:29" - }, - { - "name": "qa-tools/qa-tools", - "version": "dev-develop", - "source": { - "type": "git", - "url": "https://github.com/evangelion1204/qa-tools.git", - "reference": "5214a6d058d8157474266307e8230a3994e35ff4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/evangelion1204/qa-tools/zipball/5214a6d058d8157474266307e8230a3994e35ff4", - "reference": "5214a6d058d8157474266307e8230a3994e35ff4", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6", - "mindplay/annotations": "~1.2@dev", - "php": ">=5.3.2" - }, - "replace": { - "aik099/qa-tools": "self.version" - }, - "require-dev": { - "aik099/coding-standard": "dev-master", - "behat/mink-selenium2-driver": "~1.2", - "brianium/paratest": "~0.7", - "mockery/mockery": "~0.9" - }, - "suggest": { - "aik099/phpunit-mink": "Allows to use PageObject inside PHPUnit tests and remotely collect code coverage information" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev", - "dev-develop": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "QATools\\QATools\\": "./library/" - } - }, - "autoload-dev": { - "psr-0": { - "tests\\QATools\\QATools\\": "./" - } - }, - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Alexander Obuhovich", - "email": "aik.bold@gmail.com" - }, - { - "name": "Michael Geppert", - "email": "evangelion1204@aol.com" - }, - { - "name": "Dmitry Kushnikov", - "email": "dkushnikov@gmail.com" - } - ], - "description": "Library that provides easy-to-use way of interaction with web-page elements in functional tests using PageObject pattern.", - "keywords": [ - "BEM", - "HtmlElements", - "Mink", - "PHPUnit", - "PageObject", - "Tests", - "acceptance", - "functional" - ], - "support": { - "source": "https://github.com/evangelion1204/qa-tools/tree/develop" - }, - "time": "2015-03-05 13:42:27" - }, - { - "name": "symfony/class-loader", - "version": "v2.6.5", - "target-dir": "Symfony/Component/ClassLoader", - "source": { - "type": "git", - "url": "https://github.com/symfony/ClassLoader.git", - "reference": "56bf6fe551ca013471541d866f73a6cc70ece9c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/56bf6fe551ca013471541d866f73a6cc70ece9c5", - "reference": "56bf6fe551ca013471541d866f73a6cc70ece9c5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/finder": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\ClassLoader\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony ClassLoader Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" - }, - { - "name": "symfony/config", - "version": "v2.6.5", - "target-dir": "Symfony/Component/Config", - "source": { - "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/7a47189c7667ca69bcaafd19ef8a8941db449a2c", - "reference": "7a47189c7667ca69bcaafd19ef8a8941db449a2c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Config\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Config Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 10:28:44" - }, - { - "name": "symfony/console", - "version": "v2.6.5", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "53f86497ccd01677e22435cfb7262599450a90d1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/53f86497ccd01677e22435cfb7262599450a90d1", - "reference": "53f86497ccd01677e22435cfb7262599450a90d1", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" - }, - { - "name": "symfony/css-selector", - "version": "v2.6.5", - "target-dir": "Symfony/Component/CssSelector", - "source": { - "type": "git", - "url": "https://github.com/symfony/CssSelector.git", - "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/86cf0aa16065ffc4545374e9479dd7878bf1d90f", - "reference": "86cf0aa16065ffc4545374e9479dd7878bf1d90f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "http://symfony.com", - "time": "2015-02-24 11:52:21" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.6.5", - "target-dir": "Symfony/Component/DependencyInjection", - "source": { - "type": "git", - "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "a49245b2beebe332924561c30772b16e1d32f13a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/a49245b2beebe332924561c30772b16e1d32f13a", - "reference": "a49245b2beebe332924561c30772b16e1d32f13a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "conflict": { - "symfony/expression-language": "<2.6" - }, - "require-dev": { - "symfony/config": "~2.2", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.1" - }, - "suggest": { - "symfony/config": "", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\DependencyInjection\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "http://symfony.com", - "time": "2015-03-17 12:44:40" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.6.5", - "target-dir": "Symfony/Component/EventDispatcher", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284", - "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" - }, - { - "name": "symfony/filesystem", - "version": "v2.6.5", - "target-dir": "Symfony/Component/Filesystem", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/fdc5f151bc2db066b51870d5bea3773d915ced0b", - "reference": "fdc5f151bc2db066b51870d5bea3773d915ced0b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 10:28:44" - }, - { - "name": "symfony/translation", - "version": "v2.6.5", - "target-dir": "Symfony/Component/Translation", - "source": { - "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/043db5f1eef9598d1bc1d75b93304984c003d7d9", - "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.3,>=2.3.12", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2015-03-14 11:42:25" - }, - { - "name": "symfony/yaml", - "version": "v2.6.4", - "target-dir": "Symfony/Component/Yaml", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8", - "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:26" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "behat/mink-extension": 20, - "mindplay/annotations": 20, - "qa-tools/qa-tools": 20, - "qa-tools/behat-extension": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.3.1" - }, - "platform-dev": [] -} diff --git a/src/QATools/Example/Pages/AccountPage.php b/src/QATools/Example/Pages/AccountPage.php index 3acc93f..26cd557 100644 --- a/src/QATools/Example/Pages/AccountPage.php +++ b/src/QATools/Example/Pages/AccountPage.php @@ -18,6 +18,7 @@ * Class LoginPage. * * @page-url('/account.html') + * @page-url-match('/account.html') */ class AccountPage extends TypifiedPage { diff --git a/src/QATools/Example/Pages/LoginPage.php b/src/QATools/Example/Pages/LoginPage.php index 7d088aa..2701108 100644 --- a/src/QATools/Example/Pages/LoginPage.php +++ b/src/QATools/Example/Pages/LoginPage.php @@ -18,6 +18,7 @@ * Class LoginPage. * * @page-url('/') + * @page-match-url('/') */ class LoginPage extends TypifiedPage { @@ -31,42 +32,22 @@ class LoginPage extends TypifiedPage protected $loginForm; /** - * Fill the login form with given data. + * Does the login. * * @param string $username The username. * @param string $password The password. + * @param string $success The success page. + * @param string $failure The failure page. * * @return static */ - public function fillForm($username, $password) + public function login($username, $password) { $this->loginForm->fill(array( 'username' => $username, 'password' => $password, )); - return $this; - } - - /** - * Does the login. - * - * @return Page - */ - public function loginSuccess() - { - $this->loginForm->submit(); - - return $this->pageFactory->getPage('Account Page'); - } - - /** - * Does a failing login. - * - * @return Page - */ - public function loginFailure() - { $this->loginForm->submit(); return $this; From a27f0c97e66c74616d8ff0e0e04aa03f40ccbb0e Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Mon, 23 Mar 2015 20:39:55 +0100 Subject: [PATCH 5/6] Completed simple example --- Features/bootstrap/MainContext.php | 6 ++- Features/login.feature | 2 +- Fixtures/index.html | 52 ------------------- Fixtures/index.php | 63 +++++++++++++++++++++++ Fixtures/login.php | 15 +++--- behat.yml | 2 +- composer.json | 8 +-- src/QATools/Example/Pages/AccountPage.php | 2 +- src/QATools/Example/Pages/LoginPage.php | 13 ++++- 9 files changed, 92 insertions(+), 71 deletions(-) delete mode 100755 Fixtures/index.html create mode 100755 Fixtures/index.php diff --git a/Features/bootstrap/MainContext.php b/Features/bootstrap/MainContext.php index cca400b..10f8d84 100644 --- a/Features/bootstrap/MainContext.php +++ b/Features/bootstrap/MainContext.php @@ -39,11 +39,13 @@ public function pageOpen($page) */ public function errorMessageVisible($message) { - + if ( $this->page->errorPane->getText() !== $message ) { + throw new Exception('Error message "' . $message . '" not visible!'); + }; } /** - * @Given /^the user waits for ([0-9]+) seconds$/ + * @Given /^I wait for ([0-9]+) seconds$/ */ public function waitFor($seconds) { diff --git a/Features/login.feature b/Features/login.feature index ca016f9..0cdc467 100644 --- a/Features/login.feature +++ b/Features/login.feature @@ -8,7 +8,7 @@ Feature: Login Given I'm on 'Login Page' When I login with 'username' and 'wrong password' Then I should be on 'Login page' - And I should see 'invalid username or password' error message + And I should see 'Invalid username or password!' error message @javascript @login @successful-login Scenario: Successful login of user diff --git a/Fixtures/index.html b/Fixtures/index.html deleted file mode 100755 index c291278..0000000 --- a/Fixtures/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - -
-
-
-
- - -
-
- - -
- -
-
-
-
-
-
-

Caption Column 1

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore - magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd - gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing - elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero - eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum - dolor sit amet. -
-
-

Caption Column 2

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore - magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd - gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing - elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero - eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum - dolor sit amet. -
-
- - - \ No newline at end of file diff --git a/Fixtures/index.php b/Fixtures/index.php new file mode 100755 index 0000000..f197d0b --- /dev/null +++ b/Fixtures/index.php @@ -0,0 +1,63 @@ + + + + + + + + + + + + + +
+
+
+ + + +
+ + +
+
+ + +
+ +
+
+
+
+
+
+

Caption Column 1

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et + dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur + sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At + vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem + ipsum + dolor sit amet. +
+
+

Caption Column 2

+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et + dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur + sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At + vero + eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem + ipsum + dolor sit amet. +
+
+ + + \ No newline at end of file diff --git a/Fixtures/login.php b/Fixtures/login.php index f30da06..da0529e 100755 --- a/Fixtures/login.php +++ b/Fixtures/login.php @@ -9,15 +9,18 @@ */ if ( empty($_POST) ) { - header('Location: index.html'); + header('Location: /?error'); + die(); } -if ( $_POST['username'] != 'user' ) { - header('Location: index.html'); +if ( $_POST['username'] !== 'username' ) { + header('Location: /?error'); + die(); } -if ( $_POST['password'] != 'validpassword' ) { - header('Location: index.html'); +if ( $_POST['password'] !== 'password' ) { + header('Location: /?error'); + die(); } -header('Location: account.html'); \ No newline at end of file +header('Location: /account.html'); \ No newline at end of file diff --git a/behat.yml b/behat.yml index 1f4c9c4..6bdb33a 100644 --- a/behat.yml +++ b/behat.yml @@ -14,5 +14,5 @@ default: QATools\BehatExtension: qa_tools: - base_url: 'http://behat-example.qa-tools.io' + base_url: 'http://localhost' page_namespace_prefix: ['\QATools\Example\Pages'] \ No newline at end of file diff --git a/composer.json b/composer.json index 23e12b8..7a02944 100644 --- a/composer.json +++ b/composer.json @@ -7,14 +7,10 @@ "behat/behat": "~3.0", "behat/mink-extension": "~2.0", "mindplay/annotations": "~1.2@dev", - "qa-tools/qa-tools": "dev-121-page-matcher", - "qa-tools/behat-extension": "dev-cleanup" + "qa-tools/qa-tools": "dev-develop", + "qa-tools/behat-extension": "dev-develop" }, "repositories": [ - { - "type": "vcs", - "url": "https://github.com/evangelion1204/qa-tools.git" - }, { "type": "vcs", "url": "https://github.com/evangelion1204/behat-extension.git" diff --git a/src/QATools/Example/Pages/AccountPage.php b/src/QATools/Example/Pages/AccountPage.php index 26cd557..621fb0f 100644 --- a/src/QATools/Example/Pages/AccountPage.php +++ b/src/QATools/Example/Pages/AccountPage.php @@ -18,7 +18,7 @@ * Class LoginPage. * * @page-url('/account.html') - * @page-url-match('/account.html') + * @page-url-match('path' => '/account.html') */ class AccountPage extends TypifiedPage { diff --git a/src/QATools/Example/Pages/LoginPage.php b/src/QATools/Example/Pages/LoginPage.php index 2701108..45b03cd 100644 --- a/src/QATools/Example/Pages/LoginPage.php +++ b/src/QATools/Example/Pages/LoginPage.php @@ -12,13 +12,14 @@ use QATools\QATools\HtmlElements\Element\Form; +use QATools\QATools\HtmlElements\Element\TextBlock; use QATools\QATools\HtmlElements\TypifiedPage; /** * Class LoginPage. * * @page-url('/') - * @page-match-url('/') + * @page-url-match('path' => '/') */ class LoginPage extends TypifiedPage { @@ -29,7 +30,15 @@ class LoginPage extends TypifiedPage * @var Form * @find-by('id' => 'login-form') */ - protected $loginForm; + public $loginForm; + + /** + * The error label. + * + * @var TextBlock + * @find-by('css' => '.alert') + */ + public $errorPane; /** * Does the login. From 90896e6004a929032f22eefab079bd46f61f96b5 Mon Sep 17 00:00:00 2001 From: Michael Iwersen Date: Wed, 1 Apr 2015 11:13:05 +0200 Subject: [PATCH 6/6] Changed annotation for match. --- src/QATools/Example/Pages/AccountPage.php | 2 +- src/QATools/Example/Pages/LoginPage.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/QATools/Example/Pages/AccountPage.php b/src/QATools/Example/Pages/AccountPage.php index 621fb0f..9fd921f 100644 --- a/src/QATools/Example/Pages/AccountPage.php +++ b/src/QATools/Example/Pages/AccountPage.php @@ -18,7 +18,7 @@ * Class LoginPage. * * @page-url('/account.html') - * @page-url-match('path' => '/account.html') + * @url-match-full('/account.html') */ class AccountPage extends TypifiedPage { diff --git a/src/QATools/Example/Pages/LoginPage.php b/src/QATools/Example/Pages/LoginPage.php index 45b03cd..4d07e9d 100644 --- a/src/QATools/Example/Pages/LoginPage.php +++ b/src/QATools/Example/Pages/LoginPage.php @@ -19,7 +19,7 @@ * Class LoginPage. * * @page-url('/') - * @page-url-match('path' => '/') + * @url-match-full('/') */ class LoginPage extends TypifiedPage {