Commit 51809e4a authored by Tamaki Fujino's avatar Tamaki Fujino Committed by Yas Naoi
Browse files

Issue #3252913 by TamakiFujino, yas, kumikoono: Add a BDD test suite for AWS...

Issue #3252913 by TamakiFujino, yas, kumikoono: Add a BDD test suite for AWS resources (Elastic IPs)
parent cfb8ab9b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
account_id:
  # Need to set your AWS account id.
  your_account_id
avail_zone:
availability_zone:
  us-west-1a
cloud_context:
  # The region is automatically set as suffix.
@@ -14,6 +14,10 @@ cloud_service_provider_name_entered:
  BDD_AWS_@Random
cloud_service_provider_name:
  BDD_AWS_@Random (N. California)
elastic_ip:
  BDD_Random_Elastic_IP
elastic_ip_domain:
  Standard
description:
  Created by behat
image_id:
@@ -22,6 +26,8 @@ image_name:
  ubuntu-minimal/images/hvm-ssd/ubuntu-focal-20.04-amd64-minimal-20211001
instance_type:
  t3.nano
internet_gateway:
  BDD_IG_@Random
ip_protocol:
  All traffic
ipv4_cidr:
@@ -30,6 +36,8 @@ region_code:
  us-west-1a
region_name:
  US West (N. California)
resource_type:
  Instance
role_name:
  BDD_Role_@Random
role_name_machine:
+2 −3
Original line number Diff line number Diff line
Feature: Create resource for AWS as "Administrator"
  In order to change to ongoing state
  As an admin
Feature: Create resources for AWS as "Administrator"
  In order to start BDD testing
  We need to create some resources

  @javascript @api
+2 −3
Original line number Diff line number Diff line
Feature: View the created resources for AWS as "Administrator"
  In order to list resources on the ongoing state
  As a user
  I need to have both Drupal and AWS IAM permissions
  In order to prepare BDD testing
  We need to make sure the role exists

  Scenario: Log in with the "Anonymous user" role
    Given I am not logged in
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ Feature: Launch EC2 instance as "Authenticated User"
    And I enter "{{ vpc_name }}" for "Name"
    And I enter "{{ ipv4_cidr }}" for "IPv4 CIDR block"
    And I press "Save"
    And I wait {{ wait }} milliseconds
    Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/vpc"
    And I should see "has been created"
    And I should see the link "{{ vpc_name }}" in the table
+124 −0
Original line number Diff line number Diff line
Feature: Create an Elastic IP

  @javascript  @api
  Scenario: Create an Elastic IP
    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip/add"
    And I should see the heading "Add AWS Cloud Elastic IP"
    And I enter "{{ elastic_ip }}" for "Name"
    And I select "{{ elastic_ip_domain }}" from "Domain (Standard | VPC)"
    And I select "{{ region_code }}" from "Network border group"
    And I press "Save"
    And I wait for AJAX to finish
    Then the url should match "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip"
    And I should see "has been created"

  @javascript  @api
  Scenario: Add an Internet gateway
    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway/add"
    And I should see the heading "Add AWS Cloud internet gateway"
    And I enter "{{ internet_gateway }}" for "Name"
    And I press "Save"
    And I wait for AJAX to finish
    Then the url should match "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see the link "{{ internet_gateway }}"

  @javascript  @api
  Scenario: Associate an Internet gateway
    Given I am logged in as a user with the "Administrator" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see the link "{{ internet_gateway }}"
    And I should see the button "Attach"
    And I press "Attach"
    And the url should match "/attach"
    And I select "{{ vpc_name }}" from "VPC CIDR (ID)"
    And I press "Attach"
    And I wait for AJAX to finish
    Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see "is attached to VPC"
    And I should see "Detach" in the "{{ internet_gateway }}" row

  @javascript  @api
  Scenario: Associate an Elastic IP
    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context}}/elastic_ip"
    And I click "Refresh"
    And I should see the link "{{ elastic_ip }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ elastic_ip }}"
    And the url should match "/elastic_ip/"
    And I click "Associate Elastic IP" in the "actions"
    And the url should match "/associate"
    And I select "{{ resource_type }}" from "Resource type"
    And I select "{{ instance_name }}" from "Instance"
    And I wait {{ wait }} milliseconds
    And I press "Associate"
    And I wait for AJAX to finish
    Then I should see "associated with"
    And I should see "Disassociate Elastic IP" in the "actions"

  @javascript  @api
  Scenario: Disassociate an Elastic IP

    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip"
    And I click "Refresh"
    And I should see the link "{{ elastic_ip }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ elastic_ip}}"
    And the url should match "/elastic_ip/"
    And I click "Disassociate Elastic IP" in the "actions"
    And the url should match "/disassociate"
    And I press "Disassociate Address"
    And I wait for AJAX to finish
    Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip"
    And I should see "Elastic IP disassociated from"


  @javascript @api
  Scenario: Delete an Elastic IP
    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip"
    And I click "Refresh"
    And I should see the link "{{ elastic_ip }}"
    And I wait {{ wait }} milliseconds
    And I click "{{ elastic_ip }}"
    And the url should match "/elastic_ip/"
    And I click "Delete" in the "actions"
    And the url should match "/delete"
    And I press "Delete"
    And I wait for AJAX to finish
    Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/elastic_ip"
    And I should see "has been deleted"
    And I click "Refresh"
    # No table exists.
    And I should not see the link "{{ elastic_ip }}"

  @javascript  @api
  Scenario: Detach an Internet gateway
    Given I am logged in as a user with the "Administrator" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see the link "{{ internet_gateway }}"
    And I should see the button "Detach"
    And I press "Detach"
    And the url should match "/detach"
    And I press "Detach"
    And I wait for AJAX to finish
    Then I should be on "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see "detached from VPC"
    And I should see the button "Attach"

  @javascript  @api
  Scenario: Delete an Internet gateway
    Given I am logged in as a user with the "{{ role_name }}" role
    When I visit "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see the link "{{ internet_gateway }}"
    And I click "{{ internet_gateway }}"
    And the url should match "/internet_gateway/"
    And I click "Delete"
    And the url should match "/delete"
    And I press "Delete"
    And I wait for AJAX to finish
    Then the url should match "/clouds/aws_cloud/{{ cloud_context }}/internet_gateway"
    And I should see "has been deleted"
 No newline at end of file