|
Packit Service |
eebd6f |
#!/usr/bin/python3
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# checkpoint:
|
|
Packit Service |
eebd6f |
# 1. page navigate and package filter
|
|
Packit Service |
eebd6f |
# 2. selected package sorting
|
|
Packit Service |
eebd6f |
# 3. redo, undo, and commit
|
|
Packit Service |
eebd6f |
# 4. discard all changes
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
import composerlib
|
|
Packit Service |
eebd6f |
import testlib
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
@testlib.nondestructive
|
|
Packit Service |
eebd6f |
class TestPackage(composerlib.ComposerCase):
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
def testNavigate(self):
|
|
Packit Service |
eebd6f |
b = self.browser
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
0c2606 |
self.login_and_go("/composer", superuser=True)
|
|
Packit Service |
eebd6f |
b.wait_present("#main")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# go to edit package page
|
|
Packit Service |
eebd6f |
b.click("li[data-blueprint=httpd-server] a:contains('Edit Packages')")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# do navigate with > and < button
|
|
Packit Service |
0c2606 |
b.click("button[aria-label='Go to next page']")
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
0c2606 |
b.click("button[aria-label='Go to previous page']")
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
# filter on avaliable components
|
|
Packit Service |
eebd6f |
b.set_input_text("#cmpsr-blueprint-input-filter", "cockpit-bridge")
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_text("#cockpit-bridge-input", "cockpit-bridge")
|
|
Packit Service |
eebd6f |
b.wait_present(".toolbar-pf-results .label-info span")
|
|
Packit Service |
eebd6f |
# click Clear All Filters link
|
|
Packit Service |
eebd6f |
b.click("span:contains('Clear All Filters')")
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
b.wait_not_present(".toolbar-pf-results .label-info span")
|
|
Packit Service |
eebd6f |
b.wait_not_present("#cockpit-bridge-input")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# filter on blueprints component
|
|
Packit Service |
eebd6f |
# filter by name
|
|
Packit Service |
eebd6f |
b.set_input_text("#filter-blueprints", "tmux")
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #tmux", "tmux")
|
|
Packit Service |
eebd6f |
b.click(".cmpsr-panel__body--main .toolbar-pf-results button:contains('Clear All Filters')")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #httpd", "httpd")
|
|
Packit Service |
eebd6f |
# filter by version
|
|
Packit Service |
eebd6f |
b.click("#filterFieldTypeMenu")
|
|
Packit Service |
eebd6f |
b.wait_attr("#filterFieldTypeMenu", "aria-expanded", "true")
|
|
Packit Service |
eebd6f |
b.click("a:contains('Version')")
|
|
Packit Service |
eebd6f |
b.wait_in_text("#filterFieldTypeMenu", "Version")
|
|
Packit Service |
eebd6f |
# input version is dynamic according to different OS release
|
|
Packit Service |
eebd6f |
version = b.text("li[data-component=tmux] .cc-component__version strong")
|
|
Packit Service |
eebd6f |
b.set_input_text("#filter-blueprints", version)
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #tmux", "tmux")
|
|
Packit Service |
eebd6f |
b.click(".cmpsr-panel__body--main .toolbar-pf-results .pficon-close")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #httpd", "httpd")
|
|
Packit Service |
eebd6f |
# filter by release
|
|
Packit Service |
eebd6f |
b.click("#filterFieldTypeMenu")
|
|
Packit Service |
eebd6f |
b.wait_attr("#filterFieldTypeMenu", "aria-expanded", "true")
|
|
Packit Service |
eebd6f |
b.click("a:contains('Release')")
|
|
Packit Service |
eebd6f |
b.wait_in_text("#filterFieldTypeMenu", "Release")
|
|
Packit Service |
eebd6f |
# input release is dynamic according to different OS release
|
|
Packit Service |
eebd6f |
release = b.text("li[data-component=tmux] .cc-component__release strong")
|
|
Packit Service |
eebd6f |
b.set_input_text("#filter-blueprints", release)
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #tmux", "tmux")
|
|
Packit Service |
eebd6f |
b.click(".cmpsr-panel__body--main .toolbar-pf-results .pficon-close")
|
|
Packit Service |
eebd6f |
b.wait_text("ul[data-list=components] li:nth-child(1) #httpd", "httpd")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# collect code coverage result
|
|
Packit Service |
eebd6f |
self.check_coverage()
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
def testSort(self):
|
|
Packit Service |
eebd6f |
b = self.browser
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
0c2606 |
self.login_and_go("/composer", superuser=True)
|
|
Packit Service |
eebd6f |
b.wait_present("#main")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# go to edit package page
|
|
Packit Service |
eebd6f |
b.click("li[data-blueprint=httpd-server] a:contains('Edit Packages')")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
blueprint_list = [
|
|
Packit Service |
eebd6f |
"httpd",
|
|
Packit Service |
eebd6f |
"tmux",
|
|
Packit Service |
eebd6f |
"vim-enhanced"
|
|
Packit Service |
eebd6f |
]
|
|
Packit Service |
eebd6f |
# sort from Z-A
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Selected Components']")
|
|
Packit Service |
eebd6f |
b.click(".fa-sort-alpha-asc")
|
|
Packit Service |
eebd6f |
b.wait_present(".fa-sort-alpha-desc")
|
|
Packit Service |
eebd6f |
for i, v in enumerate(sorted(blueprint_list, reverse=True)):
|
|
Packit Service |
eebd6f |
b.wait_text("ul[aria-label='Selected Components'] li:nth-child({}) "
|
|
Packit Service |
eebd6f |
"a strong".format(i + 1), v)
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# sort from A-Z
|
|
Packit Service |
eebd6f |
b.click(".fa-sort-alpha-desc")
|
|
Packit Service |
eebd6f |
b.wait_present(".fa-sort-alpha-asc")
|
|
Packit Service |
eebd6f |
for i, v in enumerate(sorted(blueprint_list)):
|
|
Packit Service |
eebd6f |
b.wait_text("ul[aria-label='Selected Components'] li:nth-child({}) "
|
|
Packit Service |
eebd6f |
"a strong".format(i + 1), v)
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# collect code coverage result
|
|
Packit Service |
eebd6f |
self.check_coverage()
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
def testRedoUndoCommit(self):
|
|
Packit Service |
eebd6f |
b = self.browser
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
0c2606 |
self.login_and_go("/composer", superuser=True)
|
|
Packit Service |
eebd6f |
b.wait_present("#main")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# go to edit package page
|
|
Packit Service |
eebd6f |
b.click("li[data-blueprint=openssh-server] a:contains('Edit Packages')")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# search for openssh-server pacakge
|
|
Packit Service |
eebd6f |
b.set_input_text("#cmpsr-blueprint-input-filter", "cockpit-bridge")
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_text("#cockpit-bridge-input", "cockpit-bridge")
|
|
Packit Service |
eebd6f |
# add it to blueprint
|
|
Packit Service |
eebd6f |
b.click("li[data-input=cockpit-bridge] .fa-plus")
|
|
Packit Service |
eebd6f |
# wait for package added
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-component=cockpit-bridge]")
|
|
Packit Service |
eebd6f |
# + becomes -
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-input=cockpit-bridge] .fa-minus")
|
|
Packit Service |
eebd6f |
# bordered icon
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-input=cockpit-bridge] .list-pf-icon-bordered")
|
|
Packit Service |
eebd6f |
# redo button should be disabled
|
|
Packit Service |
eebd6f |
b.wait_attr_contains("button[data-button=redo]", "class", "disabled")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# undo
|
|
Packit Service |
eebd6f |
b.click("button[data-button=undo]")
|
|
Packit Service |
eebd6f |
b.wait_not_present("li[data-component=cockpit-bridge]")
|
|
Packit Service |
eebd6f |
b.wait_attr_contains("button[data-button=undo]", "class", "disabled")
|
|
Packit Service |
eebd6f |
# - becomes +
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-input=cockpit-bridge] .fa-plus")
|
|
Packit Service |
eebd6f |
# no bordered icon
|
|
Packit Service |
eebd6f |
b.wait_not_present("li[data-input=cockpit-bridge] .list-pf-icon-bordered")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# redo
|
|
Packit Service |
eebd6f |
b.click("button[data-button=redo]")
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-component=cockpit-bridge]")
|
|
Packit Service |
eebd6f |
# undo button should be disabled
|
|
Packit Service |
eebd6f |
b.wait_attr_contains("button[data-button=redo]", "class", "disabled")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# pending commit
|
|
Packit Service |
eebd6f |
b.click("a:contains('1 Pending Change')")
|
|
Packit Service |
eebd6f |
# show Added cockpit-bridge
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes ul li:nth-child(1) div:contains('Added')")
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes ul li:nth-child(1) "
|
|
Packit Service |
eebd6f |
"div:contains('cockpit-bridge-*')")
|
|
Packit Service |
eebd6f |
b.click("#cmpsr-modal-pending-changes button:contains('Close')")
|
|
Packit Service |
eebd6f |
b.wait_not_present("#cmpsr-modal-pending-changes")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# logout and login, still in edit blueprint page
|
|
Packit Service |
eebd6f |
with b.wait_timeout(300):
|
|
Packit Service |
0c2606 |
b.relogin("/composer", superuser=True)
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# "1 Pending Change" still there
|
|
Packit Service |
eebd6f |
b.wait_present("a:contains('1 Pending Change')")
|
|
Packit Service |
eebd6f |
b.click("#cockpit-bridge-kebab")
|
|
Packit Service |
eebd6f |
b.wait_attr("#cockpit-bridge-kebab", "aria-expanded", "true")
|
|
Packit Service |
eebd6f |
b.click("ul[aria-labelledby=cockpit-bridge-kebab] a:contains('Remove')")
|
|
Packit Service |
eebd6f |
b.wait_not_present("li[data-component=cockpit-bridge]")
|
|
Packit Service |
eebd6f |
# "2 Pending Change" now
|
|
Packit Service |
eebd6f |
b.wait_present("a:contains('2 Pending Change')")
|
|
Packit Service |
eebd6f |
# commit
|
|
Packit Service |
eebd6f |
b.click("button:contains('Commit')")
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes .form-horizontal p + div ul "
|
|
Packit Service |
eebd6f |
"li:nth-child(1) div:contains('Removed')")
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes .form-horizontal p + div ul "
|
|
Packit Service |
eebd6f |
"li:nth-child(1) div:contains('cockpit-bridge-*')")
|
|
Packit Service |
eebd6f |
b.wait_in_text("#cmpsr-modal-pending-changes .form-horizontal p + div + div > strong",
|
|
Packit Service |
eebd6f |
"Changes made in a previous session")
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes .form-horizontal p + div + div ul "
|
|
Packit Service |
eebd6f |
"li:nth-child(1) div:contains('Added')")
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-modal-pending-changes .form-horizontal p + div + div ul "
|
|
Packit Service |
eebd6f |
"li:nth-child(1) div:contains('cockpit-bridge-*')")
|
|
Packit Service |
eebd6f |
b.click("#cmpsr-modal-pending-changes .modal-footer button:contains('Commit')")
|
|
Packit Service |
eebd6f |
# toast notification appear and disappear automatically
|
|
Packit Service |
eebd6f |
b.wait_present("#cmpsr-toast-committed")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_not_present("#cmpsr-toast-committed")
|
|
Packit Service |
eebd6f |
# disabled commit button
|
|
Packit Service |
eebd6f |
b.wait_attr_contains("button:contains('Commit')", "class", "disabled")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# collect code coverage result
|
|
Packit Service |
eebd6f |
self.check_coverage()
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
def testDiscard(self):
|
|
Packit Service |
eebd6f |
b = self.browser
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
0c2606 |
self.login_and_go("/composer", superuser=True)
|
|
Packit Service |
eebd6f |
b.wait_present("#main")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# go to edit package page
|
|
Packit Service |
eebd6f |
b.click("li[data-blueprint=openssh-server] a:contains('Edit Packages')")
|
|
Packit Service |
0c2606 |
with b.wait_timeout(240):
|
|
Packit Service |
eebd6f |
b.wait_present("ul[aria-label='Available Components'] li:nth-child(1)")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# search for openssh-server pacakge
|
|
Packit Service |
eebd6f |
b.set_input_text("#cmpsr-blueprint-input-filter", "cockpit-composer")
|
|
Packit Service |
eebd6f |
b.key_press("\r")
|
|
Packit Service |
eebd6f |
with b.wait_timeout(120):
|
|
Packit Service |
eebd6f |
b.wait_text("#cockpit-composer-input", "cockpit-composer")
|
|
Packit Service |
eebd6f |
# add it to blueprint
|
|
Packit Service |
eebd6f |
b.click("li[data-input=cockpit-composer] .fa-plus")
|
|
Packit Service |
eebd6f |
# wait for package added
|
|
Packit Service |
eebd6f |
b.wait_present("li[data-component=cockpit-composer]")
|
|
Packit Service |
eebd6f |
# click discard changes button
|
|
Packit Service |
eebd6f |
b.click("button:contains('Discard Changes')")
|
|
Packit Service |
eebd6f |
b.wait_not_present("li[data-component=cockpit-composer]")
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
# collect code coverage result
|
|
Packit Service |
eebd6f |
self.check_coverage()
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
|
|
Packit Service |
eebd6f |
if __name__ == '__main__':
|
|
Packit Service |
eebd6f |
testlib.test_main()
|