From adf0b1c64bb75f31903b6e45a7a2448cfdaaa752 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Tue, 22 Jun 2021 08:09:38 +0200 Subject: [PATCH] Set fixed percentage with on the snapshot card table columns Just for the case the description is too long, we don't want it to take all the space. Also add a pixel test. Relevant to https://bugzilla.redhat.com/show_bug.cgi?id=1974200 --- src/components/vm/snapshots/vmSnapshotsCard.jsx | 2 +- test/check-machines-snapshots | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/vm/snapshots/vmSnapshotsCard.jsx b/src/components/vm/snapshots/vmSnapshotsCard.jsx index 8071c8971..a7acc3560 100644 --- a/src/components/vm/snapshots/vmSnapshotsCard.jsx +++ b/src/components/vm/snapshots/vmSnapshotsCard.jsx @@ -223,7 +223,7 @@ export class VmSnapshotsCard extends React.Component { detailMap = detailMap.filter(d => !d.hidden); - const columnTitles = detailMap.map(target => ({ title: target.name })); + const columnTitles = detailMap.map(target => ({ title: target.name, props: { width: 15 } })); let rows = []; if (vm.snapshots) { rows = vm.snapshots.sort((a, b) => ((b.creationTime - a.creationTime) || (a.name.localeCompare(b.name)))).map((target, snapId) => { diff --git a/test/check-machines-snapshots b/test/check-machines-snapshots index 42c1b56ac..d1f202109 100755 --- a/test/check-machines-snapshots +++ b/test/check-machines-snapshots @@ -85,18 +85,27 @@ class TestMachinesSnapshots(VirtualMachinesCase): self.performAction("subVmTest1", "forceOff") time1 = datetime.now().strftime("%H:%M:%S") - m.execute("virsh snapshot-create-as --domain subVmTest1 --name snapshotC --description 'Description of snapshotC'") + long_description = "This is a long description"*10 + m.execute("virsh snapshot-create-as --domain subVmTest1 --name snapshotC --description '{0}'".format(long_description)) b.reload() # snapshots events not available yet: https://gitlab.com/libvirt/libvirt/-/issues/44 b.enter_page('/machines') b.wait_in_text("#vm-subVmTest1-snapshot-0-name", "snapshotC") - b.wait_in_text("#vm-subVmTest1-snapshot-0-description", "Description of snapshotC") + b.wait_in_text("#vm-subVmTest1-snapshot-0-description", long_description) b.wait_in_text("#vm-subVmTest1-snapshot-0-type", "shut off") b.wait_in_text("#vm-subVmTest1-snapshot-0-parent", "snapshotB") time2 = b.text("#vm-subVmTest1-snapshot-0-date") self.assertTrue(checkTimeDiff(time1, time2, 60)) + b.assert_pixels( + "#vm-subVmTest1-snapshots", "vm-snapshost-card", + ignore=[ + "tr:nth-child(1) .snap-creation-time", + "tr:nth-child(2) .snap-creation-time", + ] + ) + def testSnapshotCreate(self): b = self.browser m = self.machine