Commit 31829030 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio_ui_test: Add test for a more complex software release parameter editor

Use JSON serialisation case by reusing the KVM Cluster Case.
parent 02dd4cc6
...@@ -33,66 +33,14 @@ ...@@ -33,66 +33,14 @@
<td colspan="3"><b> Request a Software </b></td> <td colspan="3"><b> Request a Software </b></td>
</tr> </tr>
<tr> <tal:block define="software_product python: 'Frontend'">
<td colspan="3"><b> Select a Software Product</b></td> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_product" />
</tr>
<tal:block define="header python: '1/3 Select one Software'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block> </tal:block>
<tr> <tal:block define="software_release python: 'Frontend'">
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_release" />
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Products')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Products')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//td/a[text()="Frontend"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//td/a[text()="Frontend"]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b> Select a Software Release</b></td>
</tr>
<tal:block define="header python: '2/3 Select one Release'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block> </tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Releases')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Releases')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_listbox_loaded" />
<tr>
<td>click</td>
<td>//td/a[text()="Frontend"]</td>
<td></td>
</tr>
<tr> <tr>
<td colspan="3"><b> Fill Request form </b></td> <td colspan="3"><b> Fill Request form </b></td>
</tr> </tr>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSServiceJSONSerialisation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test SlapJS UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_init" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_login" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block define="menu_action python: 'Add'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tr>
<td colspan="3"><b> Request a Software </b></td>
</tr>
<tal:block define="software_product python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_product" />
</tal:block>
<tal:block define="software_release python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_release" />
</tal:block>
<tr>
<td colspan="3"><b> Fill Request form </b></td>
</tr>
<tal:block define="header python: '3/3 Request Service: KVM'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//input[@id="title"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="title"]</td>
<td>TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]//option[text()="Cluster"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]//option[text()="Cluster"]</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td>Cluster</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="ADD//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="ADD//kvm-partition-dict"]</td>
<td>KVM-CLUSTER-INSTANCE-0</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@name="//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@name="//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td>10</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="ADD//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="ADD//kvm-partition-dict"]</td>
<td>KVM-CLUSTER-INSTANCE-1</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@name="//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@name="//kvm-partition-dict"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1/disk-size"]</td>
<td>20</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New service created.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '1 Records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Hosting Subscription: TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//span[@class="bt_close CLOSE//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//span[@class="bt_close CLOSE//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1"]</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td>2000</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_save" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data updated.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '1 Records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Hosting Subscription: TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-0/disk-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//input[@name="//kvm-partition-dict/KVM-CLUSTER-INSTANCE-1/disk-size"]</td>
<td></td>
</tr>
<tal:block define="menu_action python: 'Destroy'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tal:block define="header python: 'Destroy Hosting Subscription: TEST-SLAPOSJS-SERVICE-KVM-CLUSTER 0'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Service is Destroyed.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_logout" />
</tbody></table>
</body>
</html>
\ No newline at end of file
# PreferenceTool # PreferenceTool
from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
preference = portal.portal_preferences.getActiveSystemPreference() preference = portal.portal_preferences.getActiveSystemPreference()
...@@ -9,4 +10,67 @@ preference.edit( ...@@ -9,4 +10,67 @@ preference.edit(
preferred_credential_request_automatic_approval=1 preferred_credential_request_automatic_approval=1
) )
try:
kvm_product = context.software_product_module["kvm"]
except KeyError:
kvm_product = context.software_product_module.newContent(
id="kvm",
title="KVM",
product_line ="software/application",
reference="kvm",
portal_type="Software Product"
)
if kvm_product.getValidationState() == "draft":
kvm_product.publish()
try:
kvm_software_release = context.software_release_module["kvm"]
except KeyError:
kvm_software_release = context.software_release_module.newContent(
id="kvm",
title="KVM",
portal_type="Software Release",
url_string="https://lab.node.vifib.com/nexedi/slapos/raw/1.0.102/software/kvm/software.cfg",
version="0.1",
language="en",
effective_date=DateTime('2018/03/14 00:00:00 UTC'),
aggregate="software_product_module/kvm"
)
if kvm_software_release.getValidationState() == "draft":
kvm_software_release.publishAlive()
try:
slaprunner_product = context.software_product_module["slaprunner"]
except KeyError:
slaprunner_product = context.software_product_module.newContent(
id="slaprunner",
title="Webrunner",
product_line ="software/application",
reference="slaprunner",
portal_type="Software Product"
)
if slaprunner_product.getValidationState() == "draft":
slaprunner_product.publish()
try:
slaprunner_software_release = context.software_release_module["slaprunner"]
except KeyError:
slaprunner_software_release = context.software_release_module.newContent(
id="slaprunner",
title="Webrunner",
portal_type="Software Release",
url_string="https://lab.node.vifib.com/nexedi/slapos/raw/1.0.102/software/slaprunner/software.cfg",
version="0.1",
language="en",
effective_date=DateTime('2018/03/14 00:00:00 UTC'),
aggregate="software_product_module/slaprunner"
)
if slaprunner_software_release.getValidationState() == "draft":
slaprunner_software_release.publishAlive()
return "Done." return "Done."
...@@ -850,5 +850,69 @@ ...@@ -850,5 +850,69 @@
</tal:block> </tal:block>
<tal:block metal:define-macro="select_software_product">
<tr>
<td colspan="3"><b> Select a Software Product</b></td>
</tr>
<tal:block define="header python: '1/3 Select one Software'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Products')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Products')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//td/a[text()=\'%s\']' % software_product"></td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="python: '//td/a[text()=\'%s\']' % software_product"></td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="select_software_release">
<tr>
<td colspan="3"><b> Select a Software Release</b></td>
</tr>
<tal:block define="header python: '2/3 Select one Release'; ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Releases')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1[contains(text(), 'Software Releases')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_listbox_loaded" />
<tr>
<td>click</td>
<td tal:content="python: '//td/a[text()=\'%s\']' % software_release"></td>
<td></td>
</tr>
</tal:block>
</tal:block> </tal:block>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment