From fd3f73af13a4fac95710359be9dcc40055f99583 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Thu, 31 May 2018 23:48:38 +0200 Subject: [PATCH] [FEATURE] Example acceptance tests with Codeception (#31) --- README.md | 18 ++++++++ Tests/Acceptance/StarterCest.php | 28 +++++++++++++ .../Acceptance/_support/AcceptanceTester.php | 26 ++++++++++++ .../Acceptance/_support/Helper/Acceptance.php | 10 +++++ .../Acceptance/_support/_generated/.gitignore | 2 + codeception.yml | 41 +++++++++++++++++++ composer.json | 2 + 7 files changed, 127 insertions(+) create mode 100644 Tests/Acceptance/StarterCest.php create mode 100644 Tests/Acceptance/_support/AcceptanceTester.php create mode 100644 Tests/Acceptance/_support/Helper/Acceptance.php create mode 100644 Tests/Acceptance/_support/_generated/.gitignore create mode 100644 codeception.yml diff --git a/README.md b/README.md index d8f6a3f..d7f4f09 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,24 @@ In the Run configurations, copy the PHPUnit configuration and use these settings - [x] Use alternative configuration file - use `.Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml` +### Running the acceptance tests + +#### On the command line + +1. make sure you have Chrome installed on your machine +2. `composer update codeception/codeception` (just in case) +3. [download the latest version of ChromeDriver](http://chromedriver.chromium.org/downloads) +4. unzip it +5. `chromedriver --url-base=/wd/hub &` +6. `.Build/vendor/bin/codecept run` +7. Run 'Acceptance (Codeception)' + + +#### In PhpStorm + +1. make sure the "Codeception Framework" plugin is activated +2. right-click on `Tests/Acceptance` + ## Creating new extensions with automated tests For creating new extensions, I recommend taking diff --git a/Tests/Acceptance/StarterCest.php b/Tests/Acceptance/StarterCest.php new file mode 100644 index 0000000..6f3bfad --- /dev/null +++ b/Tests/Acceptance/StarterCest.php @@ -0,0 +1,28 @@ + + */ +class StarterCest +{ + public function _before(\AcceptanceTester $I) + { + $I->amOnPage('/'); + } + + public function seeAuthorName(\AcceptanceTester $I) + { + $I->see('Oliver Klee'); + } + + public function canNavigateToPastWorkshops(\AcceptanceTester $I) + { + $I->click('Workshops'); + $I->click('Rückblick'); + $I->see('2017 (17)'); + } +} diff --git a/Tests/Acceptance/_support/AcceptanceTester.php b/Tests/Acceptance/_support/AcceptanceTester.php new file mode 100644 index 0000000..4c7dcbb --- /dev/null +++ b/Tests/Acceptance/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +