Skip to content

Commit 9e57ed9

Browse files
committed
test: Check for uptime in confirmation dialogs
This behaves differently depending on whether or not the session is privileged to read the log file. Add an invisible span to the dialog so that the test has something to wait for.
1 parent e80d92e commit 9e57ed9

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/components/vm/confirmDialog.jsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ export const ConfirmDialog = ({ idPrefix, actionsList, title, titleIcon, vm }) =
6464
titleIconVariant={titleIcon}
6565
isOpen
6666
footer={actions}>
67-
{uptime &&
68-
<DescriptionList isHorizontal isFluid>
69-
<DescriptionListGroup>
70-
<DescriptionListTerm>{_("Uptime")}</DescriptionListTerm>
71-
<DescriptionListDescription id="uptime">{distanceToNow(new Date(uptime))}</DescriptionListDescription>
72-
</DescriptionListGroup>
73-
</DescriptionList>}
67+
{uptime
68+
? <DescriptionList isHorizontal isFluid>
69+
<DescriptionListGroup>
70+
<DescriptionListTerm>{_("Uptime")}</DescriptionListTerm>
71+
<DescriptionListDescription id="uptime">{distanceToNow(new Date(uptime))}</DescriptionListDescription>
72+
</DescriptionListGroup>
73+
</DescriptionList>
74+
/* for tests */
75+
: <span className="uptime-not-available" />
76+
}
7477
</Modal>
7578
);
7679
};

test/check-machines-lifecycle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ class TestMachinesLifecycle(VirtualMachinesCase):
235235
# Check uptime
236236
b.click("#vm-subVmTest2-system-shutdown-button")
237237
b.wait_visible("#vm-subVmTest2-system-confirm-action-modal")
238+
# it starts with "less than a minute", so this should be reasonably race free
239+
if superuser:
240+
b.wait_in_text("#uptime", "minute")
241+
else:
242+
# unprivileged sessions can't read the log
243+
b._wait_present(".uptime-not-available")
238244
if run_pixel_tests:
239245
b.assert_pixels("#vm-subVmTest2-system-confirm-action-modal", "shutdown-confirm-dialog")
240246
b.click(".pf-v5-c-modal-box__footer button:contains(Cancel)")

0 commit comments

Comments
 (0)