Skip to content

Commit b67d1c6

Browse files
fix: [M3-9522] - Recovery images table headers alignment with data column (#12043)
* fix: [M3-9522] - Recovery images table headers alignment with data column * Added changeset: Recovery Images Table Header alignment with the data column * fix imports * change changeset type and description
1 parent 001cd59 commit b67d1c6

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Tests
3+
---
4+
5+
Corrected alignment between Recovery Images Table Header and data column ([#12043](https://github.com/linode/manager/pull/12043))

packages/manager/cypress/e2e/core/images/images-non-empty-landing-page.spec.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { grantsFactory, profileFactory } from '@linode/utilities';
1+
import { profileFactory } from '@linode/utilities';
2+
import { grantsFactory } from '@linode/utilities';
23
import { mockGetUser } from 'support/intercepts/account';
3-
import { mockGetAllImages } from 'support/intercepts/images';
4+
import {
5+
mockGetCustomImages,
6+
mockGetRecoveryImages,
7+
} from 'support/intercepts/images';
48
import {
59
mockGetProfile,
610
mockGetProfileGrants,
@@ -49,20 +53,32 @@ function checkActionMenu(tableAlias: string, mockImages: any[]) {
4953

5054
describe('image landing checks for non-empty state with restricted user', () => {
5155
beforeEach(() => {
52-
const mockImages: Image[] = new Array(3)
56+
const mockCustomImages: Image[] = new Array(3)
57+
.fill(null)
58+
.map((_item: null, index: number): Image => {
59+
return imageFactory.build({
60+
label: `Image ${index}`,
61+
tags: [index % 2 === 0 ? 'even' : 'odd', 'nums'],
62+
type: 'manual',
63+
});
64+
});
65+
66+
const mockRecoveryImages: Image[] = new Array(3)
5367
.fill(null)
5468
.map((_item: null, index: number): Image => {
5569
return imageFactory.build({
5670
label: `Image ${index}`,
57-
tags: [index % 2 == 0 ? 'even' : 'odd', 'nums'],
71+
tags: [index % 2 === 0 ? 'even' : 'odd', 'nums'],
72+
type: 'automatic',
5873
});
5974
});
6075

6176
// Mock setup to display the Image landing page in an non-empty state
62-
mockGetAllImages(mockImages).as('getImages');
77+
mockGetCustomImages(mockCustomImages).as('getCustomImages');
78+
mockGetRecoveryImages(mockRecoveryImages).as('getRecoveryImages');
6379

6480
// Alias the mockImages array
65-
cy.wrap(mockImages).as('mockImages');
81+
cy.wrap(mockCustomImages).as('mockCustomImages');
6682
});
6783

6884
it('checks restricted user with read access has no access to create image and can see existing images', () => {
@@ -90,7 +106,8 @@ describe('image landing checks for non-empty state with restricted user', () =>
90106

91107
// Login and wait for application to load
92108
cy.visitWithLogin('/images');
93-
cy.wait('@getImages');
109+
cy.wait('@getCustomImages');
110+
cy.wait('@getRecoveryImages');
94111
cy.url().should('endWith', '/images');
95112

96113
cy.contains('h3', 'Custom Images')
@@ -119,7 +136,7 @@ describe('image landing checks for non-empty state with restricted user', () =>
119136
)
120137
.should('be.visible');
121138

122-
cy.get<Image[]>('@mockImages').then((mockImages) => {
139+
cy.get<Image[]>('@mockCustomImages').then((mockImages) => {
123140
// Assert that the correct number of Image entries are present in the customImageTable
124141
cy.get('@customImageTable')
125142
.find('tbody tr')

packages/manager/cypress/support/intercepts/images.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const mockGetCustomImages = (
6868
};
6969

7070
/**
71-
* Intercepts GET request to retrieve custom images and mocks response.
71+
* Intercepts GET request to retrieve recovery images and mocks response.
7272
*
7373
* @param images - Array of Image objects with which to mock response.
7474
*

packages/manager/src/factories/images.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Image } from '@linode/api-v4/lib/images/types';
21
import { Factory } from '@linode/utilities';
32

3+
import type { Image } from '@linode/api-v4';
4+
45
export const imageFactory = Factory.Sync.makeFactory<Image>({
56
capabilities: [],
67
created: new Date().toISOString(),

0 commit comments

Comments
 (0)