Feature: Vnc

  Background:
    * Make sure that gnome-boxes is running
    * Wait until overview is loaded

  @new_vnc_localhost_box
  Scenario: New VNC box
    * Create new box from url "vnc://localhost:5901;"
    * Press "Create"
    * Wait for "sleep 2" end
    Then Box "localhost" "does" exist
    * Go into "localhost" box
    * Wait for "sleep 10" end
    * Hit "<Super_L>"
    * Wait for "sleep 5" end
    * Type text "gnome-terminal" and return
    * Wait for "sleep 10" end
    * Type text "echo walderon > /tmp/vnc_text.txt" and return
    Then "walderon" is visible with command "cat /tmp/vnc_text.txt"
    Then Press "back" in "localhost" vm

  @vnc_restart_persistence
  Scenario: VNC restart persistence
    * Create new box from url "vnc://localhost:5901;"
    * Press "Create"
    * Quit Boxes
    * Start Boxes
    Then Box "localhost" "does" exist

Remove semicolon from VNC URLs

Feature: Vnc

  Background:
    * Make sure that gnome-boxes is running
    * Wait until overview is loaded

  @new_vnc_localhost_box
  Scenario: New VNC box
    * Create new box from url "vnc://localhost:5901"
    * Press "Create"
    * Wait for "sleep 2" end
    Then Box "localhost" "does" exist
    * Go into "localhost" box
    * Wait for "sleep 10" end
    * Hit "<Super_L>"
    * Wait for "sleep 5" end
    * Type text "gnome-terminal" and return
    * Wait for "sleep 10" end
    * Type text "echo walderon > /tmp/vnc_text.txt" and return
    Then "walderon" is visible with command "cat /tmp/vnc_text.txt"
    Then Press "back" in "localhost" vm

  @vnc_restart_persistence
  Scenario: VNC restart persistence
    * Create new box from url "vnc://localhost:5901"
    * Press "Create"
    * Quit Boxes
    * Start Boxes
    Then Box "localhost" "does" exist


Feature:
	As a user I should not be able to add more than 200 characters for a text field or 700 for a text area so that I don't crash the blackberry client

Scenario: Should be restricted to 200 characters in a text field

  Given I am logged in
  And I am on children listing page
  And I follow "New child"
  When I fill in a 201 character long string for "Name"
  And I press "Save"
  Then I should see "Name cannot be more than 200 characters long"
  And there should be 0 child records in the database

Scenario: Should be restricted to 400,000 characters in a text area
	Given the following form sections exist in the system:
      | name | unique_id | editable | order |
      | Basic details | basic_details | true | 1 |
	Given the following fields exists on "basic_details":
		| name | type | display_name |
		| my_text_area | textarea | my text area |
	Given I am logged in
	And I am on children listing page
	And I follow "New child"
	When I fill in a 400,001 character long string for "my text area"
	And I press "Save"
	Then I should see "my text area cannot be more than 400000 characters long"
  	And there should be 0 child records in the database

Fix cucumber feature to match the step. Thought I'd committed this but apparently not. Sorry, folks.

Feature:
	As a user I should not be able to add more than 200 characters for a text field or 700 for a text area so that I don't crash the blackberry client

Scenario: Should be restricted to 200 characters in a text field

  Given I am logged in
  And I am on children listing page
  And I follow "New child"
  When I fill in a 201 character long string for "Name"
  And I press "Save"
  Then I should see "Name cannot be more than 200 characters long"
  And there should be 0 child records in the database

Scenario: Should be restricted to 400,000 characters in a text area
	Given the following form sections exist in the system:
      | name | unique_id | editable | order |
      | Basic details | basic_details | true | 1 |
	Given the following fields exists on "basic_details":
		| name | type | display_name |
		| my_text_area | textarea | my text area |
	Given I am logged in
	And I am on children listing page
	And I follow "New child"
	When I fill in a 400001 character long string for "my text area"
	And I press "Save"
	Then I should see "my text area cannot be more than 400000 characters long"
  	And there should be 0 child records in the database


@lock-account
Feature: Users are locked if they enter the wrong password too many times

Scenario: User has 5 failed login attempts and is locked out of their account
  Given I have a supplier user
  When The wrong password is entered 5 times for that user
  Then That user can not log in using their correct password
  # TODO: And the user is shown as 'locked' on the admin users page

Update allowed failed login attempts in scenario

@lock-account
Feature: Users are locked if they enter the wrong password too many times

Scenario: User has 10 failed login attempts and is locked out of their account
  Given I have a supplier user
  When The wrong password is entered 10 times for that user
  Then That user can not log in using their correct password
  # TODO: And the user is shown as 'locked' on the admin users page


@targets @usefixtures(workbook)
Feature: Targets

    Scenario: Table
        When I visit "/targets/"
        And I wait for the table to fully load

        When I fill in "q" with "sapiens"
        Then I should see an element with the css selector "tr:not([hidden]) a[href='/targets/ADNP-human/']" within 1 seconds
        And I should see an element with the css selector "tr[hidden] a[href='/targets/H3K4me3-mouse/']"
        And I should see exactly one element with the css selector ".table-count" containing the text "13"

    Scenario: Detail page
        When I visit "/targets/ADNP-human/"
        And I should see an element with the css selector ".view-item.type-target"

        When I click the link to "http://www.uniprot.org/uniprot/Q9H2P0"
        Then the browser's URL should contain "www.uniprot.org"
        Then I should see "Q9H2P0 - ADNP_HUMAN"

        When I go back
        Then the browser's URL should contain "/targets/"
        And I should see an element with the css selector ".view-item.type-target"

Update selenium tests to work with current uniprot page layout. Am not convinced of the wisdom of testing other peoples pages, we need a better way to check that our outbound links work.

@targets @usefixtures(workbook)
Feature: Targets

    Scenario: Table
        When I visit "/targets/"
        And I wait for the table to fully load

        When I fill in "q" with "sapiens"
        Then I should see an element with the css selector "tr:not([hidden]) a[href='/targets/ADNP-human/']" within 1 seconds
        And I should see an element with the css selector "tr[hidden] a[href='/targets/H3K4me3-mouse/']"
        And I should see exactly one element with the css selector ".table-count" containing the text "13"

    Scenario: Detail page
        When I visit "/targets/ADNP-human/"
        And I should see an element with the css selector ".view-item.type-target"

        When I click the link to "http://www.uniprot.org/uniprot/Q9H2P0"
        Then the browser's URL should contain "www.uniprot.org"
        Then I should see "Q9H2P0"
        And I should see "ADNP_HUMAN"

        When I go back
        Then the browser's URL should contain "/targets/"
        And I should see an element with the css selector ".view-item.type-target"


Feature: Element visibility
    As a kakunin user
    I want to wait for element to disappear

    Scenario: Check visibility
        Given I visit the "main" page
        When I click the "buttonLink" element
        Then the "buttonForm" page is displayed
        When I click the "disappearBtn" element
        Then I wait for the "disappearBtn" element to disappear

Add functional test for invisibilityOf

Feature: Element visibility
    As a kakunin user
    I want to wait for element to disappear

    Scenario: Check visibility - disappear step
        Given I visit the "main" page
        When I click the "buttonLink" element
        Then the "buttonForm" page is displayed
        When I click the "disappearBtn" element
        Then I wait for the "disappearBtn" element to disappear

    Scenario: Check visibility with - wait for condition step
        Given I visit the "main" page
        When I click the "buttonLink" element
        Then the "buttonForm" page is displayed
        When I click the "disappearBtn" element
        And I wait for "invisibilityOf" of the "disappearBtn" element
        Then the "disappearBtn" element is not visible


Feature: Super admin receives upgrade notification
    Super admin needs to be able to dismiss or click out of notification

  Background:
    Given I am signed in to Kolibri as super admin
      And I see a notification message

  Scenario: Temporarily dismiss notification
    When I click *OK*
    Then the notification goes away
      And I log out
      And I log back in
    Then the notification appears again

  Scenario: Permanently dismiss notification
    When I check *Do not show again* box
    Then I click *OK*
    Then the notification goes away
      And I log out
      And I log back in
    Then the notification does not appear

  Scenario: Upgrade kolibri through notification link
    When I click on the upgrade link
    Then I download latest kolibri installer
    Then I install latest kolibri
    When I log in
    Then the previous upgrade notification does not appear

Update gherkin based on feedback

Feature: Super admin receives the notification to upgrade Kolibri
    Super admin needs to be able to temporarily or permanently dismiss the upgrade notification

  Background:
    Given I am signed in to Kolibri as super admin
      And I see the upgrade notification message

  Scenario: Trigger a notification
    When I set KOLIBRI_RUN_MODE to "GHERKIN-[string]" where `[string]` is any string of letters and numbers
      And I start the server
      And I log in
    Then I should get a notification

  Scenario: Trigger a different notification
    When I set KOLIBRI_RUN_MODE to a different  "GHERKIN-[string]"
      And I start the server
      And I log in
    Then I should get a different notification

  Scenario: Temporarily dismiss notification
    When I click *OK*
    Then the notification closes
    When I sign out
      And I sign back in
    Then I see the upgrade notification again

  Scenario: Permanently dismiss notification
    When I check *Do not show again* box
      And I click *OK*
    Then the notification closes
    When I sign out
      And I sign back in
    Then I don't see the upgrade notification

  Scenario: Upgrade Kolibri through the link inside notification message
    When I click on the upgrade link
    Then I download the most recent Kolibri installer
    When I finish the Kolibri upgrade
      And I sign back in
    Then I don't see the upgrade notification


Feature: Express install

  Background:
    * Make sure that gnome-boxes is running
    * Wait until overview is loaded

  @express_install_fedora_20
  Scenario: Express install Fedora 20
    * Create new box from url "http://mirrors.nic.cz/pub/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso"
    * Hit "Tab"
    * Hit "Tab"
    * Type "test"
    * Press "Add Password"
    * Type "secretpasswordnumber1"
    * Press "Continue"
    * Press "Create"
    Then Installation of "Fedora 20" is finished in "30" minutes
    * Save IP for machine "Fedora 20"
    Then Box "Fedora 20" "does" exist
    Then Go into "Fedora 20" box
    Then Press "back" in "Fedora 20" vm
    Then Ping "Fedora 20"
    Then Verify "test" user with "secretpasswordnumber1" password in "Fedora 20"

