Feature: say hello to the first view

  Background: I should see the first view
    Given I see the first tab

  Scenario: I should be able to type something
    Then I type "Hello"

Clean up the Keyboard feature

Feature: Interacting with the
  In order to enter text like a user
  As an app tester
  I want Calabash to provide a Keyboard API

  Scenario: I should be able to type something
    Given I see the first tab
    Then I type "Hello"


Feature: Extract booking data
  In order to know how many bookings Pension Wise have made
  The booking manager will need booking data extracted from the booking system

  @wip
  Scenario: Data is extracted from the booking system api
    Given the booking system contains booking data
    When a list of bookings is requested from the booking api
    Then a list of bookings is extracted from the booking api

  @wip
  Scenario: Data is written to disk before any restructuring takes place
    When booking data is extracted from the booking api
    Then the extracted booking data is persisted to disk

  @wip
  Scenario: Isolating the changed data to allow selective processing
    When the booking data is a mix of new and already extracted data
    Then only the changed booking data is extracted

  @wip
  Scenario: Capturing all changes made to booking data
    When booking data has changed since it was previously extracted
    Then the changed booking data is extracted

  @wip
  Scenario: Tag changed data to distinguish corrections from updates

Add scenario for booking data compliance tracking

Feature: Extract booking data
  In order to know how many bookings Pension Wise have made
  The booking manager will need booking data extracted from the booking system

  @wip
  Scenario: Data is extracted from the booking system api
    Given the booking system contains booking data
    When a list of bookings is requested from the booking api
    Then a list of bookings is extracted from the booking api

  @wip
  Scenario: Data is written to disk before any restructuring takes place
    When booking data is extracted from the booking api
    Then the extracted booking data is persisted to disk

  @wip
  Scenario: Isolating the changed data to allow selective processing
    When the booking data is a mix of new and already extracted data
    Then only the changed booking data is extracted

  @wip
  Scenario: Capturing all changes made to booking data
    When booking data has changed since it was previously extracted
    Then the changed booking data is extracted

  @wip
  Scenario: Tag changed data to distinguish corrections from updates

  @wip
  Scenario: Support compliance tracking with additional metadata


Feature: Check the database

  Scenario: Run db check to check the database
    Given a WP install

    When I run `wp db check`
    Then STDOUT should contain:
      """
      Success: Database checked.
      """
    And STDERR should be empty

Check that a particular table was rendered

Feature: Check the database

  Scenario: Run db check to check the database
    Given a WP install

    When I run `wp db check`
    Then STDOUT should contain:
      """
      wp_cli_test.wp_users
      """
    And STDOUT should contain:
      """
      Success: Database checked.
      """
    And STDERR should be empty


@regression
Feature: Make sure there is no regression

Scenario: Make sure we can create sub class
  When I am connected with "admin" and "admin" on "/admin/sonata/demo/car/create?subclass=renault"
  Then I should see "Renault"

Add Behat print last response for debugging this regression test

@regression
Feature: Make sure there is no regression

Scenario: Make sure we can create sub class
  When I am connected with "admin" and "admin" on "/admin/sonata/demo/car/create?subclass=renault"
  Then print last response
  Then I should see "Renault"


Feature: Top Navigation

  Scenario: User has an organisation
    Given I have logged in as a member of DCLG
    When I visit the home page
    Then I should see a link to "Department for Communities and Local Government (DCLG)" in the header

Test custom 404 page when no route matches

Feature: Top Navigation

  Scenario: User has an organisation
    Given I have logged in as a member of DCLG
    When I visit the home page
    Then I should see a link to "Department for Communities and Local Government (DCLG)" in the header

  @allow-rescue
  Scenario: Visit a non-existent page, matching no routes
    Given I have logged in as an admin
    When I visit the path /totes/no/routes/here
    Then I should see our custom 404 page


Feature: Filter mappings
  As a GDS User with an interest in the quality of mappings,
  I want to filter the list of mappings
  so that I can get to the things I need to change faster

  Background:
    Given I have logged in as a GDS user
    And there is a site called directgov belonging to an organisation directgov with these mappings:
      | http_status | path             | new_url                                 |
      | 410         | /about/corporate |                                         |
      | 301         | /about/branding  | http://gov.uk/branding                  |
      | 301         | /                | http://gov.uk/directgov                 |
      | 410         | /notinfilter     |                                         |
    And I visit the path /sites/directgov/mappings

  Scenario: Filtering by start of path
    When I filter the path by /about
    Then the filter box should contain "/about"
    And I should see "/about/corporate"
    And I should see "/about/branding"
    But I should not see "/notinfilter"

  Scenario: Filtering by part of path
    When I filter the path by bout
    Then the filter box should contain "bout"
    And I should see "/about/corporate"
    And I should see "/about/branding"
    But I should not see "/notinfilter"

  Scenario: There are no matches
    When I filter the path by /is-not-there
    Then the filter box should contain "/is-not-there"
    And I should see a link to remove the filter

Add 'no mappings found' behaviour to mapping filter feature

Feature: Filter mappings
  As a GDS User with an interest in the quality of mappings,
  I want to filter the list of mappings
  so that I can get to the things I need to change faster

  Background:
    Given I have logged in as a GDS user
    And there is a site called directgov belonging to an organisation directgov with these mappings:
      | http_status | path             | new_url                                 |
      | 410         | /about/corporate |                                         |
      | 301         | /about/branding  | http://gov.uk/branding                  |
      | 301         | /                | http://gov.uk/directgov                 |
      | 410         | /notinfilter     |                                         |
    And I visit the path /sites/directgov/mappings

  Scenario: Filtering by start of path
    When I filter the path by /about
    Then the filter box should contain "/about"
    And I should see "/about/corporate"
    And I should see "/about/branding"
    But I should not see "/notinfilter"

  Scenario: Filtering by part of path
    When I filter the path by bout
    Then the filter box should contain "bout"
    And I should see "/about/corporate"
    And I should see "/about/branding"
    But I should not see "/notinfilter"

  Scenario: There are no matches
    When I filter the path by /is-not-there
    Then the filter box should contain "/is-not-there"
    And I should see "No mappings found."
    And I should see a link to remove the filter


@RALLY_US3478
Feature: Ingestion Index Validation Test

Scenario: Verify if Indexes are present

Given the log directory contains "ingestion.log" file
Then I should see either "Index verified" or "Index missing" following IngestionRouteBuilder in "ingestion.log" file

Update A/T to only check for message codes.

@RALLY_US3478
Feature: Ingestion Index Validation Test

Scenario: Verify if Indexes are present

Given the log directory contains "ingestion.log" file
Then I should see either "CORE_0018" or "CORE_0038" following IngestionRouteBuilder in "ingestion.log" file


