Commit b54e9928 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel_ui_test: test remote node allocation

parent 77285a24
......@@ -21,9 +21,11 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
manager_login, passwd):
manager_login, remote_customer_login,
passwd):
if scenario not in ['accounting', 'customer', 'customer_shared']:
if scenario not in ['accounting', 'customer', 'customer_shared',
'customer_remote']:
raise ValueError('Unsupported bootstrap scenario: %s' % scenario)
portal = self.getPortalObject()
......@@ -47,6 +49,13 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
)
project.validate()
if scenario == 'customer_remote':
remote_project = portal.project_module.newContent(
portal_type="Project",
title='Test Remote Project'
)
remote_project.validate()
# Bootstrap one manager user
manager_person = portal.person_module.newContent(
portal_type='Person',
......@@ -93,6 +102,34 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, scenario, customer_login,
password=passwd
).validate()
customer_person.validate()
if scenario == 'customer_remote':
customer_person.newContent(
portal_type='Assignment',
title='Production Manager for project %s' % remote_project.getTitle(),
destination_project_value=remote_project,
function='production/manager'
).open()
# Bootstrap one customer user for the remote project
remote_customer_person = portal.person_module.newContent(
portal_type='Person',
first_name='Manual test Remote Project Customer',
default_email_coordinate_text='romain+remote+customer@nexedi.com'
)
remote_customer_person.newContent(
portal_type='Assignment',
title='Customer for project %s' % remote_project.getTitle(),
destination_project_value=remote_project,
function='customer'
).open()
remote_customer_person.newContent(
portal_type='ERP5 Login',
reference=remote_customer_login,
password=passwd
).validate()
remote_customer_person.validate()
finally:
setSecurityManager(sm)
......
<?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>testCustomerRemoteInstanceScenario</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 SlapOS Panel</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Test SlapOS Panel</td>
</tr>
</thead>
<tbody tal:define="user_configuration python: context.ERP5Site_generateTestUserConfiguration()">
<tal:block tal:define="init_configuration python: {'scenario': 'customer_remote'}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/slapos_init" />
</tal:block>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/slapos_master_panel/#?editable=1</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="login_configuration python: {'user': user_configuration['customer_login'], 'password': user_configuration['passwd']}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
<tr>
<td colspan="3"><b>Go to the project page</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Test Remote Project'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Add a software product</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Add Software Product'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='field_your_product_import_json']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='field_your_product_import_json']</td>
<td>https://lab.nexedi.com/nexedi/slapos/raw/1.0.289/software/theia/software.cfg</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New Software Product created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Back to the project page</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Software Product: Theia'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Add a remote node</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Add Remote Node'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>type</td>
<td>//input[@name='field_your_title']</td>
<td>Test Remote Node</td>
</tr>
<tr>
<td>select</td>
<td>//select[@name='field_your_destination_project']</td>
<td>Test Project</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='field_your_partition_amount']</td>
<td>1</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New Remote Node created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/wait_for_activities" />
<tr>
<td colspan="3"><b>Ensure everything is indexed, to be able to select the software product</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/wait_for_activities" />
<tr>
<td colspan="3"><b>Create Allocation Supply</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Add Allocation Supply'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New Allocation Supply created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Allow the release on the remote node</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Theia'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>click</td>
<td>//input[@name='field_matrixbox_allocable_cell_0_0_0']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr>
<td colspan="3"><b>Back to the allocation supply page</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Allocation Supply Line: Theia'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Activate Allocation Supply</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Validate and Supply'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Allocation Supply validated.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/logout" />
<tal:block tal:define="login_configuration python: {'user': user_configuration['remote_customer_login'], 'password': user_configuration['passwd']}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
<tr>
<td colspan="3"><b>Go to the remote project page</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Test Remote Project'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Add an instance tree</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Add Instance Tree'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>click</td>
<td>//input[@name='field_your_aggregate_uid']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data received.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<!--tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /-->
<tr>
<td>click</td>
<td>//input[@name='field_your_url_string']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data received.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<!--tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" /-->
<!-- XXX TODO gadget crash if not fully loaded. Remove next wait, and fix gadget -->
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='//frontend-guid']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='field_your_title']</td>
<td>Test instance</td>
</tr>
<tr>
<td>select</td>
<td>//select[@name='software_type']</td>
<td>Default</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Action succeeded.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Go to the project page</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Test Remote Project'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Activate alarms, to create remote instance</b></td>
</tr>
<tr>
<td>store</td>
<td>javascript{selenium.browserbot.currentWindow.location.href}</td>
<td>current_location</td>
</tr>
<!-- run alarms multiple times, to detect unexpected side effects -->
<tal:block tal:repeat="step python: range(0, 3)">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/activate_alarm" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tr>
<td>open</td>
<td>${current_location}</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/logout" />
<tal:block tal:define="login_configuration python: {'user': user_configuration['customer_login'], 'password': user_configuration['passwd']}">
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/login" />
</tal:block>
<tr>
<td colspan="3"><b>Go to the project page</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Test Project'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Instance Tree</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '1 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block tal:define="click_configuration python: {'text': 'Instance Tree'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_SlapOSPanelTemplate/macros/check_consistency" />
</tbody>
</table>
</body>
</html>
\ No newline at end of file
......@@ -4,6 +4,7 @@ now = int(DateTime())
return {
'customer_login': 'testcustomer%s' % now,
'remote_customer_login': 'testremotecustomer%s' % now,
'manager_login': 'testmanager%s' % now,
'passwd': 'eiChaxo5Eefier9vAek7phie$%s' % now
}
......@@ -11,7 +11,7 @@
<tr>
<td>open</td>
<td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?scenario=%s&manager_login=%s&customer_login=%s&passwd=%s' % (init_configuration['scenario'], user_configuration['manager_login'], user_configuration['customer_login'], user_configuration['passwd'])">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td tal:content="python: '${base_url}/ERP5Site_bootstrapSlapOSPanelTest?scenario=%s&manager_login=%s&customer_login=%s&remote_customer_login=%s&passwd=%s' % (init_configuration['scenario'], user_configuration['manager_login'], user_configuration['customer_login'], user_configuration['remote_customer_login'], user_configuration['passwd'])">.../ERP5Site_bootstrapSlapOSPanelTest</td>
<td></td>
</tr>
<tr>
......
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