Commit ae18235a authored by shota niioka's avatar shota niioka Committed by Yas Naoi
Browse files

Issue #3292142 by shota niioka, yas, kumikoono: Add a BDD test suite for...

Issue #3292142 by shota niioka, yas, kumikoono: Add a BDD test suite for OpenStack security groups (Read and Update)
parent 64c8c113
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ Feature: Create a Drupal role for OpenStack and a user as "Administrator"
    # This permission is temporary once perimission is fixed we don't have to add perimission
    And I check the box "Delete any OpenStack security group"
    And I check the box "View any OpenStack security group"
    And I check the box "Edit any OpenStack security group"    
    # Allow to launch an instance.
    And I check the box "Launch approved cloud launch template"
    And I press "Save permissions"
+113 −0
Original line number Diff line number Diff line
@minimal @ci_job
Feature: Create, read, update and delete a Security Groups for OpenStack as "Authenticated User"

  @api @javascript
  Scenario: Create a security group
    Given I am logged in as user "{{ drupal_user_name }}"
    When I visit "/clouds/openstack/{{ cloud_context }}/security_group/add"
    And I should see the heading "Add OpenStack security group"
    And I enter "{{ security_group_name_ope }}" for "Security group name"
    And I enter "{{ security_group_description }}" for "Description"
    And I press "Save"
    And I wait for AJAX to finish
    Then the url should match "/clouds/openstack/{{ cloud_context }}/security_group/"
    And I should see the success message "has been created"
    And I should see the success message "Setup the IP permissions"
    And I should see the link "{{ security_group_name_ope }}" in the success_message
    And I should see neither error nor warning messages

  @api @javascript
  Scenario: Read the security group
    Given I am logged in as user "{{ drupal_user_name }}"
    When I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    Then the url should match "/clouds/openstack/{{ cloud_context }}/security_group/"
    And I should see "{{ security_group_name_ope }}"
    And I should see "{{ security_group_description }}"

  @wip # Remove @wip tag once Cloud Orchestrator support select function
  @api @javascript
  Scenario: Add a rules to the security group
    Given I am logged in as user "{{ drupal_user_name }}"
    When I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    Then the url should match "/clouds/openstack/{{ cloud_context }}/security_group/"
    And I click "Edit"
    Then the url should match "/edit"
    # Add a rule to inbound_rules
    And I fill in "{{ security_group_port }}" for "From Port" in the row "0" in the "inbound_rules"
    And I fill in "{{ security_group_port }}" for "To Port" in the row "0" in the "inbound_rules"
    # Currently Cloud Orchestrator does not support select function
    And I select "{{ security_group_source }}" from "Source" in the row "0" in the "inbound_rules"
    And I fill in "{{ security_group_ip }}" for "CIDR IP" in the row "0" in the "inbound_rules"
    And I fill in "{{ security_group_description }}" for "Description" in the row "0" in the "inbound_rules"
    # Add a rule to outbound_rules
    And I fill in "{{ security_group_port }}" for "From Port" in the row "1" in the "outbound_rules"
    And I fill in "{{ security_group_port }}" for "To Port" in the row "1" in the "outbound_rules"
    # Currently Cloud Orchestrator does not support select function
    And I select "{{ security_group_source }}" from "Source" in the row "1" in the "outbound_rules"
    And I fill in "{{ security_group_ip }}" for "CIDR IP" in the row "1" in the "outbound_rules"
    And I fill in "{{ security_group_description }}" for "Description" in the row "1" in the "outbound_rules"
    And I press "Save"
    And I wait for AJAX to finish
    And I wait {{ wait }} milliseconds
    Then I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    And I should see "{{ security_group_port }}" in the "{{ security_group_description }}" row in the "inbound_rules"
    And I should see "{{ security_group_port }}" in the "{{ security_group_description }}" row in the "inbound_rules"
    And I should see "{{ security_group_ip }}" in the "{{ security_group_description }}" row in the "inbound_rules"
    And I should see "{{ security_group_port }}" in the "{{ security_group_description }}" row in the "outbound_rules"
    And I should see "{{ security_group_port }}" in the "{{ security_group_description }}" row in the "outbound_rules"
    And I should see "{{ security_group_ip }}" in the "{{ security_group_description }}" row in the "outbound_rules"

  @wip # Remove @wip tag once Cloud Orchestrator support select function
  @api @javascript
  Scenario: Remove a rule from the security group
    Given I am logged in as user "{{ drupal_user_name }}"
    When I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    Then the url should match "/clouds/openstack/{{ cloud_context }}/security_group/"
    # Confirm rule in outbound_rules
    And I should see "{{ security_group_ip }}" in the "outbound_rules"
    And I click "Edit"
    Then the url should match "/edit"
    And I follow "Remove rule" in a row with "{{ security_group_ip }}" set in "CIDR IP" in the "outbound_rules"
    And I press "Save"
    And I wait for AJAX to finish
    And I wait {{ wait }} milliseconds
    Then I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    And I should not see "{{ security_group_ip }}" in the "outbound_rules"

  @api @javascript
  Scenario: Delete the security group
    Given I am logged in as user "{{ drupal_user_name }}"
    When I visit "/clouds/openstack/{{ cloud_context }}/security_group"
    And I click "Refresh"
    And I should see the link "{{ security_group_name_ope }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ security_group_name_ope }}"
    Then the url should match "/clouds/openstack/{{ cloud_context }}/security_group/"
    And I click "Delete"
    Then the url should match "/delete"
    And I press "Delete"
    Then I should be on "/clouds/openstack/{{ cloud_context }}/security_group"
    And I should see the success message "has been deleted"
    And I should see neither error nor warning messages
    And I click "Refresh"
    And I should not see the link "{{ security_group_name_ope }}"
+9 −1
Original line number Diff line number Diff line
@@ -46,9 +46,17 @@ project_id:
region:
  # You need to change the value here, or define the key-value
security_group_description:
  testing for bdd
  Created by behat
security_group_ip:
  10.0.0.0/24
security_group_name:
  BDD_SG_@Random
security_group_name_ope:
  BDD_SG_@Random_ope
security_group_port:
  80
security_group_source:
  IP
snapshot_name:
  BDD_snapshot_@Random
snapshot_name_edit: