1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test creating a package with the library editor
"""
def test(library_editor, helpers):
"""
Create new package
"""
le = library_editor
# Open "New Library Element" wizard
le.action('libraryEditorActionNewElement').trigger(blocking=False)
# Choose type of element
le.widget('libraryEditorNewElementWizardChooseTypePackageButton').click()
# Enter metadata
widget_properties = {
('NameEdit', 'text'): 'New Package',
('DescriptionEdit', 'plainText'): 'Foo Bar',
('KeywordsEdit', 'text'): '',
('AuthorEdit', 'text'): 'Functional Test',
('VersionEdit', 'text'): '1.2.3',
}
for (widget, property), value in widget_properties.items():
le.widget('libraryEditorNewElementWizardMetadata' + widget).set_property(property, value)
le.widget('libraryEditorNewElementWizardNextButton').click()
# Finish
dialog = le.widget('libraryEditorNewElementWizard')
le.widget('libraryEditorNewElementWizardFinishButton').click()
helpers.wait_until_widget_hidden(dialog)
# Check if a new tab is opened (indicates that the element was created)
tab_props = le.widget('libraryEditorStackedWidget').properties()
assert tab_props['count'] == 2
assert tab_props['currentIndex'] == 1
# Check metadata
assert le.widget('libraryEditorPackageNameEdit').properties()['text'] == 'New Package'
assert le.widget('libraryEditorPackageDescriptionEdit').properties()['plainText'] == 'Foo Bar'
assert le.widget('libraryEditorPackageKeywordsEdit').properties()['text'] == ''
assert le.widget('libraryEditorPackageAuthorEdit').properties()['text'] == 'Functional Test'
assert le.widget('libraryEditorPackageVersionEdit').properties()['text'] == '1.2.3'
|