Feature: configuration

  Scenario: Outputting the current config
    Given the default configuration
    When I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 25
    """

  Scenario: Setting the tomato duration
    Given the default configuration
    When I run `tam config duration=15`
    And I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 15
    """

  Scenario: Setting invalid duration
    Given the default configuration
    When I run `tam config duration=invalid_input`
    And I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 25
    """

  Scenario: Changing the tomato duration
    # This works in the app, but not here?
    Given pending
    Given there is no active tomato
    When I run `tam config duration=5`
    And I run `tam start`
    And I run `tam`
    Then the output should contain:
    """
    About 5 minutes
    """
    And the output should not contain:
    """
    About 25 minutes
    """

Enable previously pending cucumber feature

Feature: configuration

  Scenario: Outputting the current config
    Given the default configuration
    When I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 25
    """

  Scenario: Setting the tomato duration
    Given the default configuration
    When I run `tam config duration=15`
    And I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 15
    """

  Scenario: Setting invalid duration
    Given the default configuration
    When I run `tam config duration=invalid_input`
    And I run `tam config`
    Then the exit status should be 0
    Then the output should contain:
    """
    duration: 25
    """

  Scenario: Changing the tomato duration
    Given there is no active tomato
    When I run `tam config duration=5`
    And I run `tam start`
    And I run `tam`
    Then the output should contain:
    """
    About 5 minutes
    """
    And the output should not contain:
    """
    About 25 minutes
    """


Feature: Convert number to words

  Write some code that will accept an amount and convert it to the appropriate string representation.
    Example: Convert 2523.04 to "Two thousand five hundred twenty-three and 04/100 dollars"

  Scenario: I need help writing amounts on my checks
    When I run `convert 2523.04`
    Then the output should contain exactly:
      """
      Two thousand five hundred twenty-three and 04/100 dollars
      """

Refactor UAT while green. This sets me up for triangulation.

Feature: Convert number to words

  Write some code that will accept an amount and convert it to the appropriate string representation.
    Example: Convert 2523.04 to "Two thousand five hundred twenty-three and 04/100 dollars"

  Scenario Outline: I need help writing amounts on my checks
    When I run `convert <Amount>`
    Then the output should contain exactly "<String Representation>"

    Examples:
      | Amount  | String Representation                                     |
      | 2523.04 | Two thousand five hundred twenty-three and 04/100 dollars |


Feature: Upcoming meetings page

  As a Rubyist
  In order to find a user group I can go to to learn more about testing
  I visit the upcoming meetings page

  Scenario: No upcoming meetings
    Given there are no upcoming meetings
    And there is 1 past meeting
    When I visit the "Upcoming Meetings" page
    Then I should see the text "No meetings have been scheduled yet"
    And I should see a link to Dana's Twitter page

  Scenario: There is an upcoming meeting
    Given there is 1 upcoming meeting
    And there are 2 past meetings
    When I visit the "Upcoming Meetings" page
    Then I should see 1 meeting listed

Add additional scenarios to check differing behavior depending on whether user is logged in

Feature: Upcoming meetings page

  As a Rubyist
  In order to find a user group I can go to to learn more about testing
  I visit the upcoming meetings page

  Scenario: No upcoming meetings
    Given there are no upcoming meetings
    And there is 1 past meeting
    When I visit the "Upcoming Meetings" page
    Then I should see the text "No meetings have been scheduled yet"
    And I should see a link to Dana's Twitter page

  Scenario: There is an upcoming meeting
    Given there is 1 upcoming meeting
    And there are 2 past meetings
    When I visit the "Upcoming Meetings" page
    Then I should see 1 meeting listed

  Scenario: User is not logged in
    Given I am not logged in
    And there is 1 upcoming meeting
    When I visit the "Upcoming Meetings" page
    Then I should not see the text "Edit"

  Scenario: User is logged in
    Given I am logged in
    And there is 1 upcoming meeting
    When I visit the "Upcoming Meetings" page
    Then I should see the text "Edit"


Feature: Apps are up

  @api
  Scenario: Check the data API is up
    Given I have a URL for "dm_api"
      And I have an auth token for "dm_api"
    When I send a GET request with authorization to "/services"
    Then the response code should be "200"
    And the response should contain a JSON list of "services"

  @search-api
  Scenario: Check the search API is up
    Given I have a URL for "dm_search_api"
      And I have an auth token for "dm_search_api"
    When I send a GET request with authorization to "/"
    Then the response code should be "200"
    And the response should contain a JSON object "links"

  @buyer-frontend
  Scenario: Check the buyer frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to the home page
    Then the response code should be "200"

  @supplier-frontend
  Scenario: Check the supplier frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to "/suppliers"
    Then the response code should be "200"

  @admin-frontend
  Scenario: Check the admin frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to "/admin/login"
    Then the response code should be "200"

Change URL in apps are up test

Feature: Apps are up

  @api
  Scenario: Check the data API is up
    Given I have a URL for "dm_api"
      And I have an auth token for "dm_api"
    When I send a GET request with authorization to "/services"
    Then the response code should be "200"
    And the response should contain a JSON list of "services"

  @search-api
  Scenario: Check the search API is up
    Given I have a URL for "dm_search_api"
      And I have an auth token for "dm_search_api"
    When I send a GET request with authorization to "/"
    Then the response code should be "200"
    And the response should contain a JSON object "links"

  @buyer-frontend
  Scenario: Check the buyer frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to the home page
    Then the response code should be "200"

  @supplier-frontend
  Scenario: Check the supplier frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to "/suppliers/create"
    Then the response code should be "200"

  @admin-frontend
  Scenario: Check the admin frontend is up
    Given I have a URL for "dm_frontend"
    When I send a GET request to "/admin/login"
    Then the response code should be "200"


Feature: Deletable Block Storage

  @location @aws
  Scenario: Deploy compute node with deletable block storage
    Given I am authenticated with "ADMIN" role
    And I create a new application with name "compute" and description "Compute node support test" based on the template with name "org.alien4cloud.tests.topologies.computedeletableblock"
    And I Set a unique location policy to "cfy"/"aws" for all nodes
    When I deploy it
    Then I should receive a RestResponse with no error
    # This is a timeout but this will end ASAP.
    And The application's deployment must succeed after 15 minutes
    And I should have a volume for node "BlockStorage"
    And No volume id should be persisted for node "BlockStorage"

  @location @aws
  Scenario: Un deploy compute node with deletable block storage
    Given I am authenticated with "ADMIN" role
    When I undeploy it
    Then I should receive a RestResponse with no error
    Then I should not have a volume for node "BlockStorage"
    And No volume id should be persisted for node "BlockStorage"

Fix name of the application to deploy.

Feature: Deletable Block Storage

  @location @aws
  Scenario: Deploy compute node with deletable block storage
    Given I am authenticated with "ADMIN" role
    And I create a new application with name "computedeletableblock" and description "Deletable block storage support test" based on the template with name "org.alien4cloud.tests.topologies.computedeletableblock"
    And I Set a unique location policy to "cfy"/"aws" for all nodes
    When I deploy it
    Then I should receive a RestResponse with no error
    # This is a timeout but this will end ASAP.
    And The application's deployment must succeed after 15 minutes
    And I should have a volume for node "BlockStorage"
    And No volume id should be persisted for node "BlockStorage"

  @location @aws
  Scenario: Un deploy compute node with deletable block storage
    Given I am authenticated with "ADMIN" role
    When I undeploy it
    Then I should receive a RestResponse with no error
    Then I should not have a volume for node "BlockStorage"
    And No volume id should be persisted for node "BlockStorage"


@javascript
Feature: Overview page
  As a user
  I want to visit the licensing overview page
  So I can see summary data and navigate to other pages

  Scenario: visiting overview page
       When I go to /performance/licensing
       Then I should get back a status of 200

  Scenario: live service module
    Given The licensing realtime bucket returns the response in "licensing_realtime.json"
    When I go to /performance/licensing
    Then I should see the module "Real-time usage"
     And the module should contain the text "11 users online now"

  Scenario: form submissions module
    Given The licensing applications bucket returns the response in "licensing_applications.json"
    When I go to /performance/licensing
    Then I should see the module "Form submissions"
     And the module should contain a graph
     And the module should contain 2 tabs

  Scenario: completion rate module
    When I go to /performance/licensing
    Then I should see the module "Completion rate"

  Scenario: submission drop-offs module
    When I go to /performance/licensing
    Then I should see the module "Submission drop-offs"

  Scenario: top licences module
    When I go to /performance/licensing
    Then I should see the module "Top licences last week"
     And the module should contain a link to "/performance/licensing/licences"

  Scenario: top authorities module
    When I go to /performance/licensing
    Then I should see the module "Top authorities last week"
    And the module should contain a link to "/performance/licensing/authorities"

Update test for completion rate module

@javascript
Feature: Overview page
  As a user
  I want to visit the licensing overview page
  So I can see summary data and navigate to other pages

  Scenario: visiting overview page
       When I go to /performance/licensing
       Then I should get back a status of 200

  Scenario: live service module
    Given The licensing realtime bucket returns the response in "licensing_realtime.json"
    When I go to /performance/licensing
    Then I should see the module "Real-time usage"
     And the module should contain the text "11 users online now"

  Scenario: form submissions module
    Given The licensing applications bucket returns the response in "licensing_applications.json"
    When I go to /performance/licensing
    Then I should see the module "Form submissions"
     And the module should contain a graph
     And the module should contain 2 tabs

  Scenario: application submissions rate module
    When I go to /performance/licensing
    Then I should see the module "Application submissions rate"

  Scenario: submission drop-offs module
    When I go to /performance/licensing
    Then I should see the module "Submission drop-offs"

  Scenario: top licences module
    When I go to /performance/licensing
    Then I should see the module "Top licences last week"
     And the module should contain a link to "/performance/licensing/licences"

  Scenario: top authorities module
    When I go to /performance/licensing
    Then I should see the module "Top authorities last week"
    And the module should contain a link to "/performance/licensing/authorities"


@w3cvalidation
Feature: Check each of the digital register pages is w3c compliant

Scenario: Check the login page is w3c compliant
      Given I visit the login page
      Then the page is w3c compliant

Scenario: Check the search page is w3c compliant
      Given I am an initial private beta user
      When I have logged in
      Then the page is w3c compliant

Scenario: Check the digital register page is w3c compliant
      Given I am an initial private beta user
      And I have logged in
      And I have a title
      When I search for a property using the Title Number
      Then the page is w3c compliant

Scenario: Check the cookies page is w3c compliant
      Given I visit the cookies page
      Then the page is w3c compliant

Add two W3c tests for search results page (0 and many results)

@w3cvalidation
Feature: Check each of the digital register pages is w3c compliant

Scenario: Check the login page is w3c compliant
      Given I visit the login page
      Then the page is w3c compliant

Scenario: Check the search page is w3c compliant
      Given I am an initial private beta user
      When I have logged in
      Then the page is w3c compliant

Scenario: Check the digital register page is w3c compliant
      Given I am an initial private beta user
      And I have logged in
      And I have a title
      When I search for a property using the Title Number
      Then the page is w3c compliant

Scenario: Check the no search results page is w3c compliant
      Given I am an initial private beta user
      And I have logged in
      And I have a closed title
      When I search for a property using the Title Number
      Then the page is w3c compliant

Scenario: Check the search results page is w3c compliant
      Given I am an initial private beta user
      And I have 21 addresses in the same City
      And I have logged in
      When I search for a property using only the City part of an address
      Then the page is w3c compliant

Scenario: Check the cookies page is w3c compliant
      Given I visit the cookies page
      Then the page is w3c compliant


Feature: TestSystem.Integer

  Background:
    Given the type under test is Integer

  Scenario: Against an integer

    Given I dress JSON's '12'
    Then the result should be a representation for Integer
    And  the result should be the integer 12

  Scenario: Against a real

    Given I dress JSON's '12.5'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `12.5` |

  Scenario: Against an integer literal

    Given I dress JSON's '"12"'
    Then it should be a TypeError as:
      | message               |
      | Invalid Integer: `12` |

  Scenario: Against null

    Given I dress JSON's 'null'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `null` |

  Scenario: Against an arbitrary value

    Given I dress JSON's '"foo"'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `foo`  |

Add some integration test about Integer vs. Boolean.

Feature: TestSystem.Integer

  Background:
    Given the type under test is Integer

  Scenario: Against an integer

    Given I dress JSON's '12'
    Then the result should be a representation for Integer
    And  the result should be the integer 12

  Scenario: Against a real

    Given I dress JSON's '12.5'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `12.5` |

  Scenario: Against an integer literal

    Given I dress JSON's '"12"'
    Then it should be a TypeError as:
      | message               |
      | Invalid Integer: `12` |

  Scenario: Against null

    Given I dress JSON's 'null'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `null` |

  Scenario: Against true

    Given I dress JSON's 'true'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `true` |

  Scenario: Against an arbitrary value

    Given I dress JSON's '"foo"'
    Then it should be a TypeError as:
      | message                 |
      | Invalid Integer: `foo`  |


Feature: high school college-ready student list view

As a SEA/LEA user, I want to see the high school student list view
on SLI, so I could see high school students results

@integration  @RALLY_US200
Scenario: Check table headers
Given I have an open web browser
Given that dashboard has been authorized for all ed orgs
When I navigate to the Dashboard home page
When I select "Illinois Daybreak School District 4529" and click go
 And I was redirected to the "Simple" IDP Login page
 When I submit the credentials "cgray" "cgray1234" for the "Simple" login page
When I select ed org "Daybreak School District 4529"
When I select school "Daybreak Central High"
And I select course "American Literature"
And I select section "Sec 145"
And I select user view "College Ready ELA View"
Then the table includes header "Reading Test Scores (Highest);Writing Test Scores (Highest);AP Eng. Exam Scores (Highest);Attendance"

Revert "Fixing cgray's realm in test"

Feature: high school college-ready student list view

As a SEA/LEA user, I want to see the high school student list view
on SLI, so I could see high school students results

@integration  @RALLY_US200
Scenario: Check table headers
Given I have an open web browser
Given that dashboard has been authorized for all ed orgs
When I navigate to the Dashboard home page
When I select "Illinois Sunset School District 4526" and click go
 And I was redirected to the "Simple" IDP Login page
 When I submit the credentials "cgray" "cgray1234" for the "Simple" login page
When I select ed org "Daybreak School District 4529"
When I select school "Daybreak Central High"
And I select course "American Literature"
And I select section "Sec 145"
And I select user view "College Ready ELA View"
Then the table includes header "Reading Test Scores (Highest);Writing Test Scores (Highest);AP Eng. Exam Scores (Highest);Attendance"


Feature: Serving pages from front-end
  In order to view the website content efficiently
  a visitor
  wants to load pages with caching enhancements

  Scenario: Basic page rendering
    When I go to page '/first'
    Then I should get a 200 response code
    And I should see 'First body.'

  Scenario: Rendering deeply nested page
    When I go to page '/parent/child/grandchild/great-grandchild'
    Then I should get a 200 response code
    And I should see 'Great Grandchild body.'

  Scenario: Rendering cached page with ETag
    Given the page cache is clear
    When I go to page '/first'
    And I go to page '/first' sending the ETag
    Then I should get a 304 response code
    And I should get the same ETag header

  Scenario: Rendering cached page with ETag
    Given the page cache is clear
    When I go to page '/first'
    And I go to page '/first' sending the Last-Modified
    Then I should get a 304 response code
    And I should get the same Last-Modified header

Refactor page serving feature slightly.

Feature: Serving pages from front-end
  In order to view the website content efficiently
  a visitor
  wants to load pages with caching enhancements

  Background:
    Given the page cache is clear

  Scenario: Basic page rendering
    When I go to page '/first'
    Then I should get a 200 response code
    And I should see 'First body.'

  Scenario: Rendering deeply nested page
    When I go to page '/parent/child/grandchild/great-grandchild'
    Then I should get a 200 response code
    And I should see 'Great Grandchild body.'

  Scenario: Rendering cached page with ETag
    When I go to page '/first'
    And I go to page '/first' sending the ETag
    Then I should get a 304 response code
    And I should get the same ETag header

  Scenario: Rendering cached page with ETag
    When I go to page '/first'
    And I go to page '/first' sending the Last-Modified
    Then I should get a 304 response code
    And I should get the same Last-Modified header


@images
Feature: Images

    Background:
        #Given PhantomJS as the default browser
        #Given a browser
        Given "NinjaTester" as the persona
        When i visit mist.io
            Then I should see "mist.io"

    @web
    Scenario: Star Image
        When I click the "Add backend" button
        And I click the "Select provider" button
        And i click the "EC2 AP Sydney" button
        And I use my "EC2" credentials
        And I click the "Add" button
        And I wait for 1 seconds
            Then I should see the "EC2 AP Sydney" Backend added within 30 seconds

        When I click the "Images" button
        And I star a "SUSE" image
        And I visit mist.io
        And I click the "Images" button
            Then the first/second image should be "SUSE"

    @web
    Scenario: Advance Search - Star Image
        When I click the "Images" button
        And I type "django" in images search box
        And I click the "Continue search on server..." button
            Then I should see "django" images within 50 seconds
        When I star a "django" image
        And I visit mist.io
        And I click the "Images" button
            Then the first/second image should be "django"

Add waiting time in images tests

@images
Feature: Images

    Background:
        #Given PhantomJS as the default browser
        #Given a browser
        Given "NinjaTester" as the persona
        When i visit mist.io
            Then I should see "mist.io"

    @web
    Scenario: Star Image
        When I click the "Add backend" button
        And I click the "Select provider" button
        And i click the "EC2 AP Sydney" button
        And I use my "EC2" credentials
        And I click the "Add" button
        And I wait for 1 seconds
            Then I should see the "EC2 AP Sydney" Backend added within 30 seconds

        When I click the "Images" button
        And I wait for 3 seconds
        And I star a "SUSE" image
        And I visit mist.io
        And I click the "Images" button
        And I wait for 5 seconds
            Then the first/second image should be "SUSE"

    @web
    Scenario: Advance Search - Star Image
        When I click the "Images" button
        And I type "django" in images search box
        And I click the "Continue search on server..." button
            Then I should see "django" images within 50 seconds
        When I star a "django" image
        And I visit mist.io
        And I click the "Images" button
        And I wait for 5 seconds
            Then the first/second image should be "django"


Feature: Lookup a provider's NPI record
  In order retrieve the NPI record of a healthcare provider
  As a client system
  I want to query by NPI number

  Scenario: Retrieving provider record by NPI number
    Given the remote server will respond to an NPI request
    Then the record for NPI number "0123456789" should belong to "JOHN SNOW"

Fix test to use an active provider

Feature: Lookup a provider's NPI record
  In order retrieve the NPI record of a healthcare provider
  As a client system
  I want to query by NPI number

  Scenario: Retrieving provider record by NPI number
    Given the remote server will respond to an NPI request
    Then the record for NPI number "1154455640" should belong to "DIANA FENTON"


Feature: Doorbell

  Scenario: Someone rings the doorbell
    Given the "doorbell" button is "pressed"
    Then a screengrab of the "Driveway camera" is sent to "everyone"
    And a message reading "someone at the door" is sent to "everyone" with a button to "Unlock the door"

  Scenario: Someone rings the doorbell
    Given the "doorbell" button is "pressed"
    When the alarm is not "Away"
    And the "Kitchen" speaker says "someone at the door"
    And the "Garage" speaker says "someone at the door"

Make the door lock temporarily noisy

Feature: Doorbell

  Scenario: Someone rings the doorbell
    Given the "doorbell" button is "pressed"
    Then a screengrab of the "Driveway camera" is sent to "everyone"
    And a message reading "someone at the door" is sent to "everyone" with a button to "Unlock the door"

  Scenario: Someone rings the doorbell
    Given the "doorbell" button is "pressed"
    When the alarm is not "Away"
    And the "Kitchen" speaker says "someone at the door"
    And the "Garage" speaker says "someone at the door"

  Scenario: Make the door lock temporarily noisy
    Given the "doorbell" button is "pressed"
    Then the "front door lock" config "Audio Mode" should be "High"
    Then a delay of 1 minutes
    Then the "front door lock" config "Audio Mode" should be "Silent"


Feature: Post Configuration Hook [#423]

  In order to extend Cucumber
  As a developer
  I want to manipulate the Cucumber configuration after it has been created

  Scenario: Using options directly gets a deprecation warning

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.options[:blah]
      end
      """
    When I run `cucumber features`
    Then the stderr should contain:
      """
      Deprecated
      """

  Scenario: Changing the output format
    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.formats << ['html', config.out_stream]
      end
      """
    When I run `cucumber features`
    Then the stderr should not contain anything
    And the output should contain:
      """
      html
      """

  Scenario: feature directories read from configuration

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.out_stream << "AfterConfiguration hook read feature directories: #{config.feature_dirs.join(', ')}"
      end
      """
    When I run `cucumber features`
    Then the stderr should not contain anything
    And the output should contain:
      """
      AfterConfiguration hook read feature directories: features
      """

