[Intern] Apply new helpers

Related to blueprint ui-functional-tests-with-intern

The following tests updated:
* node view tests
* Settings tab tests
* node management panel tests
* role management tests

Change-Id: I85afe0a25fba34a37d6010aa367f368b5a16d7eb
This commit is contained in:
Julia Aranovich 2015-09-21 16:36:31 +03:00
parent 06e93da558
commit 63e8c259cb
5 changed files with 112 additions and 321 deletions

View File

@ -51,86 +51,46 @@ define([
},
'Add Cluster Nodes': function() {
return this.remote
.then(function() {
return common.assertElementExists('.node-list .alert-warning', 'Node list shows warning if there are no nodes in environment');
})
.assertElementExists('.node-list .alert-warning', 'Node list shows warning if there are no nodes in environment')
.clickByCssSelector('.btn-add-nodes')
// wait for unallocated nodes loaded
.waitForCssSelector('.node', 2000)
.then(function() {
return common.assertElementDisabled(applyButtonSelector, 'Apply button is disabled until both roles and nodes chosen');
})
.then(function() {
return common.assertElementDisabled('.role-panel [type=checkbox][name=mongo]', 'Unavailable role has locked checkbox');
})
.then(function() {
return common.assertElementExists('.role-panel .mongo i.tooltip-icon', 'Unavailable role has warning tooltip');
})
.assertElementsAppear('.node', 2000, 'Unallocated nodes loaded')
.assertElementDisabled(applyButtonSelector, 'Apply button is disabled until both roles and nodes chosen')
.assertElementDisabled('.role-panel [type=checkbox][name=mongo]', 'Unavailable role has locked checkbox')
.assertElementExists('.role-panel .mongo i.tooltip-icon', 'Unavailable role has warning tooltip')
.then(function() {
return clusterPage.checkNodeRoles(['Controller', 'Storage - Cinder']);
})
.then(function() {
return common.assertElementDisabled('.role-panel [type=checkbox][name=compute]', 'Compute role can not be added together with selected roles');
})
.then(function() {
return common.assertElementDisabled(applyButtonSelector, 'Apply button is disabled until both roles and nodes chosen');
})
.assertElementDisabled('.role-panel [type=checkbox][name=compute]', 'Compute role can not be added together with selected roles')
.assertElementDisabled(applyButtonSelector, 'Apply button is disabled until both roles and nodes chosen')
.then(function() {
return clusterPage.checkNodes(nodesAmount);
})
.clickByCssSelector(applyButtonSelector)
.waitForElementDeletion(applyButtonSelector, 2000)
// wait for cluster node list loaded
.waitForCssSelector('.nodes-group', 2000)
.findAllByCssSelector('.node-list')
.findAllByCssSelector('.node')
.then(function(elements) {
return assert.equal(elements.length, nodesAmount, nodesAmount + ' nodes were successfully added to the cluster');
})
.end()
.findAllByCssSelector('.nodes-group')
.then(function(elements) {
return assert.equal(elements.length, 1, 'One node group is present');
})
.end()
.end();
.assertElementAppears('.nodes-group', 2000, 'Cluster node list loaded')
.assertElementsExist('.node-list .node', nodesAmount, nodesAmount + ' nodes were successfully added to the cluster')
.assertElementExists('.nodes-group', 'One node group is present');
},
'Edit cluster node roles': function() {
return this.remote
.then(function() {
return common.addNodesToCluster(1, ['Storage - Cinder']);
})
.findAllByCssSelector('.node-list .nodes-group')
.then(function(elements) {
return assert.equal(elements.length, 2, 'Two node groups are present');
})
.end()
.assertElementsExist('.nodes-group', 2, 'Two node groups are present')
// select all nodes
.clickByCssSelector('.select-all label')
.clickByCssSelector('.btn-edit-roles')
// wait for cluster nodes screen unmounted
.waitForElementDeletion('.btn-edit-roles', 2000)
.then(function() {
return common.assertElementNotExists('.node-box [type=checkbox]:not(:disabled)', 'Node selection is locked on Edit Roles screen');
})
.then(function() {
return common.assertElementNotExists('[name=select-all]:not(:disabled)', 'Select All checkboxes are locked on Edit Roles screen');
})
.then(function() {
return common.assertElementExists('.role-panel [type=checkbox][name=controller]:indeterminate', 'Controller role checkbox has indeterminate state');
})
.assertElementDisappears('.btn-edit-roles', 2000, 'Cluster nodes screen unmounted')
.assertElementNotExists('.node-box [type=checkbox]:not(:disabled)', 'Node selection is locked on Edit Roles screen')
.assertElementNotExists('[name=select-all]:not(:disabled)', 'Select All checkboxes are locked on Edit Roles screen')
.assertElementExists('.role-panel [type=checkbox][name=controller]:indeterminate', 'Controller role checkbox has indeterminate state')
.then(function() {
// uncheck Cinder role
return clusterPage.checkNodeRoles(['Storage - Cinder', 'Storage - Cinder']);
})
.clickByCssSelector(applyButtonSelector)
// wait for role editing screen unmounted
.waitForElementDeletion('.btn-apply', 2000)
.findAllByCssSelector('.node-list .node-box')
.then(function(elements) {
return assert.equal(elements.length, nodesAmount, 'One node was removed from cluster after editing roles');
})
.end();
.assertElementDisappears('.btn-apply', 2000, 'Role editing screen unmounted')
.assertElementsExist('.node-list .node', nodesAmount, 'One node was removed from cluster after editing roles');
},
'Remove Cluster': function() {
return this.remote

View File

@ -64,10 +64,10 @@ define([
return this.remote
// introduce change
.clickByCssSelector('input[type=checkbox]')
.waitForCssSelector('.btn-apply-changes:not(:disabled)', 200)
.assertElementAppears('.btn-apply-changes:not(:disabled)', 200, 'Save Settings button is enabled if there are changes')
// reset the change
.clickByCssSelector('input[type=checkbox]')
.waitForCssSelector('.btn-apply-changes:disabled', 200);
.assertElementAppears('.btn-apply-changes:disabled', 200, 'Save Settings button is disabled if there are no changes');
},
'Check Cancel Changes button': function() {
return this.remote
@ -87,9 +87,7 @@ define([
})
// reset changes
.clickByCssSelector('.btn-revert-changes')
.then(function() {
return common.assertElementDisabled('.btn-apply-changes', 'Save Settings button is disabled after changes were cancelled');
});
.assertElementDisabled('.btn-apply-changes', 'Save Settings button is disabled after changes were cancelled');
},
'Check changes saving': function() {
return this.remote
@ -100,9 +98,7 @@ define([
.then(function() {
return settingsPage.waitForRequestCompleted();
})
.then(function() {
return common.assertElementDisabled('.btn-revert-changes', 'Cancel Changes button is disabled after changes were saved successfully');
});
.assertElementDisabled('.btn-revert-changes', 'Cancel Changes button is disabled after changes were saved successfully');
},
'Check loading of defaults': function() {
return this.remote
@ -111,12 +107,8 @@ define([
.then(function() {
return settingsPage.waitForRequestCompleted();
})
.then(function() {
return common.assertElementEnabled('.btn-apply-changes', 'Save Settings button is enabled after defaults were loaded');
})
.then(function() {
return common.assertElementEnabled('.btn-revert-changes', 'Cancel Changes button is enabled after defaults were loaded');
})
.assertElementEnabled('.btn-apply-changes', 'Save Settings button is enabled after defaults were loaded')
.assertElementEnabled('.btn-revert-changes', 'Cancel Changes button is enabled after defaults were loaded')
// revert the change
.clickByCssSelector('.btn-revert-changes');
},
@ -129,34 +121,24 @@ define([
.then(function() {
return clusterPage.goToTab('Settings');
})
.then(function() {
return common.assertElementExists('.nav-pills li.active a.subtab-link-syslog', 'The choice of subgroup is preserved when user navigates through the cluster tabs');
});
.assertElementExists('.nav-pills li.active a.subtab-link-syslog', 'The choice of subgroup is preserved when user navigates through the cluster tabs');
},
'The page reacts on invalid input': function() {
return this.remote
.clickLinkByText('Access')
// "nova" is forbidden username
.setInputValue('[type=text][name=user]', 'nova')
// invalid field marked as error
.waitForCssSelector('.access .form-group.has-error', 200)
.then(function() {
return common.assertElementExists('.subtab-link-access i.glyphicon-danger-sign', 'Subgroup with invalid field marked as invalid');
})
.then(function() {
return common.assertElementDisabled('.btn-apply-changes', 'Save Settings button is disabled in case of validation error');
})
.assertElementAppears('.access .form-group.has-error', 200, 'Invalid field marked as error')
.assertElementExists('.subtab-link-access i.glyphicon-danger-sign', 'Subgroup with invalid field marked as invalid')
.assertElementDisabled('.btn-apply-changes', 'Save Settings button is disabled in case of validation error')
// revert the change
.clickByCssSelector('.btn-revert-changes')
.then(function() {
return common.assertElementNotExists('.access .form-group.has-error', 'Validation error is cleared after resetting changes');
})
.then(function() {
return common.assertElementNotExists('.subtab-link-access i.glyphicon-danger-sign', 'Subgroup menu has default layout after resetting changes');
});
.assertElementNotExists('.access .form-group.has-error', 'Validation error is cleared after resetting changes')
.assertElementNotExists('.subtab-link-access i.glyphicon-danger-sign', 'Subgroup menu has default layout after resetting changes');
},
'Test repositories custom control': function() {
var repoAmount;
var repoAmount,
self = this;
return this.remote
.clickLinkByText('Repositories')
// get amount of default repositories
@ -165,26 +147,18 @@ define([
repoAmount = elements.length;
})
.end()
.then(function() {
return common.assertElementNotExists('.repos .form-inline:nth-of-type(1) .btn-link', 'The first repo can not be deleted');
})
.assertElementNotExists('.repos .form-inline:nth-of-type(1) .btn-link', 'The first repo can not be deleted')
// delete some repo
.clickByCssSelector('.repos .form-inline .btn-link')
.findAllByCssSelector('.repos .form-inline')
.then(function(elements) {
assert.equal(elements.length, repoAmount - 1, 'Repo was deleted');
})
.end()
.then(function() {
return self.remote.assertElementsExist('.repos .form-inline', repoAmount - 1, 'Repo was deleted');
})
// add new repo
.clickByCssSelector('.btn-add-repo')
.findAllByCssSelector('.repos .form-inline')
.then(function(elements) {
assert.equal(elements.length, repoAmount, 'New repo placeholder was added');
})
.end()
.then(function() {
return common.assertElementExists('.repos .form-inline .repo-name.has-error', 'Empty repo marked as imnvalid');
return self.remote.assertElementsExist('.repos .form-inline', repoAmount, 'New repo placeholder was added');
})
.assertElementExists('.repos .form-inline .repo-name.has-error', 'Empty repo marked as invalid')
// revert the change
.clickByCssSelector('.btn-revert-changes');
}

View File

@ -53,18 +53,10 @@ define([
},
'Test management controls state in new environment': function() {
return this.remote
.then(function() {
return common.assertElementDisabled(searchButtonSelector, 'Search button is locked if there are no nodes in environment');
})
.then(function() {
return common.assertElementDisabled(sortingButtonSelector, 'Sorting button is locked if there are no nodes in environment');
})
.then(function() {
return common.assertElementDisabled(filtersButtonSelector, 'Filters button is locked if there are no nodes in environment');
})
.then(function() {
return common.assertElementNotExists('.active-sorters-filters', 'Applied sorters and filters are not shown for empty environment');
});
.assertElementDisabled(searchButtonSelector, 'Search button is locked if there are no nodes in environment')
.assertElementDisabled(sortingButtonSelector, 'Sorting button is locked if there are no nodes in environment')
.assertElementDisabled(filtersButtonSelector, 'Filters button is locked if there are no nodes in environment')
.assertElementNotExists('.active-sorters-filters', 'Applied sorters and filters are not shown for empty environment');
},
'Test management controls behaviour': {
setup: function() {
@ -92,59 +84,32 @@ define([
var searchInputSelector = '.node-management-panel [name=search]';
return this.remote
.clickByCssSelector(searchButtonSelector)
.waitForCssSelector(searchInputSelector, 200)
.assertElementAppears(searchInputSelector, 200, 'Search input appears on the page')
.setInputValue(searchInputSelector, 'Super')
// need to wait debounced search input
.sleep(200)
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 3, 'Search was successfull');
})
.end()
.assertElementsExist('.node-list .node', 3, 'Search was successfull')
.clickByCssSelector('.node-list')
.then(function() {
return common.assertElementNotExists(searchButtonSelector, 'Active search control remains open when clicking outside the input');
})
.assertElementNotExists(searchButtonSelector, 'Active search control remains open when clicking outside the input')
.clickByCssSelector('.node-management-panel .btn-clear-search')
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 4, 'Search was reset');
})
.end()
.then(function() {
return common.assertElementNotExists(searchButtonSelector, 'Search input is still shown after search reset');
})
.assertElementsExist('.node-list .node', 4, 'Search was reset')
.assertElementNotExists(searchButtonSelector, 'Search input is still shown after search reset')
.clickByCssSelector('.node-list')
.then(function() {
return common.assertElementExists(searchButtonSelector, 'Empty search control is closed when clicking outside the input');
});
.assertElementExists(searchButtonSelector, 'Empty search control is closed when clicking outside the input');
},
'Test node list sorting': function() {
var activeSortersPanelSelector = '.active-sorters',
moreControlSelector = '.sorters .more-control',
firstNodeName;
firstNodeName,
self = this;
return this.remote
.then(function() {
return common.assertElementExists(activeSortersPanelSelector, 'Active sorters panel is shown if there are nodes in cluster');
})
.then(function() {
return common.assertElementNotExists(activeSortersPanelSelector + '.btn-reset-sorting', 'Default sorting can not be reset from active sorters panel');
})
.assertElementExists(activeSortersPanelSelector, 'Active sorters panel is shown if there are nodes in cluster')
.assertElementNotExists(activeSortersPanelSelector + '.btn-reset-sorting', 'Default sorting can not be reset from active sorters panel')
.clickByCssSelector(sortingButtonSelector)
.findAllByCssSelector('.sorters .sorter-control')
.then(function(elements) {
return assert.equal(elements.length, 1, 'Cluster node list has one sorting by default');
})
.end()
.then(function() {
return common.assertElementExists('.sorters .sort-by-roles-asc', 'Check default sorting by roles');
})
.then(function() {
return common.assertElementNotExists('.sorters .sorter-control .btn-remove-sorting', 'Node list should have at least one applied sorting');
})
.then(function() {
return common.assertElementNotExists('.sorters .btn-reset-sorting', 'Default sorting can not be reset');
})
.assertElementExists('.sorters .sorter-control', 'Cluster node list has one sorting by default')
.assertElementExists('.sorters .sort-by-roles-asc', 'Check default sorting by roles')
.assertElementNotExists('.sorters .sorter-control .btn-remove-sorting', 'Node list should have at least one applied sorting')
.assertElementNotExists('.sorters .btn-reset-sorting', 'Default sorting can not be reset')
.findByCssSelector('.node-list .node-name .name p')
.getVisibleText().then(function(text) {
firstNodeName = text;
@ -158,36 +123,20 @@ define([
.end()
.clickByCssSelector('.sorters .sort-by-roles-desc button')
.then(function() {
return common.assertElementTextEqualTo('.node-list .node-name .name p', firstNodeName, 'Order of sorting by roles was changed to asc (default)');
return self.remote.assertElementTextEquals('.node-list .node-name .name p', firstNodeName, 'Order of sorting by roles was changed to asc (default)');
})
.clickByCssSelector(moreControlSelector + ' button')
.findAllByCssSelector(moreControlSelector + ' .popover .checkbox-group')
.then(function(elements) {
return assert.equal(elements.length, 11, 'Standard node sorters are presented');
})
.end()
.assertElementsExist(moreControlSelector + ' .popover .checkbox-group', 11, 'Standard node sorters are presented')
// add sorting by CPU (real)
.clickByCssSelector(moreControlSelector + ' .popover [name=cores]')
// add sorting by manufacturer
.clickByCssSelector(moreControlSelector + ' .popover [name=manufacturer]')
.findAllByCssSelector('.node-list .nodes-group')
.then(function(elements) {
return assert.equal(elements.length, 4, 'New sorting was applied and nodes were grouped');
})
.end()
.assertElementsExist('.nodes-group', 4, 'New sorting was applied and nodes were grouped')
// remove sorting by manufacturer
.clickByCssSelector('.sorters .sort-by-manufacturer-asc .btn-remove-sorting')
.findAllByCssSelector('.node-list .nodes-group')
.then(function(elements) {
return assert.equal(elements.length, 3, 'Particular sorting removal works');
})
.end()
.assertElementsExist('.nodes-group', 3, 'Particular sorting removal works')
.clickByCssSelector('.sorters .btn-reset-sorting')
.findAllByCssSelector('.node-list .nodes-group')
.then(function(elements) {
return assert.equal(elements.length, 2, 'Sorting was successfully reset to default');
})
.end()
.assertElementsExist('.nodes-group', 2, 'Sorting was successfully reset to default')
.clickByCssSelector(sortingButtonSelector)
.clickByCssSelector(activeSortersPanelSelector)
// check active sorters panel is clickable and opens sorters panel
@ -198,88 +147,37 @@ define([
var activeFiltersPanelSelector = '.active-filters',
moreControlSelector = '.filters .more-control';
return this.remote
.then(function() {
return common.assertElementNotExists(activeFiltersPanelSelector , 'Environment has no active filters by default');
})
.assertElementNotExists(activeFiltersPanelSelector , 'Environment has no active filters by default')
.clickByCssSelector(filtersButtonSelector)
.findAllByCssSelector('.filters .filter-control')
.then(function(elements) {
return assert.equal(elements.length, 2, 'Filters panel has 2 default filters');
})
.end()
.assertElementsExist('.filters .filter-control', 2, 'Filters panel has 2 default filters')
.clickByCssSelector('.filter-by-roles')
.then(function() {
return common.assertElementNotExists('.filter-by-roles [type=checkbox]:checked' , 'There are no active options in Roles filter');
})
.then(function() {
return common.assertElementNotExists('.filters .filter-control .btn-remove-filter', 'Default filters can not be deleted from filters panel');
})
.then(function() {
return common.assertElementNotExists('.filters .btn-reset-filters', 'No filters to be reset');
})
.assertElementNotExists('.filter-by-roles [type=checkbox]:checked' , 'There are no active options in Roles filter')
.assertElementNotExists('.filters .filter-control .btn-remove-filter', 'Default filters can not be deleted from filters panel')
.assertElementNotExists('.filters .btn-reset-filters', 'No filters to be reset')
.clickByCssSelector(moreControlSelector + ' button')
.findAllByCssSelector(moreControlSelector + ' .popover .checkbox-group')
.then(function(elements) {
return assert.equal(elements.length, 7, 'Standard node filters are presented');
})
.end()
.assertElementsExist(moreControlSelector + ' .popover .checkbox-group', 7, 'Standard node filters are presented')
.clickByCssSelector(moreControlSelector + ' [name=cores]')
.findAllByCssSelector('.filters .filter-control')
.then(function(elements) {
return assert.equal(elements.length, 3, 'New Cores (real) filter was added');
})
.end()
// check new filter is open
.findByCssSelector('.filter-by-cores .popover-content')
.end()
.assertElementsExist('.filters .filter-control', 3, 'New Cores (real) filter was added')
.assertElementExists('.filter-by-cores .popover-content', 'New filter is open')
.clickByCssSelector('.filters .filter-by-cores .btn-remove-filter')
.findAllByCssSelector('.filters .filter-control')
.then(function(elements) {
return assert.equal(elements.length, 2, 'Particular filter removal works');
})
.end()
.assertElementsExist('.filters .filter-control', 2, 'Particular filter removal works')
.clickByCssSelector(moreControlSelector + ' button')
.clickByCssSelector(moreControlSelector + ' [name=disks_amount]')
.findAllByCssSelector('.filters .filter-by-disks_amount input[type=number]:not(:disabled)')
.then(function(elements) {
return assert.equal(elements.length, 2, 'Number filter has 2 fields to set min and max value');
})
.end()
.assertElementsExist('.filters .filter-by-disks_amount input[type=number]:not(:disabled)', 2, 'Number filter has 2 fields to set min and max value')
// set min value more than max value
.setInputValue('.filters .filter-by-disks_amount input[type=number][name=start]', '100')
// validation works for Number range filter
.waitForCssSelector('.filters .filter-by-disks_amount .form-group.has-error', 2000)
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 0, 'No nodes match invalid filter');
})
.end()
.assertElementsAppear('.filters .filter-by-disks_amount .form-group.has-error', 2000, 'Validation works for Number range filter')
.assertElementNotExists('.node-list .node', 'No nodes match invalid filter')
.clickByCssSelector('.filters .btn-reset-filters')
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 4, 'Node filtration was successfully reset');
})
.end()
.assertElementsExist('.node-list .node', 4, 'Node filtration was successfully reset')
.clickByCssSelector('.filters .filter-by-status button')
.clickByCssSelector('.filters .filter-by-status [name=error]')
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 1, 'Node with error status successfully filtered');
})
.end()
.assertElementExists('.node-list .node', 'Node with error status successfully filtered')
.clickByCssSelector('.filters .filter-by-status [name=pending_addition]')
.findAllByCssSelector('.node-list .node')
.then(function(elements) {
return assert.equal(elements.length, 4, 'All nodes shown');
})
.end()
.assertElementsExist('.node-list .node', 4, 'All nodes shown')
.clickByCssSelector(filtersButtonSelector)
.then(function() {
return common.assertElementExists(activeFiltersPanelSelector , 'Applied filter is reflected in active filters panel');
})
// check Reset filters button exists in active filters panel
.findByCssSelector('.active-filters .btn-reset-filters')
.end();
.assertElementExists(activeFiltersPanelSelector, 'Applied filter is reflected in active filters panel')
.assertElementExists('.active-filters .btn-reset-filters', 'Reset filters button exists in active filters panel');
}
}
};

View File

@ -55,43 +55,28 @@ define([
.then(function() {
return common.addNodesToCluster(1, ['Controller']);
})
.findByCssSelector('label.standard.active')
// standard mode chosen by default
.end()
.assertElementExists('label.standard.active', 'Standard mode chosen by default')
.findByClassName('node-box')
// role list is shown on node standard panel
.findByCssSelector('.role-list')
.end()
.assertElementExists('.role-list', 'Role list is shown on node standard panel')
.click()
// node gets selected upon clicking
.findByCssSelector('.checkbox-group input[type=checkbox]:checked')
.end()
.end()
.findByCssSelector('button.btn-delete-nodes:not(:disabled)')
// Delete Nodes and
.end()
.findByCssSelector('button.btn-edit-roles:not(:disabled)')
// ... Edit Roles buttons appear upon node selection
.assertElementExists('.checkbox-group input[type=checkbox]:checked', 'Node gets selected upon clicking')
.end()
.assertElementExists('button.btn-delete-nodes:not(:disabled)', 'Delete Nodes and ...')
.assertElementExists('button.btn-edit-roles:not(:disabled)', '... Edit Roles buttons appear upon node selection')
.then(function() {
return node.renameNode(nodeNewName);
})
.then(function() {
return common.assertElementTextEqualTo('.node .name p', nodeNewName, 'Node name has been updated');
})
.assertElementTextEquals('.node .name p', nodeNewName, 'Node name has been updated')
.clickByCssSelector('.node .btn-view-logs')
// check redirect to Logs tab
.waitForCssSelector('.logs-tab', 2000)
.assertElementAppears('.logs-tab', 2000, 'Check redirect to Logs tab')
.then(function() {
return clusterPage.goToTab('Nodes');
})
.waitForCssSelector('.node-list', 2000)
.assertElementAppears('.node-list', 2000, 'Cluster node list loaded')
.then(function() {
return node.discardNode();
})
.then(function() {
return common.assertElementNotExists('.node', 'Node has been removed');
});
.assertElementNotExists('.node', 'Node has been removed');
},
'Node pop-up': function() {
var newHostname = 'node-123';
@ -102,15 +87,9 @@ define([
.then(function() {
return node.openNodePopup();
})
.then(function() {
return common.assertElementTextEqualTo('.modal-header h4.modal-title', nodeNewName, 'Node pop-up has updated node name');
})
// disks can be configured for cluster node
.findByCssSelector('.modal .btn-edit-disks')
.end()
// interfaces can be configured for cluster node
.findByCssSelector('.modal .btn-edit-networks')
.end()
.assertElementTextEquals('.modal-header h4.modal-title', nodeNewName, 'Node pop-up has updated node name')
.assertElementExists('.modal .btn-edit-disks', 'Disks can be configured for cluster node')
.assertElementExists('.modal .btn-edit-networks', 'Interfaces can be configured for cluster node')
.clickByCssSelector('.change-hostname .btn-link')
// change the hostname
.findByCssSelector('.change-hostname [type=text]')
@ -118,9 +97,7 @@ define([
.type(newHostname)
.pressKeys('\uE007')
.end()
.then(function() {
return common.assertElementTextEqualTo('span.node-hostname', newHostname, 'Node hostname has been updated');
})
.assertElementTextEquals('span.node-hostname', newHostname, 'Node hostname has been updated')
.then(function() {
return modal.close();
});
@ -131,17 +108,11 @@ define([
.clickByCssSelector('label.compact')
.findByCssSelector('.compact-node div.node-checkbox')
.click()
// check self node is selectable
.findByCssSelector('i.glyphicon-ok')
.end()
.assertElementExists('i.glyphicon-ok', 'Self node is selectable')
.end()
.clickByCssSelector('.compact-node .node-name p')
.then(function() {
return common.assertElementNotExists('.compact-node .node-name-input', 'Node can not be renamed from compact panel');
})
.then(function() {
return common.assertElementNotExists('.compact-node .role-list', 'Role list is not shown on node compact panel');
});
.assertElementNotExists('.compact-node .node-name-input', 'Node can not be renamed from compact panel')
.assertElementNotExists('.compact-node .role-list', 'Role list is not shown on node compact panel');
},
'Compact node extended view': function() {
var newName = 'Node new new name';
@ -150,15 +121,11 @@ define([
return node.openCompactNodeExtendedView();
})
.clickByCssSelector('.node-name [type=checkbox]')
.then(function() {
return common.assertElementExists('.compact-node .node-checkbox i.glyphicon-ok', 'Node compact panel is checked');
})
.assertElementExists('.compact-node .node-checkbox i.glyphicon-ok', 'Node compact panel is checked')
.then(function() {
return node.openNodePopup(true);
})
.then(function() {
return common.assertElementNotExists('.node-popover', 'Node popover is closed when node pop-up opened');
})
.assertElementNotExists('.node-popover', 'Node popover is closed when node pop-up opened')
.then(function() {
// close node pop-up
return modal.close();
@ -167,48 +134,32 @@ define([
return node.openCompactNodeExtendedView();
})
.findByCssSelector('.node-popover')
// role list is shown in cluster node extended view
.findByCssSelector('.role-list')
.end()
// cluster node action buttons are presented in extended view
.findByCssSelector('.node-buttons')
.end()
.assertElementExists('.role-list', 'Role list is shown in cluster node extended view')
.assertElementExists('.node-buttons', 'Cluster node action buttons are presented in extended view')
.end()
.then(function() {
return node.renameNode(newName, true);
})
.then(function() {
return common.assertElementTextEqualTo('.node-popover .name p', newName, 'Node name has been updated from extended view');
})
.assertElementTextEquals('.node-popover .name p', newName, 'Node name has been updated from extended view')
.then(function() {
return node.discardNode(true);
})
.then(function() {
return common.assertElementNotExists('.node', 'Node has been removed');
});
.assertElementNotExists('.node', 'Node has been removed');
},
'Additional tests for unallocated node': function() {
return this.remote
.clickByCssSelector('button.btn-add-nodes')
.waitForCssSelector('.node-list', 2000)
.assertElementAppears('.node-list', 2000, 'Unallocated node list loaded')
.then(function() {
return node.openCompactNodeExtendedView();
})
.then(function() {
return common.assertElementNotExists('.node-popover .role-list', 'Unallocated node does not have roles assigned');
})
.then(function() {
return common.assertElementNotExists('.node-popover .node-buttons .btn', 'There are no action buttons in unallocated node extended view');
})
.assertElementNotExists('.node-popover .role-list', 'Unallocated node does not have roles assigned')
.assertElementNotExists('.node-popover .node-buttons .btn', 'There are no action buttons in unallocated node extended view')
.then(function() {
return node.openNodePopup(true);
})
.then(function() {
return common.assertElementNotExists('.modal .btn-edit-disks', 'Disks can not be configured for unallocated node');
})
.then(function() {
return common.assertElementNotExists('.modal .btn-edit-networks', 'Interfaces can not be configured for unallocated node');
})
.assertElementNotExists('.modal .btn-edit-disks', 'Disks can not be configured for unallocated node')
.assertElementNotExists('.modal .btn-edit-networks', 'Interfaces can not be configured for unallocated node')
.then(function() {
return modal.close();
});

View File

@ -327,6 +327,14 @@ define([
.assertElementExists(cssSelector, message);
});
},
assertElementsAppear: function(cssSelector, timeout, message) {
return new this.constructor(this, function() {
return this.parent
.waitForCssSelector(cssSelector, timeout)
.catch(_.constant(true))
.assertElementsExist(cssSelector, message);
});
},
assertElementDisappears: function(cssSelector, timeout, message) {
return new this.constructor(this, function() {
return this.parent