Update link to Fedora 20 image

Feature: Express install

  Background:
    * Make sure that gnome-boxes is running
    * Wait until overview is loaded

  @express_install_fedora_20
  Scenario: Express install Fedora 20
    * Create new box from url "http://mirrors.nic.cz/pub/fedora-archive/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso"
    * Hit "Tab"
    * Hit "Tab"
    * Type "test"
    * Press "Add Password"
    * Type "secretpasswordnumber1"
    * Press "Continue"
    * Press "Create"
    Then Installation of "Fedora 20" is finished in "30" minutes
    * Save IP for machine "Fedora 20"
    Then Box "Fedora 20" "does" exist
    Then Go into "Fedora 20" box
    Then Press "back" in "Fedora 20" vm
    Then Ping "Fedora 20"
    Then Verify "test" user with "secretpasswordnumber1" password in "Fedora 20"


Feature: It is possible to interactively fill in a form from the CLI

  Scenario: Provide a value different than the default value
    When I run the command "form:name" and I provide as input
      """
      Menno[enter]
      """
    Then the output should be
      """
      Your name [Matthias]: Array
      (
          [name] => Menno
      )
      """

  Scenario: Provide no value, the default value will be used
    When I run the command "form:name" and I provide as input "[enter]"
    Then the command has finished successfully
    And the output should be
      """
      Your name [Matthias]: Array
      (
          [name] => Matthias
      )
      """

  Scenario: Provide invalid input, the form errors will be printed
    When I run the command "form:name" and I provide as input
      """
      A[enter]
      """
    Then the command was not successful
    And the output should contain
      """
      This value is too short. It should have 4 characters or more.
      """

  Scenario: Select a value
    When I run the command "form:color" and I provide as input
      """
      blue[enter]
      """
    Then the command has finished successfully
    And the output should be
      """
      Select color [red]:
        [red   ] Red
        [blue  ] Blue
        [yellow] Yellow
      > Array
      (
          [color] => blue
      )
      """

Check for smaller part of error message

Feature: It is possible to interactively fill in a form from the CLI

  Scenario: Provide a value different than the default value
    When I run the command "form:name" and I provide as input
      """
      Menno[enter]
      """
    Then the output should be
      """
      Your name [Matthias]: Array
      (
          [name] => Menno
      )
      """

  Scenario: Provide no value, the default value will be used
    When I run the command "form:name" and I provide as input "[enter]"
    Then the command has finished successfully
    And the output should be
      """
      Your name [Matthias]: Array
      (
          [name] => Matthias
      )
      """

  Scenario: Provide invalid input, the form errors will be printed
    When I run the command "form:name" and I provide as input
      """
      A[enter]
      """
    Then the command was not successful
    And the output should contain
      """
      This value is too short.
      """

  Scenario: Select a value
    When I run the command "form:color" and I provide as input
      """
      blue[enter]
      """
    Then the command has finished successfully
    And the output should be
      """
      Select color [red]:
        [red   ] Red
        [blue  ] Blue
        [yellow] Yellow
      > Array
      (
          [color] => blue
      )
      """


# language: en
@directconnect
Feature: AWS Direct Connect

  I want to use AWS Direct Connect

  Scenario: Managing connections
    Given I create a Direct Connect connection with name prefix "aws-sdk-js"
    Then I should get a Direct Connect connection ID
    And I describe the connection
    Then the bandwidth should match the connection bandwidth
    And I delete the Direct Connect connection

  Scenario: Error handling
    Given I create a Direct Connect connection with an invalid location
    Then the error code should be "DirectConnectServerException"
    And the error message should be:
    """
    Unable to process request
    """

Correct failing integration test on AWS.DirectConnect

# language: en
@directconnect
Feature: AWS Direct Connect

  I want to use AWS Direct Connect

  Scenario: Managing connections
    Given I create a Direct Connect connection with name prefix "aws-sdk-js"
    Then I should get a Direct Connect connection ID
    And I describe the connection
    Then the bandwidth should match the connection bandwidth
    And I delete the Direct Connect connection

  Scenario: Error handling
    Given I create a Direct Connect connection with an invalid location
    Then the error code should be "DirectConnectClientException"
    And the error message should be:
    """
    'INVALID_LOCATION' is not a valid Direct Connect location
    """


Feature: sqlmap attack

  @slow
  Scenario:
    Given scapegoat is running on port 9292
    And an attack "sqlmap" exists
    And I copy the attack files from the "examples/sqlmap" folder
    And the following attack files exist:
      | filename      |
      | sqlmap.attack |
    When I run `gauntlt`
    Then it should pass with:
      """
      4 steps (4 passed)
      """
    And scapegoat should quit

Fix oddly failing cuke on jruby

Feature: sqlmap attack

  @slow
  Scenario:
    Given an attack "sqlmap" exists
    And scapegoat is running on port 9292
    And I copy the attack files from the "examples/sqlmap" folder
    And the following attack files exist:
      | filename      |
      | sqlmap.attack |
    When I run `gauntlt`
    Then it should pass with:
      """
      4 steps (4 passed)
      """
    And scapegoat should quit


# encoding: UTF-8
# language: no

@wip
Egenskap: Utlån av bok
  Som en låner Knut
  For å kunne lære om Oslo kommunes utsmykkinger
  Ønsker jeg å kunne låne boken Fargelegg byen!

  Bakgrunn:
    Gitt at jeg er logget inn som adminbruker
    Og at "Fargelegg byen!" er ei bok som finnes i biblioteket

  @wip
  Scenario: Eksisterende bruker som låner bok han har funnet
    Gitt at "Knut" eksisterer som en låner
    Og at "Knut" har funnet boken
    Når "Knut" vil registrere lånet
    Så registrerer systemet at "Fargelegg byen" er utlånt
    Og at "Knut" låner "Fargelegg byen"

  @wip
  Scenario: Ny bruker som låner bok som finnes
    Gitt at "Knut" vil registrere seg som en låner
    Og at "Knut" har funnet boken
    Når "Knut" vil registrere lånet
    Så registrerer systemet at "Fargelegg byen" er utlånt
    Og at "Knut" låner "Fargelegg byen"

Add feature for self-service loan

# encoding: UTF-8
# language: no

@wip
Egenskap: Selvbetjent utlån av bok
  Som en låner Knut
  For å kunne lære om Oslo kommunes utsmykkinger
  Ønsker jeg å kunne låne boken Fargelegg byen!

  Bakgrunn:
    Gitt at det finnes en låner

  @wip
  Scenario: Autentisering av eksisterende låner for utlån på automat
    Gitt at det finnes en utlånsautomat
    Når låneren velger å låne på automaten
    Og låner identifiserer seg med lånekort og PIN
    Så får låneren mulighet til å registrere lån på automaten

  @wip
  Scenario: Eksisterende låner låner bok på automat
    Gitt at låneren har identifisert seg for å låne på utlånsautomaten
    Og at låneren har en bok
    Og at boka har en RFID-brikke
    Når låneren legger boka på automaten
    Så registrerer systemet at låneren låner boka
    Og at boka er utlånt


@RALLY_US4835
@rc
Feature:  RC Integration CleanUp Tests

Background:
  Given I have an open web browser

Scenario:  LEA deletes realm
  When I navigate to the Portal home page
  When I selected the realm "inBloom"
  And I was redirected to the "Simple" IDP Login page
  When I submit the credentials "<SECONDARY_EMAIL>" "<SECONDARY_EMAIL_PASS>" for the "Simple" login page
  Then I should be on Portal home page
  Then I should see Admin link
  And I click on Admin
  Then I should be on the admin page
  And under System Tools, I click on "Manage Realm"
  And I switch to the iframe
  And I should see that I am on the "Daybreak Test Realm" edit page
  And I should click the delete realm link
  And I switch to the iframe
  Then I should be redirected to a new realm page
  And I should receive a notice that the realm was successfully "deleted"
  And I should see that I am on the new realm page
  And I exit out of the iframe
  And I click on log out

Scenario: slcoperator deletes SEA,LEA
  When I navigate to the user account management page
  And I see the realm selector I authenticate to "inBloom"
  Then I am redirected to "Simple" login page
  When I submit the credentials "slcoperator" "slcoperator1234" for the "Simple" login page
  Then I delete the user "RCTestSeaAdminFN RCTestSeaAdminLN"
  Then I delete the user "RCTestLeaAdminFN RCTestLeaAdminLN"

Fix e2e test cleanup expectations

@RALLY_US4835
@rc
Feature:  RC Integration CleanUp Tests

Background:
  Given I have an open web browser

Scenario:  LEA deletes realm
  When I navigate to the Portal home page
  When I selected the realm "inBloom"
  And I was redirected to the "Simple" IDP Login page
  When I submit the credentials "<SECONDARY_EMAIL>" "<SECONDARY_EMAIL_PASS>" for the "Simple" login page
  Then I should be on Portal home page
  Then I should see Admin link
  And I click on Admin
  Then I should be on the admin page
  And under System Tools, I click on "Manage Realm"
  And I switch to the iframe
  Then I see the realms for "IL-DAYBREAK"
  When I click the "Daybreak Test Realm" delete button and confirm deletion
  And I switch to the iframe
  And I should receive a notice that the realm was successfully "deleted"
  Then I see the realms for "IL-DAYBREAK"
  And I exit out of the iframe
  And I click on log out

Scenario: slcoperator deletes SEA,LEA
  When I navigate to the user account management page
  And I see the realm selector I authenticate to "inBloom"
  Then I am redirected to "Simple" login page
  When I submit the credentials "slcoperator" "slcoperator1234" for the "Simple" login page
  Then I delete the user "RCTestSeaAdminFN RCTestSeaAdminLN"
  Then I delete the user "RCTestLeaAdminFN RCTestLeaAdminLN"


Feature: New Tagging Workflow
  In order to get more publishers tagging to the new taxonomy
  Whitehall
  Needs to alter it's tagging workflow to remove editing legacy
  associations from the main edit screen.

  Policies, Policy Areas and specialist sectors are being removed from
  the main edition edit page and into their own tagging screen.

  The flow is now as follows:

  For a publication that uses the new taxonomy :
    Edit Screen > Next > Taxonomy Tagging Screen > Save > Admin Screen

  For a publication that does not use the new taxonomy:
    Edit Screen > Next > Legacy Tagging Screen > Save > Admin Screen