Add spawn flag to Aruba scenario that requires it

Feature: Post Configuration Hook [#423]

  In order to extend Cucumber
  As a developer
  I want to manipulate the Cucumber configuration after it has been created

  @spawn
  Scenario: Using options directly gets a deprecation warning

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.options[:blah]
      end
      """
    When I run `cucumber features`
    Then the stderr should contain:
      """
      Deprecated
      """

  Scenario: Changing the output format
    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.formats << ['html', config.out_stream]
      end
      """
    When I run `cucumber features`
    Then the stderr should not contain anything
    And the output should contain:
      """
      html
      """

  Scenario: feature directories read from configuration

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.out_stream << "AfterConfiguration hook read feature directories: #{config.feature_dirs.join(', ')}"
      end
      """
    When I run `cucumber features`
    Then the stderr should not contain anything
    And the output should contain:
      """
      AfterConfiguration hook read feature directories: features
      """


@integrations-delete
Feature: Test to verify delete action
  https://issues.jboss.org/browse/IPAAS-290

  Scenario: Create integration
    When "Camilla" navigates to the "Home" page
    And clicks on the "Create Integration" button to create a new integration.
    Then she is presented with a visual integration editor
    And she is prompted to select a "Start" connection from a list of available connections

    When Camilla selects the "Twitter Example" connection
    And she selects "Mention" integration action
    Then she is prompted to select a "Finish" connection from a list of available connections

    When Camilla selects the "Salesforce Example" connection
    And she selects "Create Opportunity" integration action
    Then she is presented with the "Add a Step" button
    And click on the "Save" button

    When Camilla clicks on the "Save as Draft" button
    And she defines integration name "Awesome integration for delete"
    And click on the "Publish" button
    Then Camilla is presented with the Syndesis page "Integrations"
    And Integration "Awesome integration for delete" is present in integrations list

    When Camilla deletes the "Awesome integration for delete" integration
    Then Camilla can not see "Awesome integration for delete" integration anymore

Create integration for delete as draft

@integrations-delete
Feature: Test to verify delete action
  https://issues.jboss.org/browse/IPAAS-290

  Scenario: Create integration draft and delete it
    When "Camilla" navigates to the "Home" page
    And clicks on the "Create Integration" button to create a new integration.
    Then she is presented with a visual integration editor
    And she is prompted to select a "Start" connection from a list of available connections

    When Camilla selects the "Twitter Example" connection
    And she selects "Mention" integration action
    Then she is prompted to select a "Finish" connection from a list of available connections

    When Camilla selects the "Salesforce Example" connection
    And she selects "Create Opportunity" integration action
    Then she is presented with the "Add a Step" button
    And click on the "Save" button

    And she defines integration name "Awesome integration for delete"
    And click on the "Camilla clicks on the "Save as Draft" button" button
    Then Camilla is presented with the Syndesis page "Integrations"
    And Integration "Awesome integration for delete" is present in integrations list

    When Camilla deletes the "Awesome integration for delete" integration
    Then Camilla can not see "Awesome integration for delete" integration anymore


Feature: web-system-app
 Scenario: Crosswalk FullScreen reopen
  When launch "fullscreen"
    And I wait 2 seconds
    And I click view "description=FullScreen"
    And I wait 2 seconds
    And I take screenshot as "requestFullScreen-reopen"
    And I save the screenshot md5 as "requestFullScreen-reopen"
   Then file "requestFullScreen-reopen" of baseline and result should be the same
    And I press "home" hardware key
    And I press "recent" hardware key
    And I save relative view "className=android.widget.ImageView" on the "right" side of view "text=FullScreen" to object "fullscreen_app"
    And I click saved object "fullscreen_app"
    And I wait 2 seconds
    And I click view "description=Cancel FullScreen"
    And I wait 2 seconds
    And I save the page to "cancelFullScreen-reopen"
    And I save the screenshot md5 as "cancelFullScreen-reopen"
   Then file "cancelFullScreen-reopen" of baseline and result should be the same
    And I press "home" hardware key
    And I press "recent" hardware key
    And I save relative view "className=android.widget.ImageView" on the "right" side of view "text=FullScreen" to object "fullscreen_app"
    And I click saved object "fullscreen_app"
   Then file "cancelFullScreen-reopen" of baseline and result should be the same

Update steps for Crosswalk FullScreen Reopen

Feature: web-system-app
 Scenario: Crosswalk FullScreen reopen
  When launch "fullscreen"
    And I wait 2 seconds
    And I click view "description=FullScreen"
    And I wait 2 seconds
    And I take screenshot as "requestFullScreen-reopen"
    And I save the screenshot md5 as "requestFullScreen-reopen"
   Then file "requestFullScreen-reopen" of baseline and result should be the same
    And switch to "fullscreen"
    And I wait 2 seconds
    And I click view "description=Cancel FullScreen"
    And I wait 2 seconds
    And I save the page to "cancelFullScreen-reopen"
    And I save the screenshot md5 as "cancelFullScreen-reopen"
   Then file "cancelFullScreen-reopen" of baseline and result should be the same
    And switch to "fullscreen"
   Then file "cancelFullScreen-reopen" of baseline and result should be the same


Feature: Stamp Duty Information Table
In order to understand how my stamp duty is calculated
As a home buyer
I want to see what percentages apply to the purchase price

Scenario: As a home buyer
  Given I visit the Stamp Duty page
  When I am a first time buyer
  And I reach the results page
  Then I should see the stamp duty percentages for first time buyers as:
    | Purchase Price of property | Rate of Stamp Duty | Buy to Let/Additional Home Rate* |
    | £0 - £125,000              | 0%                 | 3%           |
    | £125,001 - £250,000        | 2%                 | 5%           |
    | £250,001 - £925,000        | 3%                 | 8%           |
    | £925,001 - £1,500,000      | 10%                | 13%          |
    | over £1.5 million          | 12%                | 15%          |

Comment out test as pending breaks build

# Feature: Stamp Duty Information Table
# In order to understand how my stamp duty is calculated
# As a home buyer
# I want to see what percentages apply to the purchase price

# Scenario: As a home buyer
#   Given I visit the Stamp Duty page
#   When I am a first time buyer
#   And I reach the results page
#   Then I should see the stamp duty percentages for first time buyers as:
#     | Purchase Price of property | Rate of Stamp Duty | Buy to Let/Additional Home Rate* |
#     | £0 - £125,000              | 0%                 | 3%           |
#     | £125,001 - £250,000        | 2%                 | 5%           |
#     | £250,001 - £925,000        | 3%                 | 8%           |
#     | £925,001 - £1,500,000      | 10%                | 13%          |
#     | over £1.5 million          | 12%                | 15%          |


@cli @skip_on_objectstore @encryption
Feature: recreate-master-key

  Scenario: recreate masterkey
    Given user "admin" has uploaded file "data/textfile.txt" to "/somefile.txt"
    When the administrator successfully recreates the encryption masterkey using the occ command
    Then the downloaded content when downloading file "/somefile.txt" for user "admin" with range "bytes=0-6" should be "This is"

  Scenario: recreate masterkey and upload data
    Given user "user0" has been created with default attributes
    And user "user0" has uploaded file "data/textfile.txt" to "/somefile.txt"
    When the administrator successfully recreates the encryption masterkey using the occ command
    And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
    Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"

Change stable10-only steps to use filesForUpload

@cli @skip_on_objectstore @encryption
Feature: recreate-master-key

  Scenario: recreate masterkey
    Given user "admin" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt"
    When the administrator successfully recreates the encryption masterkey using the occ command
    Then the downloaded content when downloading file "/somefile.txt" for user "admin" with range "bytes=0-6" should be "This is"

  Scenario: recreate masterkey and upload data
    Given user "user0" has been created with default attributes
    And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt"
    When the administrator successfully recreates the encryption masterkey using the occ command
    And user "user0" uploads chunk file "1" of "1" with "AA" to "/somefile.txt" using the WebDAV API
    Then the downloaded content when downloading file "/somefile.txt" for user "user0" with range "bytes=0-3" should be "AA"


@documents
Feature: Documentss

  Background:
    Given I am logged in as an admin
    And I navigate to "/events"
    And I toggle sorting on the "lastModifiedDate" column
    And I navigate to the first event

  Scenario: I add a custom document to an event
    When I click on the add document button
    And I create a document with a title of "Test Document", url of "http://www.promedmail.org/post/2579682", and datetime of now
    Then I should see content "Test Document"

  Scenario: I edit an existing document
    When I select the existing document
    Then I should not see content "Updated Title"
    Then I edit the existing document
    And I change the document title to "Updated Title" and datetime to now
    Then I should see content "Updated Title"

  Scenario: I delete an existing document
    When I select the existing document
    Then I delete the existing document
    And I "confirm" deletion
    Then I should see an empty documents table

Sort eventName column in ascending order in tests

@documents
Feature: Documentss

  Background:
    Given I am logged in as an admin
    And I navigate to "/events"
    And I toggle sorting on the "eventName" column
    And I toggle sorting on the "eventName" column
    And I navigate to the first event

  Scenario: I add a custom document to an event
    When I click on the add document button
    And I create a document with a title of "Test Document", url of "http://www.promedmail.org/post/2579682", and datetime of now
    Then I should see content "Test Document"

  Scenario: I edit an existing document
    When I select the existing document
    Then I should not see content "Updated Title"
    Then I edit the existing document
    And I change the document title to "Updated Title" and datetime to now
    Then I should see content "Updated Title"

  Scenario: I delete an existing document
    When I select the existing document
    Then I delete the existing document
    And I "confirm" deletion
    Then I should see an empty documents table


Feature: Feature2
  This is the description for Feature2

  Scenario: Determine future date one day after today
    Given today is 2015-12-20
    When I ask if Dec 21, 2015 is in the past
    Then the result should be no

  Scenario: Determine future date ten days after today
    Given today is 2015-12-20
    When I ask if Dec 30, 2015 is in the past
    Then the result should be no

Change the testcase to run ATE

@calculator
Feature: Feature2
  This is the description for Feature2

  Scenario: Determine future date one day after today
    Given today is 2015-12-20
    When I ask if Dec 21, 2015 is in the past
    Then the result should be no

  Scenario: Determine future date ten days after today
    Given today is 2015-12-20
    When I ask if Dec 30, 2015 is in the past
    Then the result should be no


Feature: ASCII Text Size
  The DSL provides a number of default sizes.
  Due to the way sizes work across languages
  size and font have been extracted out. This
  means that the size will be approximate

  Scenario: Font A Text on ZPL2
    Given a DSL with:
    """ruby
    ZebraPrinterDocument.new do
      language :zpl2
      font(:size => :large, :name => 'A') do
        text ''
      end
    end
    """
    When I execute the DSL
    Then the output should be like "\^AA,N,\d+,\d+"

Scenario: Font 0 Text on ZPL2
    Given a DSL with:
    """ruby
    ZebraPrinterDocument.new do
      language :zpl2
      font(:size => :large, :name => '0') do
        text ''
      end
    end
    """
    When I execute the DSL
    Then the output should be like "\^A0,N,\d+,\d+"

Update feature to include re def test

Feature: ASCII Text Font
  The DSL support the change of fonts

  Scenario: Font A Text on ZPL2
    Given a DSL with:
    """ruby
    ZebraPrinterDocument.new do
      language :zpl2
      font(:size => :large, :name => 'A') do
        text ''
      end
    end
    """
    When I execute the DSL
    Then the output should be like "\^AA,N,\d+,\d+"

  Scenario: Font 0 Text on ZPL2
    Given a DSL with:
    """ruby
    ZebraPrinterDocument.new do
      language :zpl2
      font(:size => :large, :name => '0') do
        text ''
      end
    end
    """
    When I execute the DSL
    Then the output should be like "\^A0,N,\d+,\d+"

  Scenario: Font A Text on ZPL2 out of order
    Given a DSL with:
    """ruby
    ZebraPrinterDocument.new do
      language :zpl2
      font(:name => 'A') do
        font(:size => :x_large) do
          text ''
        end
      end
    end
    """
    When I execute the DSL
    Then the output should include "^AA,N,60,60"


Feature: Uninstall a WordPress plugin

  Background:
    Given a WP install

  Scenario: Uninstall an installed plugin
    When I run `wp plugin uninstall akismet`
    Then STDOUT should be:
      """
      Uninstalled and deleted 'akismet' plugin.
      Success: Uninstalled 1 of 1 plugins.
      """
    And the return code should be 0

  Scenario: Attempting to uninstall a plugin that's activated
    When I run `wp plugin activate akismet`
    Then STDOUT should not be empty

    When I try `wp plugin uninstall akismet`
    Then STDERR should be:
      """
      Warning: The 'akismet' plugin is active.
      Error: No plugins uninstalled.
      """
    And the return code should be 0

  Scenario: Attempting to uninstall a plugin that doesn't exist
    When I run `wp plugin uninstall edit-flow`
    Then STDOUT should be:
      """
      Success: Plugin already uninstalled.
      """
    And STDERR should be:
      """
      Warning: The 'edit-flow' plugin could not be found.
      """
    And the return code should be 0

Fix expected return code for test

Feature: Uninstall a WordPress plugin

  Background:
    Given a WP install

  Scenario: Uninstall an installed plugin
    When I run `wp plugin uninstall akismet`
    Then STDOUT should be:
      """
      Uninstalled and deleted 'akismet' plugin.
      Success: Uninstalled 1 of 1 plugins.
      """
    And the return code should be 0

  Scenario: Attempting to uninstall a plugin that's activated
    When I run `wp plugin activate akismet`
    Then STDOUT should not be empty

    When I try `wp plugin uninstall akismet`
    Then STDERR should be:
      """
      Warning: The 'akismet' plugin is active.
      Error: No plugins uninstalled.
      """
    And the return code should be 1

  Scenario: Attempting to uninstall a plugin that doesn't exist
    When I run `wp plugin uninstall edit-flow`
    Then STDOUT should be:
      """
      Success: Plugin already uninstalled.
      """
    And STDERR should be:
      """
      Warning: The 'edit-flow' plugin could not be found.
      """
    And the return code should be 0


Feature: Get help

  As a GitHub user
  I want to be able to list help information for reponaut
  In order to learn how to use it

  Scenario: List usage details
    When I run `reponaut -h`
    Then it should pass with:
      """
      Usage: reponaut [OPTIONS] USERNAME

      Options:
          -s, --sort          Sort by repo count
          -f, --ignore-forks  Ignore forked repos
          -h, --help
          --version
      """

  Scenario: List usage details with long option
    When I run `reponaut --help`
    Then it should pass with:
      """
      Usage: reponaut [OPTIONS] USERNAME

      Options:
          -s, --sort          Sort by repo count
          -f, --ignore-forks  Ignore forked repos
          -h, --help
          --version
      """

  Scenario: Get version
    When I run `reponaut --version`
    Then the exit status should be 0
    And the stdout should contain:
      """
      reponaut, version
      """

  Scenario: Specify an invalid option
    When I run `reponaut -b`
    Then the exit status should not be 0
    And the stderr should contain:
      """
      unknown option `-b'
      Run `reponaut --help` for help information
      """

Define what happens if no arguments are given to reponaut

Feature: Get help

  As a GitHub user
  I want to be able to list help information for reponaut
  In order to learn how to use it

  Scenario: List usage details
    When I run `reponaut -h`
    Then it should pass with:
      """
      Usage: reponaut [OPTIONS] USERNAME

      Options:
          -s, --sort          Sort by repo count
          -f, --ignore-forks  Ignore forked repos
          -h, --help
          --version
      """

  Scenario: List usage details with long option
    When I run `reponaut --help`
    Then it should pass with:
      """
      Usage: reponaut [OPTIONS] USERNAME

      Options:
          -s, --sort          Sort by repo count
          -f, --ignore-forks  Ignore forked repos
          -h, --help
          --version
      """

  Scenario: Get version
    When I run `reponaut --version`
    Then the exit status should be 0
    And the stdout should contain:
      """
      reponaut, version
      """

  Scenario: Specify an invalid option
    When I run `reponaut -b`
    Then the exit status should not be 0
    And the stderr should contain:
      """
      unknown option `-b'
      Run `reponaut --help` for help information
      """

  Scenario: Specify no options
    When I run `reponaut`
    Then the exit status should not be 0
    And the stderr should contain:
      """
      Usage: reponaut [OPTIONS] USERNAME

      Options:
          -s, --sort          Sort by repo count
          -f, --ignore-forks  Ignore forked repos
          -h, --help
          --version
      """


Feature: Package behaviors
  In order to avoid repetitive package setup
  As a developer
  I want to define behaviors and mix them into packages

  Scenario: Defining a behavior and using it in multiple packages
    Given the file "fixtures/source/foo.js" contains
      """javascript
      /* comment */
      """
    And the app is configured as follows
      """ruby
      Pannier.build do
        source 'fixtures/source'
        result 'fixtures/result'

        behavior :bar do
          modify do |content, name|
            [content.reverse, name]
          end
        end

        package :baz do
          behave :bar
          assets 'foo.js'
        end
      end
      """
    And the app has been processed
    When I request "/foo.js"
    Then the response body should be
      """javascript
      /* tnemmoc */
      """

Fix basename ref in behavior feature

Feature: Package behaviors
  In order to avoid repetitive package setup
  As a developer
  I want to define behaviors and mix them into packages

  Scenario: Defining a behavior and using it in multiple packages
    Given the file "fixtures/source/foo.js" contains
      """javascript
      /* comment */
      """
    And the app is configured as follows
      """ruby
      Pannier.build do
        source 'fixtures/source'
        result 'fixtures/result'

        behavior :bar do
          modify do |content, basename|
            [content.reverse, basename]
          end
        end

        package :baz do
          behave :bar
          assets 'foo.js'
        end
      end
      """
    And the app has been processed
    When I request "/foo.js"
    Then the response body should be
      """javascript
      /* tnemmoc */
      """


Feature: List WordPress options

  Scenario: Using the `--transients` flag
    Given a WP install
    And I run `wp transient set wp_transient_flag wp_transient_flag`

    When I run `wp option list --no-transients`
    Then STDOUT should not contain:
      """
      wp_transient_flag
      """
    And STDOUT should not contain:
      """
      _transient
      """
    And STDOUT should contain:
      """
      siteurl
      """

    When I run `wp option list --transients`
    Then STDOUT should contain:
      """
      wp_transient_flag
      """
    And STDOUT should contain:
      """
      _transient
      """
    And STDOUT should not contain:
      """
      siteurl
      """

Add test for exclude pattern in option list

Feature: List WordPress options

  Scenario: Using the `--transients` flag
    Given a WP install
    And I run `wp transient set wp_transient_flag wp_transient_flag`

    When I run `wp option list --no-transients`
    Then STDOUT should not contain:
      """
      wp_transient_flag
      """
    And STDOUT should not contain:
      """
      _transient
      """
    And STDOUT should contain:
      """
      siteurl
      """

    When I run `wp option list --transients`
    Then STDOUT should contain:
      """
      wp_transient_flag
      """
    And STDOUT should contain:
      """
      _transient
      """
    And STDOUT should not contain:
      """
      siteurl
      """

  Scenario: List option with exclude pattern
    Given a WP install

    When I run `wp option add sample_test_field_one sample_test_field_value_one`
    And I run `wp option add sample_test_field_two sample_test_field_value_two`
    And I run `wp option list --search="sample_test_field_*" --format=csv`
    Then STDOUT should be:
      """
      option_name,option_value
      sample_test_field_one,sample_test_field_value_one
      sample_test_field_two,sample_test_field_value_two
      """

    When I run `wp option list --search="sample_test_field_*" --exclude="*field_one" --format=csv`
    Then STDOUT should be:
      """
      option_name,option_value
      sample_test_field_two,sample_test_field_value_two
      """

    When I run `wp option list`
    Then STDOUT should contain:
      """
      sample_test_field_one
      """

    When I run `wp option list --exclude="sample_test_field_one"`
    Then STDOUT should not contain:
      """
      sample_test_field_one
      """


Feature: Features

  As a client
  I want to know what FTP extension the server supports
  So that I can use them without trial-and-error

  Background:

  Scenario: TLS Disabled
    Given the test server is started
    And the client connects
    When the client successfully requests features
    Then the response should not include TLS features

  Scenario: TLS Enabled
    Given the test server has TLS mode "explicit"
    And the test server is started
    And the client connects
    When the client successfully requests features
    Then the response should include TLS features

  Scenario: Argument given
    Given the test server is started
    And the client connects
    When the client sends "FEAT FOO"
    Then the server returns a syntax error

Test FEAT for IPV6 extensions

Feature: Features

  As a client
  I want to know what FTP extension the server supports
  So that I can use them without trial-and-error

  Background:

  Scenario: TLS Disabled
    Given the test server is started
    And the client connects
    When the client successfully requests features
    Then the response should not include TLS features

  Scenario: TLS Enabled
    Given the test server has TLS mode "explicit"
    And the test server is started
    And the client connects
    When the client successfully requests features
    Then the response should include TLS features

  Scenario: Argument given
    Given the test server is started
    And the client connects
    When the client sends "FEAT FOO"
    Then the server returns a syntax error

  Scenario: IPV6 Extensions
    Given the test server is started
    When the client successfully requests features
    Then the response should include feature "EPRT"
    And the response should include feature "EPSV"


# encoding: UTF-8
# language: no

@wip
Egenskap: Innlevering av bok
  Som adminbruker
  For å betjene låneren Knut
  Ønsker jeg å registrere boka han har lånt som innlevert

Bakgrunn:
  Gitt at jeg er pålogget som adminbruker
  Og at Knut eksisterer som en låner
  Og at "Fargelegg byen!" er ei bok som finnes i biblioteket

  @wip
  Scenario:
  	Gitt at "Fargelegg byen!" er utlånt til "Knut"
  	Når "Fargelegg byen!" blir registrert innlevert
  	Så registrerer systemet at Knut ikke låner "Fargelegg byen!"

Change wording in background and scenario to omit individual names

# encoding: UTF-8
# language: no

@wip
Egenskap: Innlevering av bok
  Som adminbruker
  For å betjene en låner
  Ønsker jeg å registrere at låneren leverer en lånt bok

Bakgrunn:
  Gitt at jeg er pålogget som adminbruker
  Og at det finnes en låner
  Og at det finnes en bok

  @wip
  Scenario:
  	Gitt at en bok er utlånt til en låner
  	Når boka blir registrert innlevert
  	Så viser systemet at låneren ikke låner boka


Feature: Extract booking data
  In order to know how many bookings Pension Wise have made
  The booking manager will need booking data extracted from the booking system

  @wip
  Scenario: Data is extracted from the booking system api
    Given the booking system contains booking data
    When a list of bookings is requested from the booking api
    Then a list of bookings is extracted from the booking api

  @wip
  Scenario: Data is written to disk before any restructuring takes place
    When booking data is extracted from the booking api
    Then the extracted booking data is persisted to disk

  @wip
  Scenario: Isolating the changed data to allow selective processing
    When the booking data is a mix of new and already extracted data
    Then only the changed booking data is extracted

  @wip
  Scenario: Capturing all changes made to booking data
    When booking data has changed since it was previously extracted
    Then the changed booking data is extracted

Add scenario for tagging changes to booking data

Feature: Extract booking data
  In order to know how many bookings Pension Wise have made
  The booking manager will need booking data extracted from the booking system

  @wip
  Scenario: Data is extracted from the booking system api
    Given the booking system contains booking data
    When a list of bookings is requested from the booking api
    Then a list of bookings is extracted from the booking api

  @wip
  Scenario: Data is written to disk before any restructuring takes place
    When booking data is extracted from the booking api
    Then the extracted booking data is persisted to disk

  @wip
  Scenario: Isolating the changed data to allow selective processing
    When the booking data is a mix of new and already extracted data
    Then only the changed booking data is extracted

  @wip
  Scenario: Capturing all changes made to booking data
    When booking data has changed since it was previously extracted
    Then the changed booking data is extracted

  @wip
  Scenario: Tag changed data to distinguish corrections from updates


Feature: Tagging content with specialist sectors
  In order to make my content available to users with specialist needs
  As a departmental content editor
  I want to be able to tag my content to one or more specialist sectors

  @real_content_api
  Scenario: writer can add tag documents with specialist sectors
    Given I am a writer
      And there are some specialist sectors
    When I start editing a draft document
    Then I can tag it to some specialist sectors

Fix typo in specialist sector scenario

Feature: Tagging content with specialist sectors
  In order to make my content available to users with specialist needs
  As a departmental content editor
  I want to be able to tag my content to one or more specialist sectors

  @real_content_api
  Scenario: writer can tag documents with specialist sectors
    Given I am a writer
      And there are some specialist sectors
    When I start editing a draft document
    Then I can tag it to some specialist sectors


Feature: Runtime versions are included in all requests

Scenario: Runtime versions included in Cocoa error
    When I run "HandledErrorScenario"
    Then I should receive a request
    And the request is valid for the error reporting API
    And the payload field "events.0.device.runtimeVersions.osBuild" is not null
    And the payload field "events.0.device.runtimeVersions.clangVersion" is not null

Scenario: Runtime versions included in Cocoa session
    When I run "ManualSessionScenario"
    And I wait for 10 seconds
    Then I should receive a request
    And the request is a valid for the session tracking API
    And the payload field "device.runtimeVersions.osBuild" is not null
    And the payload field "device.runtimeVersions.clangVersion" is not null

Add test for runtime version info in C++ exception handling

Feature: Runtime versions are included in all requests

Scenario: Runtime versions included in Cocoa error
    When I run "HandledErrorScenario"
    Then I should receive a request
    And the request is valid for the error reporting API
    And the payload field "events.0.device.runtimeVersions.osBuild" is not null
    And the payload field "events.0.device.runtimeVersions.clangVersion" is not null

Scenario: Runtime versions included in Cocoa session
    When I run "ManualSessionScenario"
    And I wait for 10 seconds
    Then I should receive a request
    And the request is a valid for the session tracking API
    And the payload field "device.runtimeVersions.osBuild" is not null
    And the payload field "device.runtimeVersions.clangVersion" is not null

Scenario: Runtime versions included in C layer ThrownErrorScenario
    When I set environment variable "BUGSNAG_API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
    And I crash the app using "CxxExceptionScenario"
    And I relaunch the app
    Then I should receive a request
    And the request is a valid for the error reporting API
    And the payload field "events.0.device.runtimeVersions.osBuild" is not null


Feature: Post Configuration Hook [#423]

  In order to extend Cucumber
  As a developer
  I want to manipulate the Cucumber configuration after it has been created

  Scenario: Using options directly gets a deprecation warning

    Given a standard Cucumber project directory structure
    And a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.options[:blah]
      end
      """
    When I run cucumber features
    Then STDERR should match
      """
      Deprecated
      """

    Given a standard Cucumber project directory structure
    And a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.formats << ['html', config.out_stream]
      end
      """
    When I run cucumber features
    Then STDERR should be empty
    And the output should contain
      """
      html
      """

  Scenario: feature directories read from configuration

    Given a standard Cucumber project directory structure
    And a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.out_stream << "AfterConfiguration hook read feature directories: #{config.feature_dirs.join(', ')}"
      end
      """
    When I run cucumber features
    Then STDERR should be empty
    And the output should contain
      """
      AfterConfiguration hook read feature directories: features
      """

Remove an unnecessary setup step

Feature: Post Configuration Hook [#423]

  In order to extend Cucumber
  As a developer
  I want to manipulate the Cucumber configuration after it has been created

  Scenario: Using options directly gets a deprecation warning

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.options[:blah]
      end
      """
    When I run cucumber features
    Then STDERR should match
      """
      Deprecated
      """

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.formats << ['html', config.out_stream]
      end
      """
    When I run cucumber features
    Then STDERR should be empty
    And the output should contain
      """
      html
      """

  Scenario: feature directories read from configuration

    Given a file named "features/support/env.rb" with:
      """
      AfterConfiguration do |config|
        config.out_stream << "AfterConfiguration hook read feature directories: #{config.feature_dirs.join(', ')}"
      end
      """
    When I run cucumber features
    Then STDERR should be empty
    And the output should contain
      """
      AfterConfiguration hook read feature directories: features
      """


@d8 @api
Feature: DrupalContext
  In order to prove the Drupal context is working properly for Drupal 8
  As a developer
  I need to use the step definitions of this context

Change for admin fields form.

@d8 @api
Feature: DrupalContext
  In order to prove the Drupal context is working properly for Drupal 8
  As a developer
  I need to use the step definitions of this context

  Scenario: Target links within table rows
    Given I am logged in as a user with the "administrator" role
    When I am at "admin/structure/types"
    And I click "Manage fields" in the "Article" row
    Then I should be on "admin/structure/types/manage/article/fields"
    And I should see text matching "Add new field"


Feature: link method with attributes

  I want to be able to pass arguments to the link method
  So that additional attributes are generated

Scenario: link with class attribute

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :class => 'active')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain
    """
    Page
    """

Scenario: link with title attribute

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :title => 'click me')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain
    """
    Page
    """

