From 04c219348e043ee0ee6b23ab9dff59e94e6677fc Mon Sep 17 00:00:00 2001
From: Tamaki Fujino <57009-TamakiFujino@users.noreply.drupalcode.org>
Date: Fri, 3 Feb 2023 06:39:56 +0000
Subject: [PATCH] Issue #3335024 by TamakiFujino, yas, Xiaohua Guan: Add a BDD
 test suite for OpenStack template versions (Read)

---
 ...OpenStack-ATDD-03-15-OperateStacks.feature |  2 +-
 ...ATDD-03-17-OperateTemplateVersions.feature | 29 +++++++++++++++++++
 .../templates/params/openstack_common.yml     |  2 ++
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-17-OperateTemplateVersions.feature

diff --git a/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-15-OperateStacks.feature b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-15-OperateStacks.feature
index c2d2ef5768..9e6d488a0a 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-15-OperateStacks.feature
+++ b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-15-OperateStacks.feature
@@ -1,4 +1,4 @@
-@minimal @ci_job @my_test
+@minimal @ci_job
 Feature: Create, read, update, and delete a stack for OpenStack as "Authenticated User"
 
   @api
diff --git a/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-17-OperateTemplateVersions.feature b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-17-OperateTemplateVersions.feature
new file mode 100644
index 0000000000..f41238b7ff
--- /dev/null
+++ b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/OpenStack-ATDD-03-17-OperateTemplateVersions.feature
@@ -0,0 +1,29 @@
+@ci_job @my_test
+Feature: View and refresh a template version as "Administrator"
+
+  @api
+  Scenario: Refresh template versions as "Administrator"
+    Given I am logged in as a user with the "Administrator" role
+    When I visit "/clouds/openstack/{{ cloud_context }}/template_version"
+    And I should see "{{ template_version_name_operate }}" in the table
+    # The refresh button is displayed for only administrators
+    And I click "Refresh"
+    And I should see the success message "Updated Template Versions"
+    And I should see neither error nor warning messages
+    And I should see "{{ template_version_name_operate }}" in the table
+
+  @api
+  Scenario Outline: Read a template version as a user and administrator
+    Given I am logged in as <role>
+    When I visit "/clouds/openstack/{{ cloud_context }}/template_version"
+    And I should see "{{ template_version_name_operate }}" in the table
+    And I click "{{ template_version_name_operate }}"
+    Then the url should match "/clouds/openstack/{{ cloud_context }}/template_version/"
+    And I should see "{{ template_version_name_operate }}" in the "page_header"
+    And I should see "{{ template_version_name_operate }}" in the "Name"
+    And I should see neither error nor warning messages
+
+    Examples:
+      | role                                 |
+      | user "{{ drupal_user_name }}"        |
+      | a user with the "Administrator" role |
diff --git a/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/params/openstack_common.yml b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/params/openstack_common.yml
index a02d59cd6e..500a986935 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/params/openstack_common.yml
+++ b/modules/cloud_service_providers/openstack/tests/src/Behat/features/templates/params/openstack_common.yml
@@ -187,6 +187,8 @@ subnet_name_operate:
   BDD_subnet_@Random_operate
 subnet_name_operate_updated:
   BDD_subnet_@Random_updated_operate
+template_version_name_operate:
+  heat_template_version.2021-04-16
 user_name:
   # You need to change the value here, or define the key-value
 user_password:
-- 
GitLab