Skip to content

Commit a1f35d6

Browse files
committed
test: Add checks for the middle page after VM creation
1 parent ae6eaab commit a1f35d6

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

test/check-machines-create

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ class TestMachinesCreate(machineslib.VirtualMachinesCase):
252252

253253
dialog.cancel()
254254

255+
# Check the details in the middle page after the VM creation
256+
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="file", location=config.NOVELL_MOCKUP_ISO_PATH))
257+
258+
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="disk_image", location=config.NOVELL_MOCKUP_ISO_PATH))
259+
260+
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="file", location=config.NOVELL_MOCKUP_ISO_PATH, create_and_run=True))
261+
262+
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="disk_image", location=config.NOVELL_MOCKUP_ISO_PATH, create_and_run=True))
263+
255264
def testCreateNameGeneration(self):
256265
config = TestMachinesCreate.TestCreateConfig
257266
runner = TestMachinesCreate.CreateVmRunner(self)
@@ -1168,6 +1177,79 @@ vnc_password= "{vnc_passwd}"
11681177

11691178
return self
11701179

1180+
def checkMiddlePageWhenCreating(self):
1181+
b = self.browser
1182+
1183+
buttonSelector = "#create-and-run" if self.create_and_run else "#create-and-edit"
1184+
b.click(buttonSelector)
1185+
1186+
if not self.create_and_run:
1187+
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")")
1188+
b.click("button:contains(\"Go to VMs list\")")
1189+
b.wait_visible("#virtual-machines-listing")
1190+
b.wait_in_text(f"#vm-{self.name}-system-state", "Creating VM")
1191+
1192+
b.click(f"#vm-{self.name}-system-name")
1193+
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")")
1194+
b.click("button:contains(\"Go to VMs list\")")
1195+
b.wait_visible("#virtual-machines-listing")
1196+
b.wait_in_text(
1197+
f"#vm-{self.name}-system-state",
1198+
"Running" if self.create_and_run else "Shut off")
1199+
1200+
b.click(f"#vm-{self.name}-system-name")
1201+
b.wait_visible("#vm-details")
1202+
b.wait_in_text("h2.vm-name", self.name)
1203+
# debug
1204+
print("---------Start for the first removing---------")
1205+
b.eval_js('window.debugging = "machines"')
1206+
# time.sleep(5)
1207+
b.reload()
1208+
b.enter_page('/machines')
1209+
1210+
b.click(f"#vm-{self.name}-system-action-kebab")
1211+
b.wait_visible(f"#vm-{self.name}-system-action-kebab + .pf-v5-c-menu")
1212+
b.click(f"#vm-{self.name}-system-delete")
1213+
b.wait_visible(f"#vm-{self.name}-delete-modal-dialog")
1214+
b.set_checked(f"#vm-{self.name}-delete-modal-dialog input[name=check-action-vda]", False)
1215+
b.click(f"#vm-{self.name}-delete-modal-dialog button:contains(\"Delete\")")
1216+
print("---------End for the first removing---------")
1217+
b.wait_not_present(f"#vm-{self.name}-delete-modal-dialog")
1218+
b.wait_visible("#virtual-machines-listing")
1219+
b.wait_not_present(f"#vm-{self.name}-system-name")
1220+
1221+
self.open().fill()
1222+
b.click(buttonSelector)
1223+
1224+
if not self.create_and_run:
1225+
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")")
1226+
b.wait_visible("button:contains(\"Go to VMs list\")")
1227+
else:
1228+
b.wait_in_text(f"#vm-{self.name}-system-state", "Creating VM")
1229+
testlib.wait(lambda: "Running" in b.text(f"#vm-{self.name}-system-state"))
1230+
b.click(f"#vm-{self.name}-system-name")
1231+
b.wait_visible("#vm-details")
1232+
b.wait_in_text("h2.vm-name", self.name)
1233+
1234+
# debug
1235+
# It seems that the difference between removing success and failure is doUsagePolling and reducer "UPDATE_VM" action.
1236+
# Thus, try to reload the page to trigger these event manually to see whether it could resolve the problem
1237+
b.reload()
1238+
b.enter_page('/machines')
1239+
print("---------Start for the second removing---------")
1240+
b.click(f"#vm-{self.name}-system-action-kebab")
1241+
b.wait_visible(f"#vm-{self.name}-system-action-kebab + .pf-v5-c-menu")
1242+
b.click(f"#vm-{self.name}-system-delete")
1243+
b.wait_visible(f"#vm-{self.name}-delete-modal-dialog")
1244+
b.set_checked(f"#vm-{self.name}-delete-modal-dialog input[name=check-action-vda]", False)
1245+
b.click(f"#vm-{self.name}-delete-modal-dialog button:contains(\"Delete\")")
1246+
print("---------End for the second removing---------")
1247+
b.wait_not_present(f"#vm-{self.name}-delete-modal-dialog")
1248+
b.wait_visible("#virtual-machines-listing")
1249+
b.wait_not_present(f"#vm-{self.name}-system-name")
1250+
1251+
return self
1252+
11711253
def checkOsFiltered(self, present=False):
11721254
b = self.browser
11731255

@@ -1913,6 +1995,11 @@ vnc_password= "{vnc_passwd}"
19131995

19141996
self._assertScriptFinished().checkEnvIsEmpty()
19151997

1998+
def checkMiddlePageWhenCreatingTest(self, dialog):
1999+
dialog.open().fill().checkMiddlePageWhenCreating()
2000+
2001+
self._assertScriptFinished().checkEnvIsEmpty()
2002+
19162003
# Many of testCreate* tests use these helpers - let's keep them here to avoid repetition
19172004
def checkDialogFormValidationTest(self, dialog, errors, create=True, is_warning=False):
19182005
dialog.open() \

0 commit comments

Comments
 (0)