Scenario: link with title and class attributes

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :title => 'click me', :class => 'active')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain /<a [title="click me", class="active", href="page.html"]/

Fix specs for ruby 1.8

Feature: link method with attributes

  I want to be able to pass arguments to the link method
  So that additional attributes are generated

Scenario: link with class attribute

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :class => 'active')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain /<a [class="active", href="page.html"]/

Scenario: link with title attribute

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :title => 'click me')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain /<a [title="click me", href="page.html"]/

Scenario: link with title and class attributes

  Given input file "index.html.haml" contains
    """
    = link("page.html", "Page", :title => 'click me', :class => 'active')
    """
  And input file "page.html" exists

  When I build the site
  Then output file "index.html" should contain /<a [title="click me", class="active", href="page.html"]/


Feature: image fallbacks

  @normal
  Scenario: Image fallbacks look vaguely correct
    When I GET https://spotlight.{PP_FULL_APP_DOMAIN}/performance/carers-allowance/volumetrics.png
    Then I should receive an HTTP 200
     And the image should be between 950 and 970 pixels wide
     And the image should be between 400 and 410 pixels high

Add 4 second limit to image fallback requests

Feature: image fallbacks

  @normal
  Scenario: Image fallbacks look vaguely correct
    Given I am benchmarking
    When I GET https://spotlight.{PP_FULL_APP_DOMAIN}/performance/carers-allowance/volumetrics.png
    Then I should receive an HTTP 200
     And the elapsed time should be less than 4 seconds
     And the image should be between 950 and 970 pixels wide
     And the image should be between 400 and 410 pixels high


