@fixture.boto3
Feature: Show DNA account products

  Scenario: Go to products settings
    Given the following DNA accounts
      | sub          | name       | email               |
      | sme-dna-1705 | Carol Cruz | carol.cruz@sme.test |
    And the following Claims
      | resource_group       | claim_name         | claim_values    | multi |
      | Apollo               | Role               | User, Superuser | No    |
      | Apollo               | Market permissions | USA, UAE, UK    | Yes   |
    And I authenticated as admin
    And I visit the accounts page
    And I submit "sme-dna-1705" into the accounts search box
    And I follow the link containing "Carol"
    Then I should see the account detail "Email" as "carol.cruz@sme.test"
    When I follow the link containing "Products"
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"

  Scenario: View product page with no claims
    Given the following DNA accounts
      | sub          | name       | email               |
      | sme-dna-1705 | Carol Cruz | carol.cruz@sme.test |
    And the following Claims
      | resource_group       | claim_name         | claim_values    | multi |
      | Apollo               | Role               | User, Superuser | No    |
      | Apollo               | Market permissions | USA, UAE, UK    | Yes   |
    And I authenticated as admin
    And I visit the accounts page
    And I submit "sme-dna-1705" into the accounts search box
    And I follow the link containing "Carol"
    When I follow the link containing "Products"
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"
    And I should see left sidebar with "Apollo" product link
    And I should see edit button with text "Enable"
    And I should see the following readonly claim values
      | claim_name         | claim_value    |
      | Role               | N/A            |
      | Market permissions | N/A            |
    And I should see timestamps section with fields "First enabled" "Disabled"

  Scenario: Update product claims
    Given the following DNA accounts
      | sub          | name       | email               |
      | sme-dna-1705 | Carol Cruz | carol.cruz@sme.test |
    And the following Claims
      | resource_group       | claim_name         | claim_values    | multi |
      | Apollo               | Role               | User, Superuser | No    |
      | Apollo               | Market permissions | USA, UAE, UK    | Yes   |
    And I authenticated as admin
    And I visit the accounts page
    And I submit "sme-dna-1705" into the accounts search box
    And I follow the link containing "Carol"
    When I follow the link containing "Products"
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"
    When I follow the link containing "Enable"
    Then I should see "Apollo" edit product page for "Carol Cruz"
    And I should see left sidebar with "Apollo" product link
    And I should see the following editable claim values
      | claim_name         | claim_value    |
      | Role               | N/A            |
      | Market permissions |                |
    When I update and save the following claim values
      | claim_name         | claim_value    |
      | Role               | User           |
      | Market permissions | UK, USA        |
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"
    And I should see edit button with text "Edit"
    And I should see the following readonly claim values
      | claim_name         | claim_value    |
      | Role               | User           |
      | Market permissions | UK, USA        |
    And I should see timestamps section with fields "Enabled" "Last modified"

  Scenario: Disable product
    Given the following DNA accounts
      | sub          | name       | email               |
      | sme-dna-1705 | Carol Cruz | carol.cruz@sme.test |
    And the following Claims
      | resource_group       | claim_name         | claim_values    | multi |
      | Apollo               | Role               | User, Superuser | No    |
      | Apollo               | Market permissions | USA, UAE, UK    | Yes   |
    And the following assigned claim values for DNA sub "sme-dna-1705"
      | claim_name         | claim_value    |
      | Role               | User           |
      | Market permissions | UK, USA        |
    And I authenticated as admin
    And I visit the accounts page
    And I submit "sme-dna-1705" into the accounts search box
    And I follow the link containing "Carol"
    When I follow the link containing "Products"
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"
    And I should see edit button with text "Edit"
    When I follow the link containing "Edit"
    Then I should see "Apollo" edit product page for "Carol Cruz"
    And I should see left sidebar with "Apollo" product link
    And I should see the following editable claim values
      | claim_name         | claim_value    |
      | Role               | User           |
      | Market permissions | UK, USA        |
    And I should see timestamps section with fields "Enabled" "Last modified"
    And I should see product disable button
    When I disable the product
    Then I should be redirected and follow
    Then I should see "Apollo" show product page for "Carol Cruz"
    And I should see edit button with text "Enable"
    And I should see the following readonly claim values
      | claim_name         | claim_value    |
      | Role               | User           |
      | Market permissions | UK, USA        |
    And I should see timestamps section with fields "First enabled" "Disabled"
