Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate E2E tests to BDD with Behat #378

Merged
merged 41 commits into from
Feb 14, 2024
Merged

Migrate E2E tests to BDD with Behat #378

merged 41 commits into from
Feb 14, 2024

Conversation

Art4
Copy link
Collaborator

@Art4 Art4 commented Feb 13, 2024

Writing the end2end tests for #377 I caught myself copy and pasting test code for fundamental processes like creating a project. Also testing the server responses was not as intuitive as I thought. The testing code looks pretty ugly and will become more and more unmaintainable.

$client = $this->getNativeCurlClient($redmineVersion);

/** @var Project */
$api = $client->getApi('project');

// Create project
$projectName = 'test project';
$projectIdentifier = 'test_project';

$xmlData = $api->create([
    'name' => $projectName,
    'identifier' => $projectIdentifier,
]);

$projectDataJson = json_encode($xmlData);
$projectData = json_decode($projectDataJson, true);

$this->assertIsArray($projectData, $projectDataJson);
$this->assertArrayHasKey('identifier', $projectData, $projectDataJson);
$this->assertSame($projectIdentifier, $projectData['identifier'], $projectDataJson);
$this->assertArrayHasKey('status', $projectData, $projectDataJson);
$this->assertSame('1', $projectData['status'], $projectDataJson);

// Close project
$this->assertTrue($api->close($projectIdentifier));

// Read single project
$projectDetails = $api->show($projectIdentifier);

$this->assertArrayHasKey('project', $projectDetails);
$this->assertSame(5, $projectDetails['project']['status']);

That's why I've looked for a better solution and found Behat.

Behat and BDD

This PR introduces BDD (behavior driven development) using Behat. The existing end2end tests will be migrated to the Gherkin syntax. The code above now looks like this:

    Scenario: Closing a project
        Given I have a "NativeCurlClient" client
        And I create a project with name "Test Project" and identifier "test-project"
        When I close the project with identifier "test-project"
        Then the response has the status code "204"
        And the response has an empty content type
        And the response has the content ""
        And the returned data is true
        When I show the project with identifier "test-project"
        Then the returned data "project" property contains the following data
            | property          | value                |
            | status            | 5                    |

@Art4 Art4 added this to the v2.6.0 milestone Feb 13, 2024
@Art4 Art4 self-assigned this Feb 13, 2024
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6a4e464) 97.63% compared to head (b4c3e7a) 97.63%.

Additional details and impacted files
@@            Coverage Diff            @@
##               v2.x     #378   +/-   ##
=========================================
  Coverage     97.63%   97.63%           
  Complexity      563      563           
=========================================
  Files            29       29           
  Lines          1609     1609           
=========================================
  Hits           1571     1571           
  Misses           38       38           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Art4 Art4 changed the title Behat Migrate E2E tests to BDD with Behat Feb 13, 2024
Copy link

gitguardian bot commented Feb 14, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- Generic High Entropy Secret 118902a tests/Behat/features/wiki.feature View secret
- Generic High Entropy Secret 118902a tests/Behat/features/wiki.feature View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@Art4
Copy link
Collaborator Author

Art4 commented Feb 14, 2024

I've finished the migration to Behat and was able to add more tests about the returned data and status codes from Redmine server. This will become important for #367.

To run the Behat tests one can simply execute docker compose exec php composer run behat.

stdout from running behat
$ docker compose exec php composer run behat
> behat --config tests/Behat/behat.yml
Feature: Interacting with the REST API for attachments
    In order to interact with REST API for attachments
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Uploading an attachment                                                                      # features/attachments.feature:6
    Given I have a "NativeCurlClient" client                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    Then the response has the status code "201"                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      upload
      """
    And the returned data "upload" property is an array                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "upload" property has only the following properties                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      token
      """
    And the returned data "upload" property contains the following data                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value                                                              |
      | id       | 1                                                                  |
      | token    | 1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8 |

  Scenario: Showing the details of an attachment                                                        # features/attachments.feature:28
    Given I have a "NativeCurlClient" client                                                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    When I show the attachment with the id "1"                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheAttachmentWithTheId()
    Then the response has the status code "200"                                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      attachment
      """
    And the returned data "attachment" property is an array                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "attachment" property has only the following properties                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      filename
      filesize
      content_type
      description
      content_url
      author
      created_on
      """
    And the returned data "attachment" property contains the following data                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property     | value                                                                |
      | id           | 1                                                                    |
      | filename     | testfile.txt                                                         |
      | filesize     | 65                                                                   |
      | content_type | text/plain                                                           |
      | description  | null                                                                 |
      | content_url  | http://redmine-%redmine_id%:3000/attachments/download/1/testfile.txt |
    And the returned data "attachment.author" property is an array                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "attachment.author" property contains the following data                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