Feature: Configuring the server

  @announce
  Scenario: Starting the server with --force flag if port is blocked
    Given I run `dredd-hooks-php` interactively
    Then I run `dredd-hooks-php --force` interactively

  @announce
  Scenario: Starting the server on non standard port
    Given I run `dredd-hooks-php --port 123` interactively
    Then It should start listening on localhost port "123"

Add step to check server is running and change port number

Feature: Configuring the server

  @announce
  Scenario: Starting the server with --force flag if port is blocked
    Given I run `dredd-hooks-php` interactively
    When I wait for output to contain "Starting"
    Then I run `dredd-hooks-php --force` interactively

  @announce
  Scenario: Starting the server on non standard port
    Given I run `dredd-hooks-php --port 1123` interactively
    When I wait for output to contain "Starting"
    Then It should start listening on localhost port "1123"


Feature: Advanced Search

  Scenario: User goes to advanced search page
    Given I go to the root page
     When I click "Advanced Search"
     Then I should see the advanced search form
      But I should not see the simple search form

  Scenario: User submits empty advanced search form
    Given I'm on the advanced search page
     When I click "Find it"
     Then I should see the advanced search form

  Scenario: User submits filled in advanced search form
    Given I'm on the advanced search page
     When I search for "water" in the "Title" field
     Then I should see the result page
      And I should see "Refine Advanced Search"

  Scenario: Paging on show document keeps advanced result set
    Given I'm on the advanced search page
     When I search for "water" in the "Everything" field
      And I click on the first document
     Then I should see the document titled "Photocatalysis of Naphthenic Acids in Water"
      # TODO: remove previous line and enable the following lines when issue with no next/prev for show document has been solved
      #And I go to the next document
     #Then I should see the document titled "Environmental Risk Imposed by Diverted Flood Waters on Water and Soils in Emergency Retention Basins"

