diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 index f4bba82f..81bd606d --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ before_script: script: - bin/phpspec run -fpretty + - bin/behat --no-snippets --verbose notifications: webhooks: 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.dist b/behat.yml.dist old mode 100644 new mode 100755 index 49708adc..f81ab786 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -1,14 +1,27 @@ default: autoload: "Context": %paths.base%/features + "Page": %paths.base%/features suites: default: path: %paths.base%/features - contexts: - - Knp\FriendlyContexts\Context\MinkContext - - Knp\FriendlyContexts\Context\TableContext - - Knp\FriendlyContexts\Context\EntityContext - - Knp\FriendlyContexts\Context\AliceContext - - Knp\FriendlyContexts\Context\PageContext + contexts: + - Context\FeatureContext + - Knp\FriendlyExtension\Context\PageContext + - Knp\FriendlyExtension\Context\MinkContext + - Knp\FriendlyExtension\Context\ApiContext extensions: - Knp\FriendlyContexts\Extension: ~ + Knp\FriendlyExtension: + smart_tag: 'smart-step' + screenshot: + recipents: + - pierre.plazanet@knplabs.com + mailer: + username: smtp.knplabs@gmail.com + password: loremipsum + Behat\MinkExtension: + base_url: 'http://localhost:8080/' + goutte: ~ + selenium2: ~ + default_session: goutte + javascript_session: selenium2 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 index 0c0697f7..f946f063 --- a/composer.json +++ b/composer.json @@ -2,22 +2,30 @@ "name": "knplabs/friendly-contexts", "description": "Some BEHAT contexts", "autoload": { - "psr-0": { "Knp\\FriendlyContexts": "src/"} + "psr-0": { + "Knp\\FriendlyExtension": "src/" + } }, "require": { - "behat/behat": "~3.0", - "symfony/property-access": "~2.0", - "doctrine/inflector": "~1.0", - "doctrine/data-fixtures": "~1.0", - "behat/mink-extension": "~2.0", - "fzaninotto/faker": "~1.0", - "nelmio/alice": "~1.0", - "guzzle/guzzle": "~3.7" + "behat/behat": "~3.0", + "fzaninotto/faker": "~1.0", + "guzzle/guzzle": "~3.7", + "nelmio/alice": "~1", + "symfony/property-access": "~2.0", + "swiftmailer/swiftmailer": "~5.0" }, "require-dev": { - "phpspec/phpspec": "2.0.*@dev", - "doctrine/orm": "dev-master", - "knplabs/phpspec-welldone-extension": "dev-master" + "symfony/http-kernel": "~2.0", + "symfony/framework-bundle": "~2.0", + "doctrine/common": "~2.0", + "doctrine/data-fixtures": "~1.0", + "doctrine/orm": "~2.0", + "doctrine/inflector": "~1.0", + "behat/mink-extension": "~2.0", + "behat/mink-goutte-driver": "~1.0", + "behat/mink-selenium2-driver": "~1.0", + "phpspec/phpspec": "~2.0", + "knplabs/phpspec-welldone-extension": "dev-master" }, "license": "MIT", "authors": [ @@ -33,5 +41,5 @@ "config": { "bin-dir": "bin" }, - "minimum-stability": "dev" + "minimum-stability": "stable" } diff --git a/doc/configuration.md b/doc/configuration.md old mode 100644 new mode 100755 diff --git a/doc/context-alice.md b/doc/context-alice.md old mode 100644 new mode 100755 diff --git a/doc/context-api.md b/doc/context-api.md old mode 100644 new mode 100755 diff --git a/doc/context-entity.md b/doc/context-entity.md old mode 100644 new mode 100755 diff --git a/doc/context-mink.md b/doc/context-mink.md old mode 100644 new mode 100755 diff --git a/doc/context-page.md b/doc/context-page.md old mode 100644 new mode 100755 diff --git a/doc/context-table.md b/doc/context-table.md old mode 100644 new mode 100755 diff --git a/doc/feature-smartStep.md b/doc/feature-smartStep.md old mode 100644 new mode 100755 diff --git a/features/Context/FeatureContext.php b/features/Context/FeatureContext.php new file mode 100644 index 00000000..e25a34a1 --- /dev/null +++ b/features/Context/FeatureContext.php @@ -0,0 +1,16 @@ +get('mink')->getSession()->wait($seconds * 1000); + } +} diff --git a/features/Context/ServerContext.php b/features/Context/ServerContext.php new file mode 100644 index 00000000..7a5d89cc --- /dev/null +++ b/features/Context/ServerContext.php @@ -0,0 +1,70 @@ + %s 2>&1 & echo $! >> %s", $command, $outputfile, self::$proc)); + + $loop = 0; + while ($loop < 5) { + try { + self::test(); + return; + } catch (\Exception $ex) { + $loop++; + sleep(1); + } + } + } + + /** + * @BeforeScenario + */ + public static function test() + { + $ch = curl_init(sprintf('%s/html/index.html', self::SERVER_ADDRESS)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_exec($ch); + + if (200 !== curl_getinfo($ch, CURLINFO_HTTP_CODE)) { + + throw new \Exception('PHP builtin server is down.'); + } else { + + return; + } + } + + /** + * @AfterSuite + */ + public static function stop() + { + if (file_exists(self::$proc)) { + $pids = file(self::$proc); + foreach ($pids as $pid) { + shell_exec('kill -9 ' . $pid); + } + unlink(self::$proc); + } + } +} diff --git a/features/Page/APage.php b/features/Page/APage.php new file mode 100644 index 00000000..6c60879d --- /dev/null +++ b/features/Page/APage.php @@ -0,0 +1,13 @@ + +