-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add checks for the middle page after VM creation #1421
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,15 @@ class TestMachinesCreate(machineslib.VirtualMachinesCase): | |
|
||
dialog.cancel() | ||
|
||
# Check the details in the middle page after the VM creation | ||
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="file", location=config.NOVELL_MOCKUP_ISO_PATH)) | ||
|
||
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="disk_image", location=config.NOVELL_MOCKUP_ISO_PATH)) | ||
|
||
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="file", location=config.NOVELL_MOCKUP_ISO_PATH, create_and_run=True)) | ||
|
||
runner.checkMiddlePageWhenCreatingTest(TestMachinesCreate.VmDialog(self, sourceType="disk_image", location=config.NOVELL_MOCKUP_ISO_PATH, create_and_run=True)) | ||
|
||
def testCreateNameGeneration(self): | ||
config = TestMachinesCreate.TestCreateConfig | ||
runner = TestMachinesCreate.CreateVmRunner(self) | ||
|
@@ -1165,6 +1174,71 @@ vnc_password= "{vnc_passwd}" | |
|
||
return self | ||
|
||
def checkMiddlePageWhenCreating(self): | ||
b = self.browser | ||
|
||
buttonSelector = "#create-and-run" if self.create_and_run else "#create-and-edit" | ||
b.click(buttonSelector) | ||
|
||
if not self.create_and_run: | ||
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")") | ||
b.click("button:contains(\"Go to VMs list\")") | ||
b.wait_visible("#virtual-machines-listing") | ||
b.wait_in_text(f"#vm-{self.name}-system-state", "Creating VM") | ||
|
||
b.click(f"#vm-{self.name}-system-name") | ||
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")") | ||
b.click("button:contains(\"Go to VMs list\")") | ||
b.wait_visible("#virtual-machines-listing") | ||
b.wait_in_text( | ||
f"#vm-{self.name}-system-state", | ||
"Running" if self.create_and_run else "Shut off") | ||
|
||
b.click(f"#vm-{self.name}-system-name") | ||
b.wait_visible("#vm-details") | ||
b.wait_in_text("h2.vm-name", self.name) | ||
|
||
# It seems that the difference between removing success and failure is doUsagePolling and reducer "UPDATE_VM" action. | ||
# Thus, try to reload the page to trigger these event manually to see whether it could resolve the problem | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like a bug? Or do we simply not have a good way to wait till we can delete the VM? But maybe the bigger question is, can't we re-use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't find a way to wait untill we could detele the VM. |
||
b.reload() | ||
b.enter_page('/machines') | ||
b.click(f"#vm-{self.name}-system-action-kebab") | ||
b.wait_visible(f"#vm-{self.name}-system-action-kebab + .pf-v5-c-menu") | ||
b.click(f"#vm-{self.name}-system-delete") | ||
b.wait_visible(f"#vm-{self.name}-delete-modal-dialog") | ||
b.set_checked(f"#vm-{self.name}-delete-modal-dialog input[name=check-action-vda]", False) | ||
b.click(f"#vm-{self.name}-delete-modal-dialog button:contains(\"Delete\")") | ||
b.wait_not_present(f"#vm-{self.name}-delete-modal-dialog") | ||
b.wait_visible("#virtual-machines-listing") | ||
b.wait_not_present(f"#vm-{self.name}-system-name") | ||
|
||
self.open().fill() | ||
b.click(buttonSelector) | ||
|
||
if not self.create_and_run: | ||
b.wait_visible(f"h1:contains(\"Creating VM {self.name}\")") | ||
b.wait_visible("button:contains(\"Go to VMs list\")") | ||
else: | ||
b.wait_in_text(f"#vm-{self.name}-system-state", "Creating VM") | ||
testlib.wait(lambda: "Running" in b.text(f"#vm-{self.name}-system-state")) | ||
b.click(f"#vm-{self.name}-system-name") | ||
b.wait_visible("#vm-details") | ||
b.wait_in_text("h2.vm-name", self.name) | ||
|
||
b.reload() | ||
b.enter_page('/machines') | ||
b.click(f"#vm-{self.name}-system-action-kebab") | ||
b.wait_visible(f"#vm-{self.name}-system-action-kebab + .pf-v5-c-menu") | ||
b.click(f"#vm-{self.name}-system-delete") | ||
b.wait_visible(f"#vm-{self.name}-delete-modal-dialog") | ||
b.set_checked(f"#vm-{self.name}-delete-modal-dialog input[name=check-action-vda]", False) | ||
b.click(f"#vm-{self.name}-delete-modal-dialog button:contains(\"Delete\")") | ||
b.wait_not_present(f"#vm-{self.name}-delete-modal-dialog") | ||
b.wait_visible("#virtual-machines-listing") | ||
b.wait_not_present(f"#vm-{self.name}-system-name") | ||
|
||
return self | ||
|
||
def checkOsFiltered(self, present=False): | ||
b = self.browser | ||
|
||
|
@@ -1907,6 +1981,11 @@ vnc_password= "{vnc_passwd}" | |
|
||
self._assertScriptFinished().checkEnvIsEmpty() | ||
|
||
def checkMiddlePageWhenCreatingTest(self, dialog): | ||
dialog.open().fill().checkMiddlePageWhenCreating() | ||
|
||
self._assertScriptFinished().checkEnvIsEmpty() | ||
|
||
# Many of testCreate* tests use these helpers - let's keep them here to avoid repetition | ||
def checkDialogFormValidationTest(self, dialog, errors, create=True, is_warning=False): | ||
dialog.open() \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering what this PR adds, so far I can see that this is a new test assertion, not covered by tests:
But we can easily move this into an existing test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test check the middle page after clicking "Create and edit" and "Create and run". Include, the page will be redirected to the middle page after clicking "Create and edit"; after click "Create and run", the page will not be redirected, but click the VM name could be in the middle page; Check the content of the middle page; Check the button "Go to VMs list" of the middle page.
I am not sure whether it will be easy if we try to move this into an existing test, according to the debug process above. And, if move it into createTest, there will bring more complexity, such as need to consider that os is RHEL. Also, if we didn't figure out why the deletion needs a reload, the failure may spread to all create test