Disable advanced search cucumber features

Feature: Advanced Search

  Scenario: This feature is disabled
      Given I go to the root page

  # Scenario: User goes to advanced search page
  #   Given I go to the root page
  #    When I click "Advanced Search"
  #    Then I should see the advanced search form
  #     But I should not see the simple search form

  # Scenario: User submits empty advanced search form
  #   Given I'm on the advanced search page
  #    When I click "Find it"
  #    Then I should see the advanced search form

  # Scenario: User submits filled in advanced search form
  #   Given I'm on the advanced search page
  #    When I search for "water" in the "Title" field
  #    Then I should see the result page
  #     And I should see "Refine Advanced Search"

  # Scenario: Paging on show document keeps advanced result set
  #   Given I'm on the advanced search page
  #    When I search for "water" in the "Everything" field
  #     And I click on the first document
  #    Then I should see the document titled "Photocatalysis of Naphthenic Acids in Water"
  #     # TODO: remove previous line and enable the following lines when issue with no next/prev for show document has been solved
  #     #And I go to the next document
  #    #Then I should see the document titled "Environmental Risk Imposed by Diverted Flood Waters on Water and Soils in Emergency Retention Basins"


Feature: Tab Panel

  Background:
    Given I open the application

  Scenario Outline: Close tab
    When I open the page for the tree node with path "<path>"
    And I right click the tab with path "<path>"
    And I follow "Close Tab"
    Then I should have no open tabs

  Examples:
    | path                        |
    | ./home.txt                  |
    | ./test.txt                  |
    | ./test.txt                  |
    | ./folder/test 1.txt         |
    | ./folder/test 2.txt         |
    | ./folder/test.txt           |
    | ./folder/subfolder/ruby.txt |

  Scenario: Close other tabs

  Scenario: Close all tabs

Extend scenario for tab contextmenu.

Feature: Tab Panel

  Background:
    Given I open the application

  Scenario Outline: Close tab
    When I open the page for the tree node with path "<path>"
    And I right click the tab with path "<path>"
    And I follow "Close Tab"
    Then I should have no open tabs

  Examples:
    | path                        |
    | ./home.txt                  |
    | ./test.txt                  |
    | ./folder/test 1.txt         |
    | ./folder/test 2.txt         |
    | ./folder/test.txt           |
    | ./folder/subfolder/ruby.txt |

  Scenario Outline: Close other tabs
    When I open the page for the tree node with path "./home.txt"
    When I open the page for the tree node with path "./folder/subfolder/ruby.txt"
    And I open the page for the tree node with path "./test.txt"
    And I right click the tab with path "<path>"
    And I follow "Close Other Tabs"

    Then I should have the following open tabs:
      | <title> |
    And I should see active tab titled "<title>"

  Examples:
    | path                        | title |
    | ./home.txt                  | home  |
    | ./folder/subfolder/ruby.txt | ruby  |
    | ./test.txt                  | test  |

  Scenario: Close all tabs
    When I open the page for the tree node with path "./home.txt"
    When I open the page for the tree node with path "./folder/subfolder/ruby.txt"
    And I open the page for the tree node with path "./test.txt"
    And I right click the tab with path "./test.txt"
    And I follow "Close All Tabs"
    Then I should have no open tabs


@use_http_client
Feature: the read api should provide cache control headers
    Scenario: _status is not cacheable
         when I go to "/_status"
         then the "Cache-Control" header should be "no-cache"

    Scenario: query returns an etag
        Given "licensing.json" is in "foo" data_set with settings
            | key                 | value |
            | raw_queries_allowed | true  |
         when I go to "/foo"
         then the "ETag" header should be ""7c7cec78f75fa9f30428778f2b6da9b42bd104d0""

    Scenario: response is Not Modified when etag matches
        Given "licensing.json" is in "foo" data_set
         when I go to "/foo"
          and I send another request to "/foo" with the received etag
         then I should get back a status of "304"

Add feature tests for read API cache header times

@use_http_client
Feature: the read api should provide cache control headers
    Scenario: _status is not cacheable
         when I go to "/_status"
         then the "Cache-Control" header should be "no-cache"

    Scenario: query returns an etag
        Given "licensing.json" is in "foo" data_set with settings
            | key                 | value |
            | raw_queries_allowed | true  |
         when I go to "/foo"
         then the "ETag" header should be ""7c7cec78f75fa9f30428778f2b6da9b42bd104d0""

    Scenario: response is Not Modified when etag matches
        Given "licensing.json" is in "foo" data_set
         when I go to "/foo"
          and I send another request to "/foo" with the received etag
         then I should get back a status of "304"

    Scenario: non-realtime data sets have a 30 minute cache header
        Given "licensing.json" is in "foo" data_set with settings
            | key                 | value |
            | raw_queries_allowed | true  |
            | realtime            | false |
            | published           | true  |
         when I go to "/foo"
         then the "Cache-Control" header should be "max-age=1800, must-revalidate"

    Scenario: realtime data sets have a 2 minute cache header
        Given "licensing.json" is in "foo" data_set with settings
            | key                 | value |
            | raw_queries_allowed | true  |
            | realtime            | true  |
            | published           | true  |
         when I go to "/foo"
         then the "Cache-Control" header should be "max-age=120, must-revalidate"


Feature: Update bundle
  As a developer
  In order to avoid tedious work
  I want to automatically update dependencies

  Background: A project with fixed dependency versions
    Given a Gemfile specifying:
      """
      gem 'foo', '1.0.0'
      """
    And a gem named "foo" at version 1.0.0
    When I run `bundle install`
    Then the output should contain:
      """
      Using foo 1.0.0
      """
    When I run `git init`
    And I run `git add .`
    And I run `git ci -am 'Initial'`

  Scenario: Nothing to do
    When I run `keep_up --test-command true`
    Then the output should contain:
      """
      Bundle up to date!
      All done!
      """

  Scenario: Updating a gem with a fixed version
    Given a gem named "foo" at version 1.0.1
    When I run `keep_up --test-command true`
    Then the output should contain:
      """
      Updating foo to 1.0.1
      """
    And the file "Gemfile" should contain:
      """
      gem 'foo', '1.0.1'
      """

Extend feature to assurt no updates were attempted

Feature: Update bundle
  As a developer
  In order to avoid tedious work
  I want to automatically update dependencies

  Background: A project with fixed dependency versions
    Given a Gemfile specifying:
      """
      gem 'foo', '1.0.0'
      """
    And a gem named "foo" at version 1.0.0
    When I run `bundle install`
    Then the output should contain:
      """
      Using foo 1.0.0
      """
    When I run `git init`
    And I run `git add .`
    And I run `git ci -am 'Initial'`

  Scenario: Nothing to do
    When I run `keep_up --test-command true`
    Then the output should not contain:
      """
      Updating foo to 1.0.0
      """
    And the output should contain:
      """
      Bundle up to date!
      All done!
      """

  Scenario: Updating a gem with a fixed version
    Given a gem named "foo" at version 1.0.1
    When I run `keep_up --test-command true`
    Then the output should contain:
      """
      Updating foo to 1.0.1
      """
    And the file "Gemfile" should contain:
      """
      gem 'foo', '1.0.1'
      """


Feature: Bugsnag captures an unhandled mach exception

  Background:
    Given I clear all UserDefaults data

  Scenario: Trigger a mach exception
    When I run "UnhandledMachExceptionScenario" and relaunch the app
    And I configure Bugsnag for "UnhandledMachExceptionScenario"
    And I wait to receive a request
    Then the request is valid for the error reporting API version "4.0" for the "iOS Bugsnag Notifier" notifier
    And the event "exceptions.0.errorClass" equals "EXC_BAD_ACCESS"
    And the event "exceptions.0.message" equals "Attempted to dereference garbage pointer 0xdeadbeef."
    And the event "metaData.error.address" equals "3735928559"
    And the event "metaData.error.type" equals "mach"
    And the event "metaData.error.mach.code" equals "1"
    And the event "metaData.error.mach.code_name" equals "KERN_INVALID_ADDRESS"
    And the event "metaData.error.mach.exception" equals "1"
    And the event "metaData.error.mach.exception_name" equals "EXC_BAD_ACCESS"
    And the event "metaData.error.mach.subcode" equals "3735928559"
    And the event "severity" equals "error"
    And the event "unhandled" is true
    And the event "severityReason.type" equals "unhandledException"

Fix number comparisons in Mach exception test case

Feature: Bugsnag captures an unhandled mach exception

  Background:
    Given I clear all UserDefaults data

  Scenario: Trigger a mach exception
    When I run "UnhandledMachExceptionScenario" and relaunch the app
    And I configure Bugsnag for "UnhandledMachExceptionScenario"
    And I wait to receive a request
    Then the request is valid for the error reporting API version "4.0" for the "iOS Bugsnag Notifier" notifier
    And the event "exceptions.0.errorClass" equals "EXC_BAD_ACCESS"
    And the event "exceptions.0.message" equals "Attempted to dereference garbage pointer 0xdeadbeef."
    And the event "metaData.error.address" equals 3735928559
    And the event "metaData.error.type" equals "mach"
    And the event "metaData.error.mach.code" equals 1
    And the event "metaData.error.mach.code_name" equals "KERN_INVALID_ADDRESS"
    And the event "metaData.error.mach.exception" equals 1
    And the event "metaData.error.mach.exception_name" equals "EXC_BAD_ACCESS"
    And the event "metaData.error.mach.subcode" equals 3735928559
    And the event "severity" equals "error"
    And the event "unhandled" is true
    And the event "severityReason.type" equals "unhandledException"


@not-production @functional-test
Feature: Create buyer account. WIP-The flow to get to the creation page is as yet not nailed down. This test starts directly on the buyer creation page itself rather than navigating to it as a user would on the frontend app

Scenario: User steps through buyer account creation process
  Given I navigate directly to the page '/buyers/create'
  When I am on the 'Create a buyer account' page
  And I enter 'test.buyer.email@test.gov.uk' in the 'email_address' field
  And I click 'Create account'
  Then I am taken to the 'Activate your account' page

Fix buyer account creation scenario

@not-production @functional-test @buyer-creation
Feature: Create buyer account. We're assuming a user journey where someone tries to find a specialist, eventually hits the login page, and then clicks 'Create a buyer account' from the login page

Scenario: User steps through buyer account creation process
  Given I am on the 'Digital Marketplace' landing page
  When I click the 'Find an individual specialist' link
  Then I am taken to the buyers 'Find an individual specialist' page

  When I click the 'Create requirement' button
  Then I am taken to the 'Log in to the Digital Marketplace' page

  When I click the 'Create a buyer account' link
  Then I am on the 'Create a buyer account' page

  And I enter 'test.buyer.email@test.gov.uk' in the 'email_address' field
  And I click 'Create account'
  Then I am taken to the 'Activate your account' page


Feature: Access control
  As a User
  I want to have access only to relevant content
  So that I can publish content on gov.uk

  Scenario: Non-CMA editor has no access to documents
    Given I am logged in as a non-CMA editor
    Then I do not see an option for editing documents

  Scenario: Non-CMA editor is sent a document URL
    Given I am logged in as a non-CMA editor
    When I attempt to visit a document edit URL
    Then I am redirected back to the index page
    And I see a message like "You don't have permission to do that"

  Scenario: Editors from multiple organisations have created content
    Given there are manuals created by multiple organisations
    When I view my list of manuals
    Then I only see manuals created by my organisation

Fix access control feature order dependence

Feature: Access control
  As a User
  I want to have access only to relevant content
  So that I can publish content on gov.uk

  Background:
    Given I am logged in as a non-CMA editor

  Scenario: Non-CMA editor has no access to documents
    Then I do not see an option for editing documents

  Scenario: Non-CMA editor is sent a document URL
    When I attempt to visit a document edit URL
    Then I am redirected back to the index page
    And I see a message like "You don't have permission to do that"

  Scenario: Editors from multiple organisations have created content
    Given there are manuals created by multiple organisations
    When I view my list of manuals
    Then I only see manuals created by my organisation


@smoke-tests
Feature: Apps /_status is ok

  @status @api
  Scenario: Check the data API /_status
    Given I am on the api /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @search-api
  Scenario: Check the search API /_status
    Given I am on the search-api /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @buyer-frontend
  Scenario: Check the buyers frontend /_status
    Given I am on the frontend /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @supplier-frontend
  Scenario: Check the suppliers frontend /_status
    Given I am on the frontend /suppliers/_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @admin-frontend
  Scenario: Check the admin frontend /_status
    Given I am on the frontend /admin/_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

Add briefs-frontend status check to the smoke tests

@smoke-tests
Feature: Apps /_status is ok

  @status @api
  Scenario: Check the data API /_status
    Given I am on the api /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @search-api
  Scenario: Check the search API /_status
    Given I am on the search-api /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @buyer-frontend
  Scenario: Check the buyers frontend /_status
    Given I am on the frontend /_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @briefs-frontend
  Scenario: Check the briefs frontend /_status
    Given I am on the frontend /buyers/_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @supplier-frontend
  Scenario: Check the suppliers frontend /_status
    Given I am on the frontend /suppliers/_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'

  @status @admin-frontend
  Scenario: Check the admin frontend /_status
    Given I am on the frontend /admin/_status page
    Then I see 'ok' as the value of the 'status' JSON field
    And Display the value of the 'version' JSON field as 'Release version'


@process
Feature: simulate-failed-check command line
  As a systems administrator
  I should be able to use simulate-failed-check
  From the command line

  Background:
    Given a file named "simulate-failed-check.yaml" with:
"""
test:
  redis:
    db: 14
    driver: ruby
"""

  Scenario: Running with --help shows usage information
    When I run `bundle exec bin/flapjack simulate --help`
    Then the exit status should be 0
    And  the output should contain "Simulates a check by creating a stream of events for Flapjack to process"
    And  the output should contain "-k arg|--check arg"

  Scenario: Running simulate-failed-check with no arguments exits uncleanly and shows usage
    When I run `bundle exec bin/flapjack simulate`
    Then the exit status should not be 0
    And  the output should contain "Simulates a check by creating a stream of events for Flapjack to process"

  Scenario: Simulate a failed check
    When I run `bundle exec bin/flapjack -n test -c tmp/cucumber_cli/simulate-failed-check.yaml simulate fail -t 0 -i 0.1 -e 'test' -k 'PING'`
    Then the exit status should be 0
    And  the output should contain "sending failure event"
    And  the output should contain "stopping"

Work around linebreaks in help output

@process
Feature: simulate-failed-check command line
  As a systems administrator
  I should be able to use simulate-failed-check
  From the command line

  Background:
    Given a file named "simulate-failed-check.yaml" with:
"""
test:
  redis:
    db: 14
    driver: ruby
"""

  Scenario: Running with --help shows usage information
    When I run `bundle exec bin/flapjack simulate --help`
    Then the exit status should be 0
    And  the output should contain "Simulates a check by creating a stream of events for Flapjack"
    And  the output should contain "-k arg|--check arg"

  Scenario: Running simulate-failed-check with no arguments exits uncleanly and shows usage
    When I run `bundle exec bin/flapjack simulate`
    Then the exit status should not be 0
    And  the output should contain "Simulates a check by creating a stream of events for Flapjack"

  Scenario: Simulate a failed check
    When I run `bundle exec bin/flapjack -n test -c tmp/cucumber_cli/simulate-failed-check.yaml simulate fail -t 0 -i 0.1 -e 'test' -k 'PING'`
    Then the exit status should be 0
    And  the output should contain "sending failure event"
    And  the output should contain "stopping"


Feature: Markdown headers

  Write headers in markdown. Six levels (from `h1` to `h6`) of headers are
  available.

  You can write header in two way, by calling a header function or using
  `String` extension.

  Headers are written using _classical_ style like `# H1` or `### H3`
  instead of underlined versions.

  Scenario: Headers functions
    When I execute the following koios code:
      """
      Koios::Doc.write {[
        h1('H1'),
        h2('H2'),
        h3('H3'),
        h4('H4'),
        h5('H5'),
        h6('H6')
      ]}
      """
    Then the markdown output is:
      """

      # H1

      ## H2

      ### H3

      #### H4

      ##### H5

      ###### H6

      """

  Scenario: Headers join strings
    When I execute the following koios code:
      """
      Koios::Doc.write {[
        h3('This', ' is', ' a', ' h3', ' header')
      ]}
      """
    Then the markdown output is:
      """

      ### This is a h3 header

      """

Add string extension header example

Feature: Markdown headers

  Write headers in markdown. Six levels (from `h1` to `h6`) of headers are
  available.

  You can write header in two way, by calling a header function or using
  `String` extension.

  Headers are written using _classical_ style like `# H1` or `### H3`
  instead of underlined versions.

  Scenario: Headers functions
    When I execute the following koios code:
      """
      Koios::Doc.write {[
        h1('H1'),
        h2('H2'),
        h3('H3'),
        h4('H4'),
        h5('H5'),
        h6('H6')
      ]}
      """
    Then the markdown output is:
      """

      # H1

      ## H2

      ### H3

      #### H4

      ##### H5

      ###### H6

      """

  Scenario: Headers join strings
    When I execute the following koios code:
      """
      Koios::Doc.write {[
        h3('This', ' is', ' a', ' h3', ' header')
      ]}
      """
    Then the markdown output is:
      """

      ### This is a h3 header

      """

  Scenario: String extensions
    When I execute the following koios code:
      """
      Koios::Doc.write {[
        'H1'.h1,
        'H2'.h2,
        'H3'.h3,
        'H4'.h4,
        'H5'.h5,
        'H6'.h6
      ]}
      """
    Then the markdown output is:
      """

      # H1

      ## H2

      ### H3

      #### H4

      ##### H5

      ###### H6

      """


@api @mailhog
Feature: notifications-content

  Background:
    Given these users have been created:
      | username |
      | user1    |
    And using OCS API version "2"

  Scenario: Create notification
    When the user "user1" sets the email notification option to "always" using the API
    And user "user1" is sent a notification with
      | app         | notificationsacceptancetesting                                            |
      | timestamp   | 144958517                                                                 |
      | subject     | Acceptance Testing                                                        |
      | link        | https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ |
      | message     | About Activities and Notifications in ownCloud                            |
      | object_type | blog                                                                      |
      | object_id   | 9483                                                                      |
    Then the email address "u1@oc.com.np" should have received an email with the body containing
      """
      Hello,
      About Activities and Notifications in ownCloud

      See https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ on ownCloud for more information
      """
    And the email address "u1@oc.com.np" should have received an email with the body containing
      """
      See https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ on ownCloud for more information
      """

Fix email address in tests

@api @mailhog
Feature: notifications-content

  Background:
    Given these users have been created:
      | username |
      | user1    |
    And using OCS API version "2"

  Scenario: Create notification
    When the user "user1" sets the email notification option to "always" using the API
    And user "user1" is sent a notification with
      | app         | notificationsacceptancetesting                                            |
      | timestamp   | 144958517                                                                 |
      | subject     | Acceptance Testing                                                        |
      | link        | https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ |
      | message     | About Activities and Notifications in ownCloud                            |
      | object_type | blog                                                                      |
      | object_id   | 9483                                                                      |
    Then the email address "user1@example.org" should have received an email with the body containing
      """
      Hello,
      About Activities and Notifications in ownCloud

      See https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ on ownCloud for more information
      """
    And the email address "user1@example.org" should have received an email with the body containing
      """
      See https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ on ownCloud for more information
      """