Scenario: Publication that does not support the new taxonomy
  Given I am a writer
  When I start editing a draft document which cannot be tagged to the new taxonomy
  And I continue to the tagging page
  And I continue to the legacy tagging page
  Then I should be on the legacy tagging page
  And I should be able to update the legacy tags

Scenario: Publication that supports the new taxonomy
  Given I am a writer
  When I start editing a draft document which can be tagged to the new taxonomy
  And I continue to the tagging page
  Then I should be on the taxonomy tagging page
  And I should be able to update the taxonomy

Simplify the description of the New Tagging Workflow feature test

Feature: New Tagging Workflow
  In order to get more publishers tagging to the new taxonomy
  Whitehall Needs to alter it's tagging workflow to remove editing
  legacy associations from the main edit screen.

  The flow is now as follows:

  For a publication that uses the new taxonomy :
    Edit Screen > Next > Taxonomy Tagging Screen > Save > Admin Screen

  For a publication that does not use the new taxonomy:
    Edit Screen > Next > Legacy Tagging Screen > Save > Admin Screen

Scenario: Publication that does not support the new taxonomy
  Given I am a writer
  When I start editing a draft document which cannot be tagged to the new taxonomy
  And I continue to the tagging page
  And I continue to the legacy tagging page
  Then I should be on the legacy tagging page
  And I should be able to update the legacy tags

Scenario: Publication that supports the new taxonomy
  Given I am a writer
  When I start editing a draft document which can be tagged to the new taxonomy
  And I continue to the tagging page
  Then I should be on the taxonomy tagging page
  And I should be able to update the taxonomy


Feature: Signup as an student member

  Background:
    Given I want to sign up as an student member
    And product information has been setup for "individual-supporter-student"
    When I visit the signup page

  Scenario: Signup as a student supporter
    When I enter my name and contact details
    And I enter my address details
    And I enter my university details
    Then I should not be asked for financial information
    And I should not be asked for organization details
    And I agree to the terms
    When I click sign up
    Then I am redirected to the payment page
    And I should have a membership number generated
    And I am processed through chargify for the "individual-supporter-student" option
    When I click complete
    And I am returned to the thanks page
    And my student details should be saved
    And I should not have an organisation assigned to me
    And a welcome email should be sent to me
    And I should see "Dear Ian" in the email body
    And I should see "We are delighted to welcome you to the Open Data Institute member network" in the email body
    And I should see "download an ODI Supporter badge" in the email body
    And my details should be queued for further processing
    When chargify verifies the payment

  @javascript
  Scenario: Auto-update terms based on user input
    Given I want to sign up as an student member
    When I visit the signup page
    And I enter my name and contact details
    And I enter my address details
    Then I should see "You agree to comply with these terms and conditions"
    And I should see "means Ian McIain of 123 Fake Street, Faketown, Fakeshire, United Kingdom, FAKE 123"

Fix feature after terms text change

Feature: Signup as an student member

  Background:
    Given I want to sign up as an student member
    And product information has been setup for "individual-supporter-student"
    When I visit the signup page

  Scenario: Signup as a student supporter
    When I enter my name and contact details
    And I enter my address details
    And I enter my university details
    Then I should not be asked for financial information
    And I should not be asked for organization details
    And I agree to the terms
    When I click sign up
    Then I am redirected to the payment page
    And I should have a membership number generated
    And I am processed through chargify for the "individual-supporter-student" option
    When I click complete
    And I am returned to the thanks page
    And my student details should be saved
    And I should not have an organisation assigned to me
    And a welcome email should be sent to me
    And I should see "Dear Ian" in the email body
    And I should see "We are delighted to welcome you to the Open Data Institute member network" in the email body
    And I should see "download an ODI Supporter badge" in the email body
    And my details should be queued for further processing
    When chargify verifies the payment

  @javascript
  Scenario: Auto-update terms based on user input
    Given I want to sign up as an student member
    When I visit the signup page
    And I enter my name and contact details
    And I enter my address details
    Then I should see "Your student membership"
    And I should see "means Ian McIain of 123 Fake Street, Faketown, Fakeshire, United Kingdom, FAKE 123"


# encoding: UTF-8
# language: no

@wip
Egenskap: Adminbruker låner ut bok
  Som adminbruker
  For å hjelpe Knut å lære om Oslo kommunes utsmykkinger
  Ønsker jeg å låne ut boka Fargelegg byen! til Knut

  @wip
  Scenario: Adminbruker låner ut bok til
    Gitt at jeg er logget inn som adminbruker
    Og at "Knut" eksisterer som en låner
    Og at "Fargelegg byen!" er ei bok som finnes i biblioteket
    Når jeg registrerer "Knut" som aktiv låner
    Og jeg registrerer utlån av "Fargelegg byen!"
    Så registrerer systemet at "Fargelegg byen!" er utlånt
    Og at "Knut" låner "Fargelegg byen!"

Fix typo in scenario title

# encoding: UTF-8
# language: no

@wip
Egenskap: Adminbruker låner ut bok
  Som adminbruker
  For å hjelpe Knut å lære om Oslo kommunes utsmykkinger
  Ønsker jeg å låne ut boka Fargelegg byen! til Knut

  @wip
  Scenario: Adminbruker låner ut bok til Knut
    Gitt at jeg er logget inn som adminbruker
    Og at "Knut" eksisterer som en låner
    Og at "Fargelegg byen!" er ei bok som finnes i biblioteket
    Når jeg registrerer "Knut" som aktiv låner
    Og jeg registrerer utlån av "Fargelegg byen!"
    Så registrerer systemet at "Fargelegg byen!" er utlånt
    Og at "Knut" låner "Fargelegg byen!"


# encoding: UTF-8
# language: no

@wip
Egenskap: Reservering av bok
  Som låner
  For å lære om Oslo kommunes utsmykkinger
  Ønsker jeg å reservere boka "Fargelegg byen!"

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

  @wip
  Scenario:
    Gitt at "Knut" er pålogget som låner
    Og at "Knut" har funnet "Fargelegg byen!"
  	Når "Knut" reserverer "Fargelegg byen!"
    Så registrerer systemet at "Fargelegg byen!" er reservert av "Knut"

Make background and scenario more general by omitting individual names

# encoding: UTF-8
# language: no

@wip
Egenskap: Reservering av bok
  Som låner
  For å få tak i en bestemt bok
  Ønsker jeg å reservere boka

Bakgrunn:
  Gitt at det finnes en låner
  Og at det finnes en bok

  @wip
  Scenario:
    Gitt at låner er pålogget som låner
    Og at låneren har funnet en bok
    Og at boka er tilgjengelig
  	Når låneren reserverer boka
    Så viser systemet at boka er reservert av låneren


Feature: Residence Emissions Calculations
  The residence model should generate correct emission calculations

  Scenario Outline: Standard Calculations for residence
    Given a residence has "zip_code.name" of "<zip_code>"
    And it has "floorspace_estimate" of "<floorspace>"
    And it has "residence_class.name" of "<residence_class>"
    And it has "urbanity.name" of "<urbanity>"
    And it has "dishwasher_use.name" of "<dishwasher_use>"
    When emissions are calculated
    Then the emission value should be within "0.1" kgs of "<emission>"
    Examples:
      | zip_code | floorspace | residence_class                                                                 | urbanity | dishwasher_use      | emission   |
      |    48915 |       1400 | Single-family detached house (a one-family house detached from any other house) |     City | 4 to 6 times a week | 3981.67675 |

Revert "Fixed test results for test including RECs survey"

Feature: Residence Emissions Calculations
  The residence model should generate correct emission calculations

  Scenario Outline: Standard Calculations for residence
    Given a residence has "zip_code.name" of "<zip_code>"
    And it has "floorspace_estimate" of "<floorspace>"
    And it has "residence_class.name" of "<residence_class>"
    And it has "urbanity.name" of "<urbanity>"
    And it has "dishwasher_use.name" of "<dishwasher_use>"
    When emissions are calculated
    Then the emission value should be within "0.1" kgs of "<emission>"
    Examples:
      | zip_code | floorspace | residence_class                                                                 | urbanity | dishwasher_use      | emission  |
      |    48915 |       1400 | Single-family detached house (a one-family house detached from any other house) |     City | 4 to 6 times a week | 6091.88178 |


@vcr
Feature: Get some CSVs

  Background:
    Given I request CSV
    And I authenticate as the user "thomas" with the password "tank_engine"

  Scenario: Get CSV data
    When I send a GET request to "/signals/passesnger_load_car_b/2015-09-01T00:00:00+00:00/2015-09-01T01:00:00+00:00?interval=30m"
    Then the response status should be "200"
    And the response should be a CSV
    And the CSV response should have the headers:
    """
    timestamp
    passesnger_load_car_b
    """
    And the CSV response should have the values:
    """
    2015-09-01T00:30:00+00:00
    12.605633802816902
    """

Add @blocktrain tag to CSV feature

@vcr @blocktrain
Feature: Get some CSVs

  Background:
    Given I request CSV
    And I authenticate as the user "thomas" with the password "tank_engine"

  Scenario: Get CSV data
    When I send a GET request to "/signals/passesnger_load_car_b/2015-09-01T00:00:00+00:00/2015-09-01T01:00:00+00:00?interval=30m"
    Then the response status should be "200"
    And the response should be a CSV
    And the CSV response should have the headers:
    """
    timestamp
    passesnger_load_car_b
    """
    And the CSV response should have the values:
    """
    2015-09-01T00:30:00+00:00
    12.605633802816902
    """


