[2012-12-12] BEHAT: Create a feature file and script for Settings Menu #619

Closed
silverstripe-issues opened this Issue Apr 3, 2013 · 7 comments

Comments

Projects
None yet
6 participants

created by: lpercy
created at: 2012-12-12
original ticket: http://open.silverstripe.org/ticket/8111


As an administrator I want top be able to edit my global site settings from the settings menu. Title and tagline editing already tested in settings-main.feature.

@database-defaults

Background:
  Given I have an Administrator user in a Administrator Security Group
  Given I have an Content Author user in a Content Author Security Group

Scenario: I can edit my site access to 'Who can view pages on this site?'
  Given I am logged in as an "ADMIN"
    And I press the Settings button in the left menu
    And I see the Settings form
    And I select the 'Access' tab
    And I see a selection of radio buttons for 'Who can view pages on this site?'
   When I check "Anyone"
    And press the 'Save' button
   Then my site access is set to "Anyone" in the database
   When I visit /index.php as a non-restricted user 
   Then I can view the 'Home' page

   When I check "Logged-in users"
    And press the 'Save' button
   Then my site access is set to "restricted" in the database
   When I visit /index.php as a non-restricted user 
   Then I am shown a log in page

   When I check "Only these people (from list)"
    Then a Multi Select field appears
   When I click in the Multi Select field
     And I see a list of Security groups
     And I click on a "Administrators' Security group
   Then the "Administrators" group is added to the multi select field 
     And I press the 'Save' button
   Then my site access is set to "restricted" in the database
   When I visit /index.php as a non-restricted user 
   Then I am shown a log in page
   When I log in as a non-administrator
   Then i am shown the login page with a validation error
   When I log in as an Administrator
   Then I am Shown the Home page

Scenario: I can edit my site access to 'Who can view pages on this site?'
  Given I am logged in as an "ADMIN"
    And I press the Settings button in the left menu
    And I see the Settings form
    And I select the 'Access' tab
    And I see a selection of radio buttons for 'Who can view pages on this site?'
   When I check "Anyone"
    And press the 'Save' button
   Then my site access is set to "Anyone" in the database
   When I visit /index.php as a non-restricted user 
   Then I can view the 'Home' page

comment by: @chillu (ischommer)
created at: 2012-12-13


Then the Site Title is updated in the database
    And the Site title replaces "Your Site Name" in the CMS
   When I open my Home page in a browser
   Then I should see my updated Site title 

I'd prefer if we can steer clear of direct database state assertions, and look for user-visible aspects
like where the site title actually shows. And even if we make those state assertions,
please try to think how we can make those generic, otherwise we'll end up with a gazillion unmaintainable one-off step definitions.

Suggested alternative:

   Then the "SiteConfig" named "Default Config" has "Site Title" = "Test Site"
    And the CMS Menu contains "Test Site"
   When I go to "/home"
   Then I should see "Test Site"

Also, for assertions which rely on default data, please get in the habit of
creating a "Background" definition.

Given I have a "Group" called "Administrators" with "ADMIN" permissions
Given I have a "Group" called "CMS Authors" with "Access CMS" permissions
And I have a user "My User" belonging to the "Administrators" group

The actual syntax for this still needs to be fleshed out, but you get the gist, right?

stojg was assigned Jun 7, 2013

Contributor

stojg commented Jun 7, 2013

I believe I have to skip the scenario for themes switching, they are to fragile to implement.

Contributor

stojg commented Jun 7, 2013

Also I'm relying on running this test on a theme that uses the Title and Tagline in a Page.ss template.

@stojg stojg added a commit to silverstripe-scienceninjas/silverstripe-cms that referenced this issue Jun 7, 2013

@stojg stojg Behat: New feature "Edit site wide title and tagline" #619 d76db3d
Owner

chillu commented Jun 7, 2013

Agreed on the theme scenario. While we could require a second theme, it would need to be a manual "composer require". We can't put it into require on the behat-extensions, since that's only providing generic support, nothing framework specific. Also, the scenario test itself is not really high value, given how few people switch themes like this, and how much unit/functional coverage we already have on it. I've removed the scenario from the ticket.

I think relying on Page.ss having $Tagline etc is fair enough, I wouldn't expect the tests to run with anything other than the default theme.

Owner

chillu commented Nov 12, 2013

Removed the title/tagline and theme examples. The step wording needs some work as per previous comments, but I think at least some smoke tests for the access features (not all 9 permutations) are in order.

Contributor

srizzling commented Jan 15, 2014

Is this completed now? Most of this has seemed to move around a bit.

simonwelsh added the 3.1 label Mar 16, 2014

Owner

sminnee commented May 17, 2017

Obsolete.

sminnee closed this May 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment