From d8e3b06c1b9f44358864d9643495d5be05a87235 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 29 Sep 2021 16:39:32 +1300 Subject: [PATCH] MNT Add behat tests --- .travis.yml | 2 +- behat.yml | 29 +++++++++++++++++++ composer.json | 3 +- tests/behat/_manifest_exclude | 0 tests/behat/features/reports.feature | 16 ++++++++++ tests/behat/files/blank.txt | 0 tests/behat/src/FeatureContext.php | 9 ++++++ tests/behat/src/FixtureContext.php | 9 ++++++ tests/{ => php}/ReportAdminTest.php | 0 .../{ => php}/ReportAdminTest/FakeReport.php | 0 .../{ => php}/ReportAdminTest/FakeReport2.php | 0 tests/{ => php}/ReportTest.php | 0 tests/{ => php}/ReportTest/FakeObject.php | 0 tests/{ => php}/ReportTest/FakeTest.php | 0 tests/{ => php}/ReportTest/FakeTest2.php | 0 .../{ => php}/ReportTest/FakeTestAbstract.php | 0 16 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 behat.yml create mode 100644 tests/behat/_manifest_exclude create mode 100644 tests/behat/features/reports.feature create mode 100644 tests/behat/files/blank.txt create mode 100644 tests/behat/src/FeatureContext.php create mode 100644 tests/behat/src/FixtureContext.php rename tests/{ => php}/ReportAdminTest.php (100%) rename tests/{ => php}/ReportAdminTest/FakeReport.php (100%) rename tests/{ => php}/ReportAdminTest/FakeReport2.php (100%) rename tests/{ => php}/ReportTest.php (100%) rename tests/{ => php}/ReportTest/FakeObject.php (100%) rename tests/{ => php}/ReportTest/FakeTest.php (100%) rename tests/{ => php}/ReportTest/FakeTest2.php (100%) rename tests/{ => php}/ReportTest/FakeTestAbstract.php (100%) diff --git a/.travis.yml b/.travis.yml index 105d03d8..b01339ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ version: ~> 1.0 import: - - silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-fixed.yml + - silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-fixed-behat.yml env: global: diff --git a/behat.yml b/behat.yml new file mode 100644 index 00000000..db55fce3 --- /dev/null +++ b/behat.yml @@ -0,0 +1,29 @@ +default: + suites: + reports: + paths: + - "%paths.modules.reports%/tests/behat/features" + contexts: + - SilverStripe\Admin\Tests\Behat\Context\AdminContext + - SilverStripe\BehatExtension\Context\BasicContext + - SilverStripe\BehatExtension\Context\EmailContext + - SilverStripe\BehatExtension\Context\LoginContext + - SilverStripe\Framework\Tests\Behaviour\CmsFormsContext + - SilverStripe\Framework\Tests\Behaviour\CmsUiContext + - SilverStripe\Reports\Tests\Behat\Context\FeatureContext + - SilverStripe\Reports\Tests\Behat\Context\FixtureContext + - + SilverStripe\Reports\Tests\Behat\Context\FixtureContext: + - "%paths.modules.reports%/tests/behat/files/" + + extensions: + SilverStripe\BehatExtension\MinkExtension: + default_session: facebook_web_driver + javascript_session: facebook_web_driver + facebook_web_driver: + browser: chrome + wd_host: "http://127.0.0.1:9515" + + SilverStripe\BehatExtension\Extension: + screenshot_path: "%paths.base%/artifacts/screenshots" + bootstrap_file: vendor/silverstripe/framework/tests/behat/serve-bootstrap.php diff --git a/composer.json b/composer.json index 545972f0..7f764aa5 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,8 @@ "autoload": { "psr-4": { "SilverStripe\\Reports\\": "code/", - "SilverStripe\\Reports\\Tests\\": "tests/" + "SilverStripe\\Reports\\Tests\\": "tests/", + "SilverStripe\\Reports\\Tests\\Behat\\Context\\": "tests/behat/src/" } }, "minimum-stability": "dev", diff --git a/tests/behat/_manifest_exclude b/tests/behat/_manifest_exclude new file mode 100644 index 00000000..e69de29b diff --git a/tests/behat/features/reports.feature b/tests/behat/features/reports.feature new file mode 100644 index 00000000..fffde310 --- /dev/null +++ b/tests/behat/features/reports.feature @@ -0,0 +1,16 @@ +Feature: CMS reports + As a website user + I want to create and link taxonomies + + Background: + Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" and "TAXONOMYTERM_CREATE" and "TAXONOMYTERM_EDIT" and "TAXONOMYTERM_DELETE" + + # TODO: delete + Given I take a screenshot after every step + Given I dump the rendered HTML after every step + + +@sboyd + Scenario: Operate reports + Given I am logged in with "EDITOR" permissions + When I go to "/admin/reports" diff --git a/tests/behat/files/blank.txt b/tests/behat/files/blank.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/behat/src/FeatureContext.php b/tests/behat/src/FeatureContext.php new file mode 100644 index 00000000..9d9286f7 --- /dev/null +++ b/tests/behat/src/FeatureContext.php @@ -0,0 +1,9 @@ +