Feature: Show a node type
    In order to show the CND definition of a node type
    As a user that is logged into the shell
    I need to be able to execute a command which does that

    Background:
        Given that I am logged in as "testuser"
        And the "session_data.xml" fixtures are loaded

    Scenario: Execute the note-type show command
        Given I execute the "node-type:show nt:unstructured" command
        Then the command should not fail
        And I should see the following:
        """
[nt:unstructured] > nt:base
      orderable query
      - *
      multiple jcr.operator.equal.to', 'jcr.operator.not.equal.to', 'jcr.operator.greater.than', 'jcr.operator.greater.than.or.equal.to', 'jcr.operator.less.than', 'jcr.operator.less.than.or.equal.to', 'jcr.operator.like
      - *
      jcr.operator.equal.to', 'jcr.operator.not.equal.to', 'jcr.operator.greater.than', 'jcr.operator.greater.than.or.equal.to', 'jcr.operator.less.than', 'jcr.operator.less.than.or.equal.to', 'jcr.operator.like
      + * (nt:base)
      = nt:unstructured
      VERSION sns
        """

    Scenario: Execute the note-type show command
        Given I execute the "node-type:show nt:not-exist" command
        Then the command should fail
        And I should see the following:
        """
        The node type "nt:not-exist" does not exist
        """

Fix test for the "node-type:show nt:unstructured" command

Feature: Show a node type
    In order to show the CND definition of a node type
    As a user that is logged into the shell
    I need to be able to execute a command which does that

    Background:
        Given that I am logged in as "testuser"
        And the "session_data.xml" fixtures are loaded

    Scenario: Execute the note-type show command
        Given I execute the "node-type:show nt:unstructured" command
        Then the command should not fail
        And I should see the following:
        """
[nt:unstructured] > nt:base
      orderable query
      - *
      jcr.operator.equal.to', 'jcr.operator.not.equal.to', 'jcr.operator.greater.than', 'jcr.operator.greater.than.or.equal.to', 'jcr.operator.less.than', 'jcr.operator.less.than.or.equal.to', 'jcr.operator.like
      - *
      multiple jcr.operator.equal.to', 'jcr.operator.not.equal.to', 'jcr.operator.greater.than', 'jcr.operator.greater.than.or.equal.to', 'jcr.operator.less.than', 'jcr.operator.less.than.or.equal.to', 'jcr.operator.like
      + * (nt:base)
      = nt:unstructured
      VERSION sns
        """

    Scenario: Execute the note-type show command
        Given I execute the "node-type:show nt:not-exist" command
        Then the command should fail
        And I should see the following:
        """
        The node type "nt:not-exist" does not exist
        """


@ci-run
Feature: Configuration file

  Scenario: Missing global file
    When I run `gcli config`
    Then the output should contain:
    """
    Configuration file does not exist. Please use `gcli init` to create one.
    """

  Scenario: Missing local file
    When I run `gcli config --local`
    Then the output should contain:
    """
    Configuration file does not exist. Please use `gcli init` to create one.
    """

  Scenario: List global file options
    Given I run `gcli init`
    When I run `gcli config`
    Then the output should contain:
    """
    Configuration options:
    """

  Scenario: Seek local before global configuration
    Given a directory named "piotr"
      And I cd to "piotr"
      And I run `gcli init --local`
   When I run `gcli config`
   Then the output should contain:
    """
    Configuration options:
    """

  Scenario: Read existing option
    Given I run `gcli init`
    When I successfully run `gcli config user.token abc123`
    Then the stdout should contain "abc123"

  Scenario: Read missing option
    Given I run `gcli init`
    When I run `gcli config missing.key`
    Then the exit status should be 0

  Scenario: Write custom option
    Given I run `gcli init`
    When I successfully run `gcli config core.host eee555`
    Then the stdout should contain "eee555"

  Scenario: Listing all configuration options
    Given I run `gcli init`
    When I run `gcli config -l`
    Then the stdout should contain "user.token"

Change to run only specific examples

Feature: Configuration file

  @ci-run
  Scenario: Missing global file
    When I run `gcli config`
    Then the output should contain:
    """
    Configuration file does not exist. Please use `gcli init` to create one.
    """

  @ci-run
  Scenario: Missing local file
    When I run `gcli config --local`
    Then the output should contain:
    """
    Configuration file does not exist. Please use `gcli init` to create one.
    """

  @ci-run
  Scenario: List global file options
    Given I run `gcli init`
    When I run `gcli config`
    Then the output should contain:
    """
    Configuration options:
    """

  @ci-run
  Scenario: Seek local before global configuration
    Given a directory named "piotr"
      And I cd to "piotr"
      And I run `gcli init --local`
   When I run `gcli config`
   Then the output should contain:
    """
    Configuration options:
    """

  Scenario: Read existing option
    Given I run `gcli init`
    When I successfully run `gcli config user.token abc123`
    Then the stdout should contain "abc123"

  Scenario: Read missing option
    Given I run `gcli init`
    When I run `gcli config missing.key`
    Then the exit status should be 0

  Scenario: Write custom option
    Given I run `gcli init`
    When I successfully run `gcli config core.host eee555`
    Then the stdout should contain "eee555"

  Scenario: Listing all configuration options
    Given I run `gcli init`
    When I run `gcli config -l`
    Then the stdout should contain "user.token"


Feature: Runner WP-CLI

  Scenario: Path argument should be slashed correctly
  When I try `wp no-such-command --path=/foo --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  When I try `wp no-such-command --path=/foo/ --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  When I try `wp no-such-command --path=/foo\\ --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  Scenario: defining abspath before WP-CLI is loaded
    Given an empty directory
    And a wp-cli.yml file:
      """
      require:
        - abspath.php
      """
    And a abspath.php file:
      """
      <?php
      if ( ! defined( 'ABSPATH' ) ) {
          define( 'ABSPATH', '/wcrtm/' );
      }
      """

    When I try `wp no-such-command --debug`
    Then STDERR should not contain:
      """
      Constant ABSPATH already defined in
      """
    And STDERR should contain:
      """
      ABSPATH defined: /wcrtm/
      """

    When I try `wp no-such-command --path=/foo --debug`
    Then STDERR should contain:
      """
      The --path parameter cannot be used when ABSPATH is already defined elsewhere
      """

Change scenario title and path used

Feature: Runner WP-CLI

  Scenario: Path argument should be slashed correctly
  When I try `wp no-such-command --path=/foo --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  When I try `wp no-such-command --path=/foo/ --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  When I try `wp no-such-command --path=/foo\\ --debug`
  Then STDERR should contain:
    """
    ABSPATH defined: /foo/
    """

  Scenario: ABSPATH can be defined outside of WP-CLI
    Given an empty directory
    And a wp-cli.yml file:
      """
      require:
        - abspath.php
      """
    And a abspath.php file:
      """
      <?php
      if ( ! defined( 'ABSPATH' ) ) {
          define( 'ABSPATH', '/some_path/' );
      }
      """

    When I try `wp no-such-command --debug`
    Then STDERR should not contain:
      """
      Constant ABSPATH already defined in
      """
    And STDERR should contain:
      """
      ABSPATH defined: /some_path/
      """

    When I try `wp no-such-command --path=/foo --debug`
    Then STDERR should contain:
      """
      The --path parameter cannot be used when ABSPATH is already defined elsewhere
      """


@admin
Feature: An admin anonymizes petitions
  As an admin user
  I want to anonymize all petitions 6 months after parliament closes in accordance with our privacy policy

  Background:
    Given I am logged in as a sysadmin with the email "muddy@fox.com", first_name "Sys", last_name "Admin"

  @javascript
  Scenario: Admin anonymizes petitions 6 months after parliament closes
    Given Parliament is dissolved
    And 2 archived petitions exist
    When I go to the admin parliament page
    And I press "Anonymize petitions"
    And I accept the alert
    Then I should see "Anonymizing of petitions was successfully started"

  Scenario: An admin cannot anonymize petitions if there are none to anonymize
    When I go to the admin parliament page
    Then I should not see "Anonymize petitions"

Correct cucumber feature for new data retention policy

@admin
Feature: An admin anonymizes petitions
  As an admin user
  I want to anonymize all petitions 6 months after parliament closes in accordance with our privacy policy

  Background:
    Given I am logged in as a sysadmin with the email "muddy@fox.com", first_name "Sys", last_name "Admin"

  @javascript
  Scenario: Admin anonymizes petitions 6 months after parliament closes
    Given 2 archived petitions exist
    When I go to the admin parliament page
    And I press "Anonymize petitions"
    And I accept the alert
    Then I should see "Anonymizing of petitions was successfully started"

  Scenario: An admin cannot anonymize petitions if there are none to anonymize
    When I go to the admin parliament page
    Then I should not see "Anonymize petitions"


Feature: Manage WordPress through endpoints locally

  Background:
    Given a WP install
    And I run `wp plugin install rest-api --activate`

  Scenario: REST endpoints should load as WP-CLI commands
    When I run `wp help rest`
    Then STDOUT should contain:
      """
      wp rest <command>
      """

    When I run `wp help rest comment`
    Then STDOUT should contain:
      """
      wp rest comment <command>
      """

    When I run `wp help rest post`
    Then STDOUT should contain:
      """
      wp rest post <command>
      """

    When I run `wp help rest user`
    Then STDOUT should contain:
      """
      wp rest user <command>
      """

  Scenario: Debug flag should identify errored parts of the bootstrap process
    Given a wp-content/mu-plugins/rest-endpoint.php file:
      """
      <?php
      add_action( 'rest_api_init', function() {
        register_rest_route( 'myplugin/v1', '/books', array(
          'methods' => 'GET',
          'callback' => '__return_true',
        ) );
      });
      """

    When I run `wp rest --debug`
    Then STDERR should contain:
      """
      Debug: No schema title found for /myplugin/v1/books, skipping REST command registration.
      """

Update tests for new output

Feature: Manage WordPress through endpoints locally

  Background:
    Given a WP install
    And I run `wp plugin install rest-api --activate`

  Scenario: REST endpoints should load as WP-CLI commands
    When I run `wp help rest`
    Then STDOUT should contain:
      """
      wp rest <command>
      """

    When I run `wp help rest comment`
    Then STDOUT should contain:
      """
      wp rest comment <command>
      """

    When I run `wp help rest post`
    Then STDOUT should contain:
      """
      wp rest post <command>
      """

    When I run `wp help rest user`
    Then STDOUT should contain:
      """
      wp rest user <command>
      """

  Scenario: Debug flag should identify errored parts of the bootstrap process
    Given a wp-content/mu-plugins/rest-endpoint.php file:
      """
      <?php
      add_action( 'rest_api_init', function() {
        register_rest_route( 'myplugin/v1', '/books', array(
          'methods' => 'GET',
          'callback' => '__return_true',
        ) );
      });
      """

    When I run `wp rest --debug`
    Then STDERR should contain:
      """
      Debug (rest): No schema title found for /myplugin/v1/books, skipping REST command registration.
      """


@supplier-framework-application
Feature: Apply to an open framework

Background:
  Given There is a framework that is open for applications
  And I have a supplier user
  And that supplier is logged in

Scenario: Supplier submits a framework declaration
  Given I am on the /suppliers page
  When I click 'Apply'
  And I am on the 'Apply to framework' page for that framework application

  When I click 'Make supplier declaration'
  Then I am on the 'Make your supplier declaration' page
  When I click 'Start your declaration'
  Then I am on the 'Your declaration overview' page

  When I answer all questions on that page
  Then I click 'Make declaration' button
  And I am on the 'Apply to framework' page for that framework application
  And I see 'You’ve made the supplier declaration' text on the page

  When I click 'Add, edit and complete services'
  Then I am on the 'Your framework services' page for that framework application
  Then I submit a service for each lot

Check for finished application success message

@supplier-framework-application
Feature: Apply to an open framework

Background:
  Given There is a framework that is open for applications
  And I have a supplier user
  And that supplier is logged in

Scenario: Supplier submits a framework declaration
  Given I am on the /suppliers page
  When I click 'Apply'
  And I am on the 'Apply to framework' page for that framework application

  When I click 'Make supplier declaration'
  Then I am on the 'Make your supplier declaration' page
  When I click 'Start your declaration'
  Then I am on the 'Your declaration overview' page

  When I answer all questions on that page
  Then I click 'Make declaration' button
  And I am on the 'Apply to framework' page for that framework application
  And I see 'You’ve made the supplier declaration' text on the page

  When I click 'Add, edit and complete services'
  Then I am on the 'Your framework services' page for that framework application
  Then I submit a service for each lot
  And I see '1 service will be submitted' text on the page
  And I click 'Back to framework application' link for that framework application
  And I see 'Your application will be submitted at' text on the page


Feature: Assessment

  Scenario: Open page
    #WEB Open the game collection of a user.
    Given Open selenium webdriver
    When  Open page 'https://www.boardgamegeek.com'
    And   Fill textbox '#login_username' as 'celikgumusdag'
    And   Fill textbox '#login_password' as '12345678'
    And   Click element '.loginbox>input'
    Then  Verify element '.mt5>a' text is 'celikgumusdag'
    When  Open page 'https://boardgamegeek.com/collection/user/celikgumusdag'
    #WEB Go to the page of one of the games (chosen at random)
    And   Open one of the game page randomly
    #API Check the information about the game - look for poll results about Language Dependence.
    And   Check most voted results in the API
    #WEB Verify that the most voted Language Dependence level is presented on the game's page.
    Then Verify element '.feature-description>span>span' text is equal with the API

Test Cases with using gherking language

Feature: Assessment

  Scenario: Open page
    #WEB Open the game collection of a user.
    Given Open selenium webdriver
    When  Open page 'https://www.boardgamegeek.com'
    And   Fill textbox '#login_username' as 'celikgumusdag'
    And   Fill textbox '#login_password' as '12345678'
    And   Click element '.loginbox>input'
    Then  Verify element '.mt5>a' text is 'celikgumusdag'
    When  Open page 'https://boardgamegeek.com/collection/user/celikgumusdag'
    #WEB Go to the page of one of the games (chosen at random)
    And   Open one of the game page randomly
    #API Check the information about the game - look for poll results about Language Dependence.
    And   Check most voted results in the API
    #WEB Verify that the most voted Language Dependence level is presented on the game's page.
    Then Verify element '.game-description .feature-description>span>span' text is equal with the API


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"
    And the initial bundle install committed

  Scenario: Nothing to do
    When I run `keep_up`
    Then the output should not contain:
      """
      Updating foo to 1.0.0
      """
    And the output should contain:
      """
      All done!
      """
    And the file "Gemfile.lock" should contain:
      """
      foo (1.0.0)
      """

  Scenario: Updating a gem with a fixed version
    Given a gem named "foo" at version "1.0.1"
    When I run `keep_up`
    Then the output should contain:
      """
      Updating foo to 1.0.1
      All done!
      """
    And the file "Gemfile" should contain:
      """
      path 'libs'

      gem 'foo', '1.0.1'
      """
    And the file "Gemfile.lock" should contain:
      """
      foo (1.0.1)
      """
    When I run `git log`
    Then the output should contain:
      """
      Auto-update foo to 1.0.1
      """

Test exact output in order to catch warnings

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"
    And the initial bundle install committed

  Scenario: Nothing to do
    When I run `keep_up`
    Then the output from "keep_up" should contain exactly:
      """
      All done!
      """
    And the file "Gemfile.lock" should contain:
      """
      foo (1.0.0)
      """

  Scenario: Updating a gem with a fixed version
    Given a gem named "foo" at version "1.0.1"
    When I run `keep_up`
    Then the output should contain:
      """
      Updating foo to 1.0.1
      All done!
      """
    And the file "Gemfile" should contain:
      """
      path 'libs'

      gem 'foo', '1.0.1'
      """
    And the file "Gemfile.lock" should contain:
      """
      foo (1.0.1)
      """
    When I run `git log`
    Then the output should contain:
      """
      Auto-update foo to 1.0.1
      """


@invite-admin-user
Feature: Admin manager can manage users

Scenario Outline: Admin Manager user can log in and invite admin users
  Given I am logged in as the production <role> user
  And I click the 'View and edit admin accounts' link
  And I click the 'Invite user' link
  When I enter 'functional-test@user.marketplace.team' in the 'Email address' field
  And I choose the 'Manage services' radio button
  And I click the 'Invite user' button
  Then I see a success banner message containing 'An invitation has been sent to functional-test@user.marketplace.team.'

  Examples:
    | role          |
    | admin-manager |

Scenario Outline: Correct users cannot access the invite admin user page
  Given I am logged in as the production <role> user
  And I am on the /admin/admin-users/invite page
  Then I am on the 'You don’t have permission to perform this action' page

  Examples:
    | role                    |
    | admin-framework-manager |
    | admin-ccs-sourcing      |
    | admin-ccs-category      |
    | admin                   |

Use Notify test email address

@invite-admin-user
Feature: Admin manager can manage users

Scenario Outline: Admin Manager user can log in and invite admin users
  Given I am logged in as the production <role> user
  And I click the 'View and edit admin accounts' link
  And I click the 'Invite user' link
  When I enter 'simulate-delivered@notifications.service.gov.uk' in the 'Email address' field
  And I choose the 'Manage services' radio button
  And I click the 'Invite user' button
  Then I see a success banner message containing 'An invitation has been sent to simulate-delivered@notifications.service.gov.uk.'

  Examples:
    | role          |
    | admin-manager |

Scenario Outline: Correct users cannot access the invite admin user page
  Given I am logged in as the production <role> user
  And I am on the /admin/admin-users/invite page
  Then I am on the 'You don’t have permission to perform this action' page

  Examples:
    | role                    |
    | admin-framework-manager |
    | admin-ccs-sourcing      |
    | admin-ccs-category      |
    | admin                   |


Feature: include definition files

Scenario: Include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "exports.d.ts": ["unused"] }

Scenario: Do NOT include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json"
  Then the result is {}

Add tests that d.ts file in sub-folder does not cause errors

Feature: include definition files

Scenario: Include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "exports.d.ts": ["unused"] }

Scenario: Do NOT include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json"
  Then the result is {}

Scenario: Do NOT include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json"
  Then the result is { "b.ts": ["a"] }

Scenario: Include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "b.ts": ["a"], "x/a.d.ts": ["A", "A_unused"] }


Feature: Troo basics

Scenario: Running the command with no arguments
  When I run `troo`

Scenario: Getting the current version
  When I run `troo version`
  Then the output should contain:
  """
  troo 0.0.3
  """

Scenario: Getting the current status
  When I run `troo status`

Add placeholder feature for first invocation.

Feature: Troo basics

Scenario: Running the command for the first time
  When I run `troo`

Scenario: Running the command with no arguments
  When I run `troo`

Scenario: Getting the current version
  When I run `troo version`
  Then the output should contain:
  """
  troo 0.0.3
  """

Scenario: Getting the current status
  When I run `troo status`


@spawn
Feature: Raketask

  In order to use cucumber's rake task
  As a Cuker
  I do not want to see rake's backtraces when it fails
  Also I want to get zero exit status code on failures
  And non-zero exit status code when it pases

  Background:
    Given the standard step definitions
    Given a file named "features/passing_and_failing.feature" with:
      """
      Feature: Sample

        Scenario: Passing
          Given this step passes

        Scenario: Failing
          Given this step raises an error
      """
    Given a file named "Rakefile" with:
      """
        require 'cucumber/rake/task'

        SAMPLE_FEATURE_FILE = 'features/passing_and_failing.feature'

        Cucumber::Rake::Task.new(:pass) do |t|
          t.cucumber_opts = "#{SAMPLE_FEATURE_FILE}:3"
        end

        Cucumber::Rake::Task.new(:fail) do |t|
          t.cucumber_opts = "#{SAMPLE_FEATURE_FILE}:6"
        end
      """

  Scenario: Passing feature
    When I run `bundle exec rake pass`
    Then the exit status should be 0

  Scenario: Failing feature
    When I run `bundle exec rake fail`
    Then the exit status should be 1
    But the output should not contain "rake aborted!"

Tag out scenarios flickering on jruby

@spawn @wip-jruby
Feature: Raketask

  In order to use cucumber's rake task
  As a Cuker
  I do not want to see rake's backtraces when it fails
  Also I want to get zero exit status code on failures
  And non-zero exit status code when it pases

  Background:
    Given the standard step definitions
    Given a file named "features/passing_and_failing.feature" with:
      """
      Feature: Sample

        Scenario: Passing
          Given this step passes

        Scenario: Failing
          Given this step raises an error
      """
    Given a file named "Rakefile" with:
      """
        require 'cucumber/rake/task'

        SAMPLE_FEATURE_FILE = 'features/passing_and_failing.feature'

        Cucumber::Rake::Task.new(:pass) do |t|
          t.cucumber_opts = "#{SAMPLE_FEATURE_FILE}:3"
        end

        Cucumber::Rake::Task.new(:fail) do |t|
          t.cucumber_opts = "#{SAMPLE_FEATURE_FILE}:6"
        end
      """

  Scenario: Passing feature
    When I run `bundle exec rake pass`
    Then the exit status should be 0

  Scenario: Failing feature
    When I run `bundle exec rake fail`
    Then the exit status should be 1
    But the output should not contain "rake aborted!"


Feature: User management

@fixtures
Scenario: Register
    When I am on "/user/register"
    And I fill in the following:
        | Firstname     | John                  |
        | Lastname      | Doe                   |
        | Email address | john.doe@example.com  |
        | Password      | doejohn               |
        | Repeat password | doejohn             |
    And I press "Submit"
    Then I should see "Registration successful"
    And the account "john.doe@example.com" should exist
    And the user "John Doe" should exist
    And I should be on the homepage

Scenario: Register with wrong input
    When I am on "/user/register"
    And I fill in the following:
        | Firstname     | John                  |
        | Lastname      | Doe                   |
        | Email address | john.doe@example.com  |
        | Password      | doejohn               |
        | Repeat password | notdoejohn          |
    And I press "Submit"
    Then I should see "passwords are not identical"
    And I should not see "Registration successful"

Test if input is stored in the register form

Feature: User management

@fixtures
Scenario: Register
    When I am on "/user/register"
    And I fill in the following:
        | Firstname     | John                  |
        | Lastname      | Doe                   |
        | Email address | john.doe@example.com  |
        | Password      | doejohn               |
        | Repeat password | doejohn             |
    And I press "Submit"
    Then I should see "Registration successful"
    And the account "john.doe@example.com" should exist
    And the user "John Doe" should exist
    And I should be on the homepage

Scenario: Register with wrong input
    When I am on "/user/register"
    And I fill in the following:
        | Firstname     | John                  |
        | Lastname      | Doe                   |
        | Email address | john.doe@example.com  |
        | Password      | doejohn               |
        | Repeat password | notdoejohn          |
    And I press "Submit"
    Then I should see "passwords are not identical"
    And I should not see "Registration successful"
    And the "inputFirstname" field should contain "John"
    And the "inputLastname" field should contain "Doe"
    And the "inputEmail" field should contain "john.doe@example.com"


Feature: request spec

  Request specs provide a thin wrapper around Rails' integration tests, and are
  designed to drive behavior through the full stack, including routing
  (provided by Rails) and without stubbing (that's up to you).

  With request specs, you can:

  * specify a single request
  * specify multiple requests across multiple controllers
  * specify multiple requests across multiple sessions

  Check the rails documentation on integration tests for more information.

  RSpec provides two matchers that delegate to Rails assertions:

      render_template # delegates to assert_template
      redirect_to     # delegates to assert_redirected_to

  Check the Rails docs for details on these methods as well.

  If you would like to use webrat or capybara with your request specs, all you
  have to do is include one of them in your Gemfile and RSpec will
  automatically load them in a request spec.

  Scenario: specify managing a Widget with Rails integration methods
    Given a file named "spec/requests/widget_management_spec.rb" with:
      """
      require "spec_helper"

      describe "Widget management" do

        it "creates a Widget and redirects to the Widget's page" do
          get "/widgets/new"
          response.should render_template(:new)

          post "/widgets", :widget => {:name => "My Widget"}

          response.should redirect_to(assigns(:widget))
          follow_redirect!

          response.should render_template(:show)
          response.body.should include("Widget was successfully created.")
        end

      end
      """
    When I run `rspec spec/requests/widget_management_spec.rb`
    Then the example should pass

Clarify when webrat/capybara autoloading applies.

Feature: request spec

  Request specs provide a thin wrapper around Rails' integration tests, and are
  designed to drive behavior through the full stack, including routing
  (provided by Rails) and without stubbing (that's up to you).

  With request specs, you can:

  * specify a single request
  * specify multiple requests across multiple controllers
  * specify multiple requests across multiple sessions

  Check the rails documentation on integration tests for more information.

  RSpec provides two matchers that delegate to Rails assertions:

      render_template # delegates to assert_template
      redirect_to     # delegates to assert_redirected_to

  Check the Rails docs for details on these methods as well.

  If you would like to use webrat or capybara with your request specs, all you
  have to do is include one of them in your Gemfile and RSpec will
  automatically load them in a request spec (a spec under "spec/requests").

  Scenario: specify managing a Widget with Rails integration methods
    Given a file named "spec/requests/widget_management_spec.rb" with:
      """
      require "spec_helper"

      describe "Widget management" do

        it "creates a Widget and redirects to the Widget's page" do
          get "/widgets/new"
          response.should render_template(:new)

          post "/widgets", :widget => {:name => "My Widget"}

          response.should redirect_to(assigns(:widget))
          follow_redirect!

          response.should render_template(:show)
          response.body.should include("Widget was successfully created.")
        end

      end
      """
    When I run `rspec spec/requests/widget_management_spec.rb`
    Then the example should pass


@cucumber
Feature:

  Simply adding the basic simplecov lines to a project should get
  the user a coverage report after running `cucumber features`

  Background:
    Given I'm working on the project "faked_project"

  Scenario:
    Given SimpleCov for Cucumber is configured with:
      """
      require 'simplecov'
      SimpleCov.start
      """

    When I open the coverage report generated with `bundle exec cucumber features`
    Then I should see the groups:
      | name      | coverage | files |
      | All Files | 91.23%   | 6     |

    And I should see the source files:
      | name                                    | coverage |
      | lib/faked_project.rb                    | 100.00 %  |
      | lib/faked_project/some_class.rb         | 80.00 %   |
      | lib/faked_project/framework_specific.rb | 75.00 %   |
      | lib/faked_project/meta_magic.rb         | 100.00 %  |
      | features/step_definitions/my_steps.rb   | 100.00 %  |
      | features/support/simplecov_config.rb    | 100.00 %  |

    And the report should be based upon:
      | Cucumber Features |

Remove simplecov_config.rb from reported files

@cucumber
Feature:

  Simply adding the basic simplecov lines to a project should get
  the user a coverage report after running `cucumber features`

  Background:
    Given I'm working on the project "faked_project"

  Scenario:
    Given SimpleCov for Cucumber is configured with:
      """
      require 'simplecov'
      SimpleCov.start
      """

    When I open the coverage report generated with `bundle exec cucumber features`
    Then I should see the groups:
      | name      | coverage | files |
      | All Files | 90.91%   | 5     |

    And I should see the source files:
      | name                                    | coverage |
      | lib/faked_project.rb                    | 100.00 %  |
      | lib/faked_project/some_class.rb         | 80.00 %   |
      | lib/faked_project/framework_specific.rb | 75.00 %   |
      | lib/faked_project/meta_magic.rb         | 100.00 %  |
      | features/step_definitions/my_steps.rb   | 100.00 %  |

    And the report should be based upon:
      | Cucumber Features |


Feature:
  As a devops
  In order to keep traces of communication with external components
  I want my application to log the external calls made with Guzzle

  Scenario: A successful request stores a trace
    Given the 3rd party API will succeed
    When I send a request to the 3rd party API
    Then a request profile should have been stored

  Scenario: An errored request stores a trace
    Given the 3rd party API will fail
    When I send a request to the 3rd party API
    Then a request profile should have been stored

  Scenario: It creates a request ID
    Given the 3rd party API will succeed
    When I send a request to the 3rd party API
    Then the sent request should contain an "x-message-id" header

Remove this test from the MessageProfile in prevision of the component deprecation very soon


Feature: User update
  In Order to be able to update my name
  As a regular user
  I want to have an edit page

  @javascript
  Scenario: with current password
    Given I am a regular user
    And I am signed in
    And I am at the homepage
    When I click the Edit link
    And I fill the Name field with "Rafael Manzo"
    And I fill the Current password field with "password"
    And I press the Update button
    Then I should see "Your account has been updated successfully"
    And my name should have changed to Rafael Manzo

Fix user edition acceptance test

Feature: User update
  In Order to be able to update my name
  As a regular user
  I want to have an edit page

  @javascript
  Scenario: with current password
    Given I am a regular user
    And I am signed in
    And I am at the homepage
    And I take a picture of the page
    When I click the Diego Martinez link
    And I click the Edit Account link
    And I fill the Name field with "Rafael Manzo"
    And I fill the Current password field with "password"
    And I press the Update button
    Then I should see "Your account has been updated successfully"
    And my name should have changed to Rafael Manzo


# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

# language: en
@sts
Feature: AWS Security Token Service

  I want to use AWS Security Token Service

  Scenario: Feature
    Given I get an STS session token with a duration of 900 seconds
    Then the result should contain an access key ID and secret access key
    And the TTL on the session token credentials should be less than 900

  Scenario: Error handling
    Given I get an STS session token with a duration of 60 seconds
    Then the error code should be "ValidationError"

Update scenario description on STS integration test

# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

# language: en
@sts
Feature: AWS Security Token Service

  I want to use AWS Security Token Service

  Scenario: Get a session token
    Given I get an STS session token with a duration of 900 seconds
    Then the result should contain an access key ID and secret access key
    And the TTL on the session token credentials should be less than 900

  Scenario: Error handling
    Given I get an STS session token with a duration of 60 seconds
    Then the error code should be "ValidationError"


Feature: Developer is shown a parse error
  As a Developer
  I want to know if a parse error was thrown
  So that I can know that I can handle pass errors

  @isolated
  Scenario: Spec attempts to call an undeclared function
    Given the spec file "spec/Message/Fatal/ParseSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use Parse;
      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class ParseSpec extends ObjectBehavior
      {
          function it_thro ws_a_syntax_error()
          {
              $this->cool();
          }
      }

      """
    And the spec file "src/Message/Fatal/Parse.php" contains:
      """
      <?php

      namespace Message\Parse;

      class Parse
      {
          public function cool()
          {
              return true;
          }
      }

      """
    When I run phpspec with the "junit" formatter
    Then I should see "syntax error"

Add scenario for case when SUS has parse error

Feature: Developer is shown a parse error
  As a Developer
  I want to know if a parse error was thrown
  So that I can know that I can handle pass errors

  @php:~5.6 @isolated
  Scenario: Parse error in spec
    Given the spec file "spec/Message/Fatal/ParseSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use Parse;
      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class ParseSpec extends ObjectBehavior
      {
          function it_thro ws_a_syntax_error()
          {
              $this->cool();
          }
      }

      """
    And the spec file "src/Message/Fatal/Parse.php" contains:
      """
      <?php

      namespace Message\Parse;

      class Parse
      {
          public function cool()
          {
              return true;
          }
      }

      """
    When I run phpspec with the "junit" formatter
    Then I should see "syntax error"

  @php:~7.0
  Scenario: Parse error in class
    Given the spec file "spec/Message/Fatal/ParseSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use Parse;
      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class ParseSpec extends ObjectBehavior
      {
          function it_throws_a_syntax_error()
          {
              $this->cool();
          }
      }

      """
    And the spec file "src/Message/Fatal/Parse.php" contains:
      """
      <?php

      namespace Message\Parse;

      class Par se
      {
          public function cool()
          {
              return true;
          }
      }

      """
    When I run phpspec
    Then I should see "1 broken"


@live-reload
Feature: Live reload search

Scenario: Live reload search hitting enter should not cause a full page reload
  Given I am on the homepage
  And I click 'View Digital Outcomes and Specialists opportunities'
  And I am on the 'Digital Outcomes and Specialists opportunities' page
  And I set the page reload flag
  When I enter 'Tea\n' in the 'search' field
  Then I see that the page has not been reloaded

Scenario: Live reload search button should not cause a full page reload
  Given I am on the homepage
  And I click 'View Digital Outcomes and Specialists opportunities'
  And I am on the 'Digital Outcomes and Specialists opportunities' page
  And I set the page reload flag
  And I enter 'Tea' in the 'search' field
  When I click the 'Search' button
  Then I see that the page has not been reloaded

Add checks for link text and href for live reload and add skip staging flag

@live-reload @skip-staging
Feature: Live reload search

Scenario: Live reload search hitting enter should not cause a full page reload
  Given I am on the homepage
  And I click 'View Digital Outcomes and Specialists opportunities'
  And I am on the 'Digital Outcomes and Specialists opportunities' page
  Then I see the 'Clear filters' link with href 'digital-outcomes-and-specialists/opportunities'
  And I set the page reload flag
  When I enter 'Tea\n' in the 'search' field
  Then I see that the page has not been reloaded
  And I see the 'Clear filters' link with href 'digital-outcomes-and-specialists/opportunities?q=Tea'

Scenario: Live reload search button should not cause a full page reload
  Given I am on the homepage
  And I click 'View Digital Outcomes and Specialists opportunities'
  And I am on the 'Digital Outcomes and Specialists opportunities' page
  Then I see the 'Clear filters' link with href 'digital-outcomes-and-specialists/opportunities'
  And I set the page reload flag
  And I enter 'Tea' in the 'search' field
  When I click the 'Search' button
  Then I see that the page has not been reloaded
  And I see the 'Clear filters' link with href 'digital-outcomes-and-specialists/opportunities?q=Tea'


Feature: Help Me I've Got Versionitis

  Scenario: get help for the main script

    When I get help for "git-semaphore"
    Then the exit status should be 0
     And the banner should be present
     And the banner should include the version
     And the banner should document that this app takes options
     And the following options should be documented:
       | --version, -v:       |
       | --help, -h:          |
       | --working-dir, -w:   |
       | --project-name, -p:  |
       | --branch-name, -b:   |
       | --check-auth, -x:    |
       | --check-project, -y: |
       | --check-branch, -z:  |
       | --env-config, -e:    |
       | --git-config, -g:    |
       | --projects, -r:      |
       | --branches, -a:      |
       | --status, -s:        |

  Scenario: get the version of the main script

    When I get the version of "git-semaphore"
    Then the exit status should be 0
     And the output should include the version
     And the output should include the app name
     And the output should include a copyright notice

Add missing option to feature

Feature: Help Me I've Got Versionitis

  Scenario: get help for the main script

    When I get help for "git-semaphore"
    Then the exit status should be 0
     And the banner should be present
     And the banner should include the version
     And the banner should document that this app takes options
     And the following options should be documented:
       | --version, -v:       |
       | --help, -h:          |
       | --working-dir, -w:   |
       | --project-name, -p:  |
       | --branch-name, -b:   |
       | --check-auth, -x:    |
       | --check-project, -y: |
       | --check-branch, -z:  |
       | --env-config, -e:    |
       | --git-config, -g:    |
       | --projects, -r:      |
       | --branches, -a:      |
       | --status, -s:        |
       | --commit-status, -c: |

  Scenario: get the version of the main script

    When I get the version of "git-semaphore"
    Then the exit status should be 0
     And the output should include the version
     And the output should include the app name
     And the output should include a copyright notice


@javascript
Feature: Reorder topic sets
  An admin should be able to reorder topic sets

  Background:
    Given I exist as an activist
    And I am logged in
    And there is a persisted TopicCategory
    And it has a persisted item belonging to topic_sets
      And that has a persisted item belonging to topics with:
         |name|topic 1|
    And it has a persisted item belonging to topic_sets
      And that has a persisted item belonging to topics with:
         |name|topic 2|

  Scenario:
    When I am on "/admin/topics"

    # this drags the first row below the second
    And I drag ".topic_category tr[data-set-id]:nth-child(1)" onto ".topic_category .clearfix"

    And I pause a moment

    Then the topic set containing "topic 1" should be tier 2
    Then the topic set containing "topic 2" should be tier 1

Comment out topic reordering test

# This feature was briefly disabled by the rails 5 upgrade
# @javascript
# Feature: Reorder topic sets
#   An admin should be able to reorder topic sets
#
#   Background:
#     Given I exist as an activist
#     And I am logged in
#     And there is a persisted TopicCategory
#     And it has a persisted item belonging to topic_sets
#       And that has a persisted item belonging to topics with:
#          |name|topic 1|
#     And it has a persisted item belonging to topic_sets
#       And that has a persisted item belonging to topics with:
#          |name|topic 2|
#
#   Scenario:
#     When I am on "/admin/topics"
#
#     # this drags the first row below the second
#     And I drag ".topic_category tr[data-set-id]:nth-child(1)" onto ".topic_category .clearfix"
#
#     And I pause a moment
#
#     Then the topic set containing "topic 1" should be tier 2
#     Then the topic set containing "topic 2" should be tier 1


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"

Test presence/absence of destroy links

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 'Edit' link
    And I should not see the 'Destroy' link

  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 'Edit' link
    And I should see the 'Destroy' link


Feature: Past meetings page

  Scenario: No past meetings
    Given there are no past meetings
    And there is 1 upcoming meeting
    When I visit the 'Past Meetings' page
    Then I should see the text "We haven't had any meetings yet!"
    And I should see a link to the 'Upcoming Meetings' page

  Scenario: Two past meetings
    Given there are 2 past meetings
    And there is 1 upcoming meeting
    When I visit the 'Past Meetings' page
    Then I should see 2 meetings listed

  Scenario: User is not logged in
    Given I am not logged in
    And there are 2 past meetings
    When I visit the 'Past Meetings' page
    Then I should not see the text "Edit"
    And I should not see the text "Delete"

Test presence of edit/destroy links

Feature: Past meetings page

  Scenario: No past meetings
    Given there are no past meetings
    And there is 1 upcoming meeting
    When I visit the 'Past Meetings' page
    Then I should see the text "We haven't had any meetings yet!"
    And I should see a link to the 'Upcoming Meetings' page

  Scenario: Two past meetings
    Given there are 2 past meetings
    And there is 1 upcoming meeting
    When I visit the 'Past Meetings' page
    Then I should see 2 meetings listed
    And I should not see the 'Edit' link
    And I should not see the 'Destroy' link

  Scenario: User is logged in
    Given I am logged in
    And there are 2 past meetings
    When I visit the 'Past Meetings' page
    Then I should see the 'Edit' link
    And I should see the 'Destroy' link


Feature: Login in the application

  @ScenarioId("MyApp-135") @login-scenarios
  Scenario: User can login with valid user name and password
    Given I see the login page
    When I login with user name "Sebas" and password "passion"
    Then I see the welcome page
    And the title is "Welcome Sebas"

Add more test scenarios and fix tagging

Feature: Login in the application

  @ScenarioId("FUNCTIONAL.AUTH.SCN.001") @UserStory("MyApp-135") @login-scenarios
  Scenario: User can login with valid user name and password
    Given I see the login page
    When I login with user name "Sebas" and password "passion"
    Then I see the welcome page
    And the title is "Welcome Sebas"

  @ScenarioId("FUNCTIONAL.AUTH.SCN.002") @UserStory("MyApp-135") @login-scenarios
  Scenario: User can login with valid second user name and password
    Given I see the login page
    When I login with user name "NeoRanga" and password "passion"
    Then I see the welcome page
    And the title is "Welcome NeoRanga"

  @ScenarioId("FUNCTIONAL.AUTH.SCN.003") @UserStory("MyApp-135") @login-scenarios
  Scenario: User can login with valid third user name and password
    Given I see the login page
    When I login with user name "ThirdUser" and password "passion"
    Then I see the welcome page
    And the title is "Welcome ThirdUser"


Feature: KFS Fiscal Officer Account Creation

  [smoke]     As a KFS Fiscal Officer I want to create an Account
              because I want to support a new project
  [KFSQA-606] As a KFS Chart User when creating an Account I should be able
              to enter data into Sub Fund Program field regardless of case
              because custom fields should behave similarly to base fields.

  @smoke
  Scenario: Create an Account
    Given I am logged in as a KFS Fiscal Officer
    And   I create an Account
    When  I blanket approve the Account
    Then  the Account Maintenance Document goes to PROCESSED

  @KFSQA-606
  Scenario: Account Edit Sub Fund Program case sensitive test on Submit
    Given I am logged in as a KFS Chart User
    When  I create an Account with a lower case Sub Fund Program
    Then  the Account Maintenance Document goes to SAVED

Set "Create an Account" Scenario to @pending until we can sort out how to check it correctly in a multi-scenario run.

Feature: KFS Fiscal Officer Account Creation

  [smoke]     As a KFS Fiscal Officer I want to create an Account
              because I want to support a new project
  [KFSQA-606] As a KFS Chart User when creating an Account I should be able
              to enter data into Sub Fund Program field regardless of case
              because custom fields should behave similarly to base fields.

  @smoke @pending
  Scenario: Create an Account
    Given I am logged in as a KFS Fiscal Officer
    And   I create an Account
    When  I blanket approve the Account
    Then  the Account Maintenance Document goes to PROCESSED

  @KFSQA-606
  Scenario: Account Edit Sub Fund Program case sensitive test on Submit
    Given I am logged in as a KFS Chart User
    When  I create an Account with a lower case Sub Fund Program
    Then  the Account Maintenance Document goes to SAVED


Feature: include definition files

Scenario: Include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "exports.d.ts": ["unused"] }

Scenario: Do NOT include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json"
  Then the result is {}

Scenario: Do NOT include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json"
  Then the result is { "b.ts": ["a"] }

Scenario: Include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "b.ts": ["a"], "x/a.d.ts": ["A", "A_unused"] }

Swap order of 2 tests

Feature: include definition files

Scenario: Include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "exports.d.ts": ["unused"] }

Scenario: Do NOT include definition files
  Given file "exports.d.ts" is export const unused = 1;
  When analyzing "tsconfig.json"
  Then the result is {}

Scenario: Include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json" with files ["--includeDeclarationFiles"]
  Then the result is { "b.ts": ["a"], "x/a.d.ts": ["A", "A_unused"] }

Scenario: Do NOT include definition files from sub-folder, without error
  Given file "x/a.d.ts" is
    """
    export type A = 1;
    export type A_unused = 2;
    """
  And file "b.ts" is
    """
    import { A } from './x/a'
    export const a: A = 0
    """
  When analyzing "tsconfig.json"
  Then the result is { "b.ts": ["a"] }


@US105
Feature: Address Search Pagination

Acceptance criteria
  20 results per page

  Scenario: Address search pagination
    Given I have 45 addresses in the same City
    When I search for a property using only the City part of an address
    Then I can see 20 addresses per page
    And I see the number of pages is 3
    And I can go to the next page (page 2)

  Scenario: No address search pagination
    Given I have 10 addresses in the same City
    When I search for a property using only the City part of an address
    Then I cannot see pagination details

Reduce data needed for @US105

@US105
Feature: Address Search Pagination

Acceptance criteria
  20 results per page

  Scenario: Address search pagination
    Given I have 21 addresses in the same City
    When I search for a property using only the City part of an address
    Then I can see 20 addresses per page
    And I see the number of pages is 2
    And I can go to the next page (page 2)

  Scenario: No address search pagination
    Given I have 2 addresses in the same City
    When I search for a property using only the City part of an address
    Then I cannot see pagination details


Feature: Prebid Mobile

Scenario: Test DFP Scenarios
    Given the app has launched
    When I touch "DFP"
    And I touch "Banner"
    And I touch the "See Ad" button
    And I wait for 2 seconds
    Then I should see an AppNexus ad

Scenario: Test MoPub Scenarios
    Given the app has launched
    When I touch "MoPub"
    And I touch "Banner"
    And I touch the "See Ad" button
    And I wait for 2 seconds
    Then I should see an AppNexus ad

Increase time on integration test

Feature: Prebid Mobile

Scenario: Test DFP Scenarios
    Given the app has launched
    When I touch "DFP"
    And I touch "Banner"
    And I touch the "See Ad" button
    And I wait for 4 seconds
    Then I should see an AppNexus ad

Scenario: Test MoPub Scenarios
    Given the app has launched
    When I touch "MoPub"
    And I touch "Banner"
    And I touch the "See Ad" button
    And I wait for 4 seconds
    Then I should see an AppNexus ad


@replay
Feature:
  Background:
    Given an EngineBlock instance configured with JSON data
    And an Identity Provider named "Replay Idp"
    And a Service Provider named "Replay SP"
    And SP "Replay SP" does not require consent

  Scenario: Replay login requests
    Given SP "Replay SP" is configured to generate a AuthnRequest like the one at "fixtures/replay/sp.request.log"
    And IdP "Replay Idp" is configured to return a Response like the one at "fixtures/replay/idp.response.log"
    And SP "Replay SP" may only access "Replay Idp"
    And EngineBlock is expected to send a AuthnRequest like the one at "fixtures/replay/eb.request.log"
    And EngineBlock is expected to send a Response like the one at "fixtures/replay/eb.response.log"
    When I log in at "Replay SP"
    And print last response
    And I follow "GO"
    Then the request should be compared with the one at "fixtures/replay/eb.request.log"
    And print last response
    And I press "GO"
    And print last response
    And I press "Submit"
    And print last response
    Then the response should be compared with the one at "fixtures/replay/eb.response.log"

Move "does not require consent" till after the configuration of the SP with the AuthnRequest

@replay
Feature:
  Background:
    Given an EngineBlock instance configured with JSON data
    And an Identity Provider named "Replay Idp"
    And a Service Provider named "Replay SP"

  Scenario: Replay login requests
    Given SP "Replay SP" is configured to generate a AuthnRequest like the one at "fixtures/replay/sp.request.log"
    And SP "Replay SP" does not require consent
    And IdP "Replay Idp" is configured to return a Response like the one at "fixtures/replay/idp.response.log"
    And SP "Replay SP" may only access "Replay Idp"
    And EngineBlock is expected to send a AuthnRequest like the one at "fixtures/replay/eb.request.log"
    And EngineBlock is expected to send a Response like the one at "fixtures/replay/eb.response.log"
    When I log in at "Replay SP"
    And print last response
    And I follow "GO"
    Then the request should be compared with the one at "fixtures/replay/eb.request.log"
    And print last response
    And I press "GO"
    And print last response
    And I press "Submit"
    And print last response
    Then the response should be compared with the one at "fixtures/replay/eb.response.log"


Feature: Docker Build Capture
    Scenario: Smart containers when executing Docker build should store the Maintainer
        Given a Dockerfile containing a maintainer
        When it is parsed correctly
        Then it should execute docker build
        And it should store the maintainer information in the container

Rewrite the docker build feature to make more sense

Feature: Smart containers handles docker build

    Scenario: Dockerfile is not found
        Given a path that does not contain a Dockerfile
        When smart containers is asked to build it
        Then it should return an error

    Scenario: Dockerfile is found
        Given a path containing a Dockerfile
        When smart containers is asked to build it
        Then it should run docker build
         And it should parse the file to create a dictionary of the steps

    Scenario: Dockerfile contains a maintainer
        Given a Dictionary of steps from a Dockerfile
        When smart containers is asked to process the steps
        Then it should find the maintainer
         And it should look for their ORCID ID
         And it should create a graph
         And it should attach the graph to the container


Feature: Review CLI information

  @broken
  Scenario: Get the path to the packages directory
    Given an empty directory

    When I run `wp cli info --format=json`
    Then STDOUT should be JSON containing:
      """
      {"wp_cli_packages_dir_path":null}
      """

    When I run `wp package install danielbachhuber/wp-cli-reset-post-date-command`
    Then STDERR should be empty

    When I run `wp cli info --format=json`
    Then STDOUT should be JSON containing:
      """
      {"wp_cli_packages_dir_path":"/tmp/wp-cli-home/.wp-cli/packages/"}
      """

    When I run `wp cli info`
    Then STDOUT should contain:
      """
      WP-CLI packages dir:
      """

Remove @broken tag from tests that complete successfully by now.

Feature: Review CLI information

  Scenario: Get the path to the packages directory
    Given an empty directory

    When I run `wp cli info --format=json`
    Then STDOUT should be JSON containing:
      """
      {"wp_cli_packages_dir_path":null}
      """

    When I run `wp package install danielbachhuber/wp-cli-reset-post-date-command`
    Then STDERR should be empty

    When I run `wp cli info --format=json`
    Then STDOUT should be JSON containing:
      """
      {"wp_cli_packages_dir_path":"/tmp/wp-cli-home/.wp-cli/packages/"}
      """

    When I run `wp cli info`
    Then STDOUT should contain:
      """
      WP-CLI packages dir:
      """


# encoding: UTF-8
# language: no

Egenskap: Oversiktsside
  Som bruker / tester / drifter av biblioteksystemet
  Siden jeg er ønsker å bruke mindre tid på å lete etter lenker
  Ønsker jeg finne en oversikt over lenker til ulike deler av biblioteksystemet

  Scenario: Oversiktsside med en lenke
    Gitt at jeg er på oversiktssiden
    Så skal jeg finne lenker til:
      | text          |
      | OPAC          |
      | Intra         |
      | Catalinker    |
      | PatronClient  |
      | Services      |
      | Fuseki        |
      | Kibana        |
      | Graphite      |
      | DockerUI      |
      | Elasticsearch |

Update test expectation (Fuseki -> Triplestore)

# encoding: UTF-8
# language: no

Egenskap: Oversiktsside
  Som bruker / tester / drifter av biblioteksystemet
  Siden jeg er ønsker å bruke mindre tid på å lete etter lenker
  Ønsker jeg finne en oversikt over lenker til ulike deler av biblioteksystemet

  Scenario: Oversiktsside med en lenke
    Gitt at jeg er på oversiktssiden
    Så skal jeg finne lenker til:
      | text          |
      | OPAC          |
      | Intra         |
      | Catalinker    |
      | PatronClient  |
      | Services      |
      | Triplestore   |
      | Kibana        |
      | Graphite      |
      | DockerUI      |
      | Elasticsearch |


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"

Revert "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 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"


Feature: Overriding global ordering

  Scenario: running a specific examples group in order
    Given a file named "order_dependent_spec.rb" with:
      """ruby
      describe "examples only pass when they are run in order", :order => :default do
        before(:all) { @list = [] }

        it "passes when run first" do
          @list << 1
          expect(@list).to eq([1])
        end

        it "passes when run second" do
          @list << 2
          expect(@list).to eq([1, 2])
        end

        it "passes when run third" do
          @list << 3
          expect(@list).to eq([1, 2, 3])
        end
      end
      """

    When I run `rspec order_dependent_spec.rb --order random:1 --format documentation`
    Then the examples should all pass
    And the output should contain:
      """
      examples only pass when they are run in order
        passes when run first
        passes when run second
        passes when run third
      """

Remove unnecessary assertion on test output.