Skip to content

Commit

Permalink
Set fixed percentage with on the snapshot card table columns
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KKoukiou committed Jun 23, 2021
1 parent f5a4187 commit adf0b1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/vm/snapshots/vmSnapshotsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
13 changes: 11 additions & 2 deletions test/check-machines-snapshots
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit adf0b1c

Please sign in to comment.