Skip to content

Commit

Permalink
Merge branch '2.2' into 2
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 18, 2021
2 parents 4ba94b6 + 010b985 commit a470133
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: ~> 1.0

import:
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range.yml
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range-behat.yml
29 changes: 29 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
default:
suites:
taxonomy:
paths:
- "%paths.modules.taxonomy%/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\Taxonomy\Tests\Behat\Context\FeatureContext
- SilverStripe\Taxonomy\Tests\Behat\Context\FixtureContext
-
SilverStripe\Taxonomy\Tests\Behat\Context\FixtureContext:
- "%paths.modules.taxonomy%/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
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"autoload": {
"psr-4": {
"SilverStripe\\Taxonomy\\": "src/",
"SilverStripe\\Taxonomy\\Tests\\": "tests/"
"SilverStripe\\Taxonomy\\Tests\\": "tests/",
"SilverStripe\\Taxonomy\\Tests\\Behat\\Context\\": "tests/behat/src/"
}
},
"extra": [],
"minimum-stability": "dev",
"prefer-stable": true
}
}
Empty file added tests/behat/_manifest_exclude
Empty file.
42 changes: 42 additions & 0 deletions tests/behat/features/create-taxonomies.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Feature: Create taxonomies
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"

Scenario: Create taxonomy terms, types and link them together
# Only admins can create Taxonomy Types
Given I am logged in with "ADMIN" permissions
When I go to "/admin/taxonomy"
When I click the "Taxonomy Types" CMS tab
When I press the "Add Taxonomy Type" button
And I fill in "Name" with "My taxonomy type"
And I press the "Create" button
When I follow "Taxonomy Types"
Then I should see "My taxonomy type"

# Login as editor to create taxonomy term
When I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "EDITOR" permissions
When I go to "/admin/taxonomy"
Then I should see the ".current[aria-controls='Taxonomy_Terms']" element
When I press the "Add Taxonomy Term" button
And I fill in "Name" with "My taxonomy term"
And I select "My taxonomy type" from "Type"
And I press the "Create" button
When I follow "Taxonomy Terms"
Then I should see "My taxonomy term"

# Create child term
When I click the "Edit" button in the "SilverStripe-Taxonomy-TaxonomyTerm" gridfield for the "My taxonomy term" row
When I click the "Children" CMS tab
When I press the "Add Taxonomy Term" button
And I fill in "Name" with "My child taxonomy term"
And I press the "Create" button
When I follow "My taxonomy term"
And I click the "Children" CMS tab
Then I should see "My child taxonomy term"
When I follow "Taxonomy Terms"
Then I should not see "My child taxonomy term"
Empty file added tests/behat/files/blank.txt
Empty file.
9 changes: 9 additions & 0 deletions tests/behat/src/FeatureContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace SilverStripe\Taxonomy\Tests\Behat\Context;

use SilverStripe\BehatExtension\Context\SilverStripeContext;

class FeatureContext extends SilverStripeContext
{
}
9 changes: 9 additions & 0 deletions tests/behat/src/FixtureContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace SilverStripe\Taxonomy\Tests\Behat\Context;

use SilverStripe\BehatExtension\Context\FixtureContext as BaseFixtureContext;

class FixtureContext extends BaseFixtureContext
{
}
File renamed without changes.
File renamed without changes.

0 comments on commit a470133

Please sign in to comment.