Feature: Interacting with the REST API for groups
    In order to interact with REST API for groups
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a group with minimal parameters             # features/groups.feature:6
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a group with name "Test Group"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    Then the response has the status code "201"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Listing of zero groups                             # features/groups.feature:22
    Given I have a "NativeCurlClient" client                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I list all groups                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllGroups()
    Then the response has the status code "200"                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      groups
      """
    And the returned data "groups" property is an array        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups" property contains "0" items # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()

  Scenario: Listing of one group                                                # features/groups.feature:34
    Given I have a "NativeCurlClient" client                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with name "Test Group"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    When I list all groups                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllGroups()
    Then the response has the status code "200"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      groups
      """
    And the returned data "groups" property is an array                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups" property contains "1" items                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "groups.0" property is an array                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups.0" property has only the following properties # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "groups.0" property contains the following data       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Showing a specific group                                         # features/groups.feature:57
    Given I have a "NativeCurlClient" client                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with name "Test Group"                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    When I show the group with id "4"                                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheGroupWithId()
    Then the response has the status code "200"                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      group
      """
    And the returned data "group" property is an array                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "group" property has only the following properties # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "group" property contains the following data       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Updating a group                                    # features/groups.feature:78
    Given I have a "NativeCurlClient" client                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with the following data                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithTheFollowingData()
      | property | value      |
      | name     | Test Group |
    When I update the group with id "4" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheGroupWithIdWithTheFollowingData()
      | property | value          |
      | name     | new group name |
    Then the response has the status code "204"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

Feature: Interacting with the REST API for projects
    In order to interact with REST API for projects
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a project with minimal parameters                             # features/projects.feature:6
    Given I have a "NativeCurlClient" client                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    Then the response has the status code "201"                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property   | value        |
      | id         | 1            |
      | name       | Test Project |
      | identifier | test-project |

  Scenario: Creating a project with multiple parameters          # features/projects.feature:31
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a project with the following data              # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithTheFollowingData()
      | property    | value               |
      | name        | Test Project        |
      | identifier  | test-project        |
      | description | project description |
      | homepage    | https://example.com |
    Then the response has the status code "201"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property        | value               |
      | id              | 1                   |
      | name            | Test Project        |
      | identifier      | test-project        |
      | description     | project description |
      | homepage        | https://example.com |
      | is_public       | true                |
      | inherit_members | false               |

  Scenario: Showing a specific project                                            # features/projects.feature:52
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the response has the status code "200"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      project
      """
    And the returned data "project" property is an array                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "project" property has only the following properties    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      trackers
      issue_categories
      created_on
      updated_on
      """
    And the returned data "project" property contains the following data          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property         | value        |
      | id               | 1            |
      | name             | Test Project |
      | identifier       | test-project |
      | description      | null         |
      | homepage         |              |
      | status           | 1            |
      | is_public        | true         |
      | inherit_members  | false        |
      | trackers         | []           |
      | issue_categories | []           |

  Scenario: Listing of zero projects                             # features/projects.feature:91
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I list all projects                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllProjects()
    Then the response has the status code "200"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      projects
      total_count
      offset
      limit
      """
    And the returned data "projects" property is an array        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects" property contains "0" items # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property    | value |
      | total_count | 0     |
      | offset      | 0     |
      | limit       | 25    |

  Scenario: Listing of one project                                                                                # features/projects.feature:111
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I list all projects                                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllProjects()
    Then the response has the status code "200"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property    | value |
      | total_count | 1     |
      | offset      | 0     |
      | limit       | 25    |
    And the returned data "projects" property is an array                                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects" property contains "1" items                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "projects.0" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects.0" property has only the following properties with Redmine version ">= 5.1.0" # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      created_on
      updated_on
      """
    But the returned data "projects.0" property has only the following properties with Redmine version "< 5.1.0"  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion()
      """
      id
      name
      identifier
      description
      status
      is_public
      inherit_members
      created_on
      updated_on
      """

  Scenario: Updating a project                                                       # features/projects.feature:152
    Given I have a "NativeCurlClient" client                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I update the project with identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheProjectWithIdentifierWithTheFollowingData()
      | property | value               |
      | name     | new project name    |
      | homepage | https://example.com |
    Then the response has the status code "204"                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

  Scenario: Closing a project                                                     # features/projects.feature:164
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I close the project with identifier "test-project"                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCloseTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 5     |

  Scenario: Reopening a project                                                   # features/projects.feature:177
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I close the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCloseTheProjectWithIdentifier()
    When I reopen the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iReopenTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 1     |

  Scenario: Archiving a project                                                   # features/projects.feature:191
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I archive the project with identifier "test-project"                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()

  Scenario: Showing an archived project is not possible                           # features/projects.feature:200
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I archive the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the response has the status code "403"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is false                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsFalse()

  Scenario: Unarchiving a project                                                 # features/projects.feature:210
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I archive the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    When I unarchive the project with identifier "test-project"                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUnarchiveTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 1     |

Feature: Interacting with the REST API for wikis
    In order to interact with REST API for wiki
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a wiki page                                                                                  # features/wiki.feature:6
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    Then the response has the status code "201"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | []                   |
    And the returned data "author" property is an array                                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author" property contains "1" items                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "author.@attributes" property is an array                                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author.@attributes" property has only the following properties                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "author.@attributes" property contains the following data                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Creating a wiki page with attachment upload                                                           # features/wiki.feature:44
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data           # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    When I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                                                                                                                                  |
      | text     | # My first wiki page                                                                                                                   |
      | uploads  | [{"token":"1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8","filename":"filename.txt","content-type":"text/plain"}] |
    Then the response has the status code "201"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | []                   |
    And the returned data "author" property is an array                                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author" property contains "1" items                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "author.@attributes" property is an array                                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author.@attributes" property has only the following properties                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "author.@attributes" property contains the following data                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Showing a wiki page                                                                                  # features/wiki.feature:86
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I show the wiki page with name "Test Page" and project identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "200"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      wiki_page
      """
    And the returned data "wiki_page" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page" property has only the following properties                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      attachments
      """
    And the returned data "wiki_page" property contains the following data                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property    | value                |
      | title       | Test+Page            |
      | text        | # My first wiki page |
      | version     | 1                    |
      | comments    | null                 |
      | attachments | []                   |
    And the returned data "wiki_page.author" property is an array                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.author" property has only the following properties                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.author" property contains the following data                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Showing a wiki page with uploaded attachment                                                         # features/wiki.feature:129
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data          # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                                                                                                                                  |
      | text     | # My first wiki page                                                                                                                   |
      | uploads  | [{"token":"1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8","filename":"filename.txt","content-type":"text/plain"}] |
    When I show the wiki page with name "Test Page" and project identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "200"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      wiki_page
      """
    And the returned data "wiki_page" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page" property has only the following properties                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      attachments
      """
    And the returned data "wiki_page" property contains the following data                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | null                 |
    And the returned data "wiki_page.author" property is an array                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.author" property has only the following properties                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.author" property contains the following data                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |
    And the returned data "wiki_page.attachments" property is an array                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments" property contains "1" items                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "wiki_page.attachments.0" property is an array                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments.0" property has only the following properties                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      filename
      filesize
      content_type
      description
      content_url
      author
      created_on
      """
    And the returned data "wiki_page.attachments.0" property contains the following data                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property     | value                                                                |
      | id           | 1                                                                    |
      | filename     | filename.txt                                                         |
      | filesize     | 65                                                                   |
      | content_type | text/plain                                                           |
      | description  |                                                                      |
      | content_url  | http://redmine-%redmine_id%:3000/attachments/download/1/filename.txt |
    And the returned data "wiki_page.attachments.0.author" property is an array                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments.0.author" property has only the following properties            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.attachments.0.author" property contains the following data                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Updating a wiki page                                                                                    # features/wiki.feature:207
    Given I have a "NativeCurlClient" client                                                                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I update the wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                          |
      | text     | # First Wiki page with changes |
    Then the response has the status code "204"                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

  Scenario: Deleting a wiki page                                                                                 # features/wiki.feature:221
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I delete the wiki page with name "Test Page" and project identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iDeleteTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "204"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

Feature: Interacting with the REST API for attachments
    In order to interact with REST API for attachments
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Uploading an attachment                                                                      # features/attachments.feature:6
    Given I have a "NativeCurlClient" client                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    Then the response has the status code "201"                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      upload
      """
    And the returned data "upload" property is an array                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "upload" property has only the following properties                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      token
      """
    And the returned data "upload" property contains the following data                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value                                                              |
      | id       | 1                                                                  |
      | token    | 1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8 |

  Scenario: Showing the details of an attachment                                                        # features/attachments.feature:28
    Given I have a "NativeCurlClient" client                                                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    When I show the attachment with the id "1"                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheAttachmentWithTheId()
    Then the response has the status code "200"                                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      attachment
      """
    And the returned data "attachment" property is an array                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "attachment" property has only the following properties                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      filename
      filesize
      content_type
      description
      content_url
      author
      created_on
      """
    And the returned data "attachment" property contains the following data                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property     | value                                                                |
      | id           | 1                                                                    |
      | filename     | testfile.txt                                                         |
      | filesize     | 65                                                                   |
      | content_type | text/plain                                                           |
      | description  | null                                                                 |
      | content_url  | http://redmine-%redmine_id%:3000/attachments/download/1/testfile.txt |
    And the returned data "attachment.author" property is an array                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "attachment.author" property contains the following data                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

Feature: Interacting with the REST API for groups
    In order to interact with REST API for groups
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a group with minimal parameters             # features/groups.feature:6
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a group with name "Test Group"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    Then the response has the status code "201"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Listing of zero groups                             # features/groups.feature:22
    Given I have a "NativeCurlClient" client                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I list all groups                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllGroups()
    Then the response has the status code "200"                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      groups
      """
    And the returned data "groups" property is an array        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups" property contains "0" items # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()

  Scenario: Listing of one group                                                # features/groups.feature:34
    Given I have a "NativeCurlClient" client                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with name "Test Group"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    When I list all groups                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllGroups()
    Then the response has the status code "200"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      groups
      """
    And the returned data "groups" property is an array                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups" property contains "1" items                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "groups.0" property is an array                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "groups.0" property has only the following properties # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "groups.0" property contains the following data       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Showing a specific group                                         # features/groups.feature:57
    Given I have a "NativeCurlClient" client                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with name "Test Group"                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithName()
    When I show the group with id "4"                                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheGroupWithId()
    Then the response has the status code "200"                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      group
      """
    And the returned data "group" property is an array                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "group" property has only the following properties # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "group" property contains the following data       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value      |
      | id       | 4          |
      | name     | Test Group |

  Scenario: Updating a group                                    # features/groups.feature:78
    Given I have a "NativeCurlClient" client                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a group with the following data                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAGroupWithTheFollowingData()
      | property | value      |
      | name     | Test Group |
    When I update the group with id "4" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheGroupWithIdWithTheFollowingData()
      | property | value          |
      | name     | new group name |
    Then the response has the status code "204"                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

Feature: Interacting with the REST API for projects
    In order to interact with REST API for projects
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a project with minimal parameters                             # features/projects.feature:6
    Given I have a "NativeCurlClient" client                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    Then the response has the status code "201"                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property   | value        |
      | id         | 1            |
      | name       | Test Project |
      | identifier | test-project |

  Scenario: Creating a project with multiple parameters          # features/projects.feature:31
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I create a project with the following data              # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithTheFollowingData()
      | property    | value               |
      | name        | Test Project        |
      | identifier  | test-project        |
      | description | project description |
      | homepage    | https://example.com |
    Then the response has the status code "201"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property        | value               |
      | id              | 1                   |
      | name            | Test Project        |
      | identifier      | test-project        |
      | description     | project description |
      | homepage        | https://example.com |
      | is_public       | true                |
      | inherit_members | false               |

  Scenario: Showing a specific project                                            # features/projects.feature:52
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the response has the status code "200"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      project
      """
    And the returned data "project" property is an array                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "project" property has only the following properties    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      trackers
      issue_categories
      created_on
      updated_on
      """
    And the returned data "project" property contains the following data          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property         | value        |
      | id               | 1            |
      | name             | Test Project |
      | identifier       | test-project |
      | description      | null         |
      | homepage         |              |
      | status           | 1            |
      | is_public        | true         |
      | inherit_members  | false        |
      | trackers         | []           |
      | issue_categories | []           |

  Scenario: Listing of zero projects                             # features/projects.feature:91
    Given I have a "NativeCurlClient" client                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    When I list all projects                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllProjects()
    Then the response has the status code "200"                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      projects
      total_count
      offset
      limit
      """
    And the returned data "projects" property is an array        # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects" property contains "0" items # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data has proterties with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property    | value |
      | total_count | 0     |
      | offset      | 0     |
      | limit       | 25    |

  Scenario: Listing of one project                                                                                # features/projects.feature:111
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I list all projects                                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iListAllProjects()
    Then the response has the status code "200"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property    | value |
      | total_count | 1     |
      | offset      | 0     |
      | limit       | 25    |
    And the returned data "projects" property is an array                                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects" property contains "1" items                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "projects.0" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "projects.0" property has only the following properties with Redmine version ">= 5.1.0" # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion()
      """
      id
      name
      identifier
      description
      homepage
      status
      is_public
      inherit_members
      created_on
      updated_on
      """
    But the returned data "projects.0" property has only the following properties with Redmine version "< 5.1.0"  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion()
      """
      id
      name
      identifier
      description
      status
      is_public
      inherit_members
      created_on
      updated_on
      """

  Scenario: Updating a project                                                       # features/projects.feature:152
    Given I have a "NativeCurlClient" client                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I update the project with identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheProjectWithIdentifierWithTheFollowingData()
      | property | value               |
      | name     | new project name    |
      | homepage | https://example.com |
    Then the response has the status code "204"                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                              # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

  Scenario: Closing a project                                                     # features/projects.feature:164
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I close the project with identifier "test-project"                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCloseTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 5     |

  Scenario: Reopening a project                                                   # features/projects.feature:177
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I close the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCloseTheProjectWithIdentifier()
    When I reopen the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iReopenTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 1     |

  Scenario: Archiving a project                                                   # features/projects.feature:191
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I archive the project with identifier "test-project"                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()

  Scenario: Showing an archived project is not possible                           # features/projects.feature:200
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I archive the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the response has the status code "403"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is false                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsFalse()

  Scenario: Unarchiving a project                                                 # features/projects.feature:210
    Given I have a "NativeCurlClient" client                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project" # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I archive the project with identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iArchiveTheProjectWithIdentifier()
    When I unarchive the project with identifier "test-project"                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUnarchiveTheProjectWithIdentifier()
    Then the response has the status code "204"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is true                                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsTrue()
    When I show the project with identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheProjectWithIdentifier()
    Then the returned data "project" property contains the following data         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value |
      | status   | 1     |

Feature: Interacting with the REST API for wikis
    In order to interact with REST API for wiki
    As a user
    I want to make sure the Redmine server replies with the correct response

  Scenario: Creating a wiki page                                                                                  # features/wiki.feature:6
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    When I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    Then the response has the status code "201"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | []                   |
    And the returned data "author" property is an array                                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author" property contains "1" items                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "author.@attributes" property is an array                                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author.@attributes" property has only the following properties                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "author.@attributes" property contains the following data                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Creating a wiki page with attachment upload                                                           # features/wiki.feature:44
    Given I have a "NativeCurlClient" client                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data           # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    When I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                                                                                                                                  |
      | text     | # My first wiki page                                                                                                                   |
      | uploads  | [{"token":"1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8","filename":"filename.txt","content-type":"text/plain"}] |
    Then the response has the status code "201"                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/xml"                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data is an instance of "SimpleXMLElement"                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsAnInstanceOf()
    And the returned data has only the following properties                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      """
    And the returned data has proterties with the following data                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasProtertiesWithTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | []                   |
    And the returned data "author" property is an array                                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author" property contains "1" items                                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "author.@attributes" property is an array                                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "author.@attributes" property has only the following properties                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "author.@attributes" property contains the following data                               # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Showing a wiki page                                                                                  # features/wiki.feature:86
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I show the wiki page with name "Test Page" and project identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "200"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      wiki_page
      """
    And the returned data "wiki_page" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page" property has only the following properties                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      attachments
      """
    And the returned data "wiki_page" property contains the following data                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property    | value                |
      | title       | Test+Page            |
      | text        | # My first wiki page |
      | version     | 1                    |
      | comments    | null                 |
      | attachments | []                   |
    And the returned data "wiki_page.author" property is an array                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.author" property has only the following properties                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.author" property contains the following data                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Showing a wiki page with uploaded attachment                                                         # features/wiki.feature:129
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I upload the content of the file "%tests_dir%/Fixtures/testfile_01.txt" with the following data          # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUploadTheContentOfTheFileWithTheFollowingData()
      | property | value        |
      | filename | testfile.txt |
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                                                                                                                                  |
      | text     | # My first wiki page                                                                                                                   |
      | uploads  | [{"token":"1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8","filename":"filename.txt","content-type":"text/plain"}] |
    When I show the wiki page with name "Test Page" and project identifier "test-project"                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iShowTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "200"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has the content type "application/json"                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContentType()
    And the returned data has only the following properties                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataHasOnlyTheFollowingProperties()
      """
      wiki_page
      """
    And the returned data "wiki_page" property is an array                                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page" property has only the following properties                                 # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      title
      text
      version
      author
      comments
      created_on
      updated_on
      attachments
      """
    And the returned data "wiki_page" property contains the following data                                       # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value                |
      | title    | Test+Page            |
      | text     | # My first wiki page |
      | version  | 1                    |
      | comments | null                 |
    And the returned data "wiki_page.author" property is an array                                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.author" property has only the following properties                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.author" property contains the following data                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |
    And the returned data "wiki_page.attachments" property is an array                                           # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments" property contains "1" items                                    # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsItems()
    And the returned data "wiki_page.attachments.0" property is an array                                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments.0" property has only the following properties                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      filename
      filesize
      content_type
      description
      content_url
      author
      created_on
      """
    And the returned data "wiki_page.attachments.0" property contains the following data                         # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property     | value                                                                |
      | id           | 1                                                                    |
      | filename     | filename.txt                                                         |
      | filesize     | 65                                                                   |
      | content_type | text/plain                                                           |
      | description  |                                                                      |
      | content_url  | http://redmine-%redmine_id%:3000/attachments/download/1/filename.txt |
    And the returned data "wiki_page.attachments.0.author" property is an array                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyIsAnArray()
    And the returned data "wiki_page.attachments.0.author" property has only the following properties            # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyHasOnlyTheFollowingProperties()
      """
      id
      name
      """
    And the returned data "wiki_page.attachments.0.author" property contains the following data                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataPropertyContainsTheFollowingData()
      | property | value         |
      | id       | 1             |
      | name     | Redmine Admin |

  Scenario: Updating a wiki page                                                                                    # features/wiki.feature:207
    Given I have a "NativeCurlClient" client                                                                        # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data    # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I update the wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iUpdateTheWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                          |
      | text     | # First Wiki page with changes |
    Then the response has the status code "204"                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                                                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                                                             # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

  Scenario: Deleting a wiki page                                                                                 # features/wiki.feature:221
    Given I have a "NativeCurlClient" client                                                                     # Redmine\Tests\Behat\Bootstrap\FeatureContext::iHaveAClient()
    And I create a project with name "Test Project" and identifier "test-project"                                # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAProjectWithNameAndIdentifier()
    And I create a wiki page with name "Test Page" and project identifier "test-project" with the following data # Redmine\Tests\Behat\Bootstrap\FeatureContext::iCreateAWikiPageWithNameAndProjectIdentifierWithTheFollowingData()
      | property | value                |
      | text     | # My first wiki page |
    When I delete the wiki page with name "Test Page" and project identifier "test-project"                      # Redmine\Tests\Behat\Bootstrap\FeatureContext::iDeleteTheWikiPageWithNameAndProjectIdentifier()
    Then the response has the status code "204"                                                                  # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheStatusCode()
    And the response has an empty content type                                                                   # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasAnEmptyContentType()
    And the response has the content ""                                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theResponseHasTheContent()
    And the returned data is exactly ""                                                                          # Redmine\Tests\Behat\Bootstrap\FeatureContext::theReturnedDataIsExactly()

48 scenarios (48 passed)
460 steps (460 passed)
0m21.89s (14.35Mb)
48 scenarios (48 passed)
460 steps (460 passed)
0m21.89s (14.35Mb)

@Art4 Art4 requested a review from kbsali February 14, 2024 09:39
@Art4 Art4 marked this pull request as ready for review February 14, 2024 09:40
Copy link
Owner

@kbsali kbsali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's pretty impressive, Well done! 💯 👏 👏

@Art4 Art4 merged commit 81259f3 into kbsali:v2.x Feb 14, 2024
12 checks passed
@Art4 Art4 deleted the behat branch February 14, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants