Skip to content

Commit f213afd

Browse files
test: [UIE-10834] - Fix Image test failures by mocking feature flag (#13572)
* Mock disable private image sharing feature flag to fix test failures * Fix malformed feature flag mock * Fix last test failure * Added changeset: Mock private image sharing flag to be disabled in Image tests
1 parent 22f8513 commit f213afd

8 files changed

Lines changed: 29 additions & 0 deletions
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+
Mock private image sharing flag to be disabled in Image tests ([#13572](https://github.com/linode/manager/pull/13572))

packages/manager/cypress/e2e/core/account/restricted-user-details-pages.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe('restricted user details pages', () => {
106106
mockAppendFeatureFlags({
107107
apl: false,
108108
dbaasV2: { beta: false, enabled: false },
109+
privateImageSharing: false,
109110
});
110111
});
111112

packages/manager/cypress/e2e/core/images/create-image.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { authenticate } from 'support/api/authentication';
2+
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
23
import { ui } from 'support/ui';
34
import { cleanUp } from 'support/util/cleanup';
45
import { createTestLinode } from 'support/util/linodes';
@@ -12,6 +13,10 @@ describe('create image (e2e)', () => {
1213
cleanUp(['linodes', 'images']);
1314
});
1415

16+
beforeEach(() => {
17+
mockAppendFeatureFlags({ privateImageSharing: false });
18+
});
19+
1520
it('create image from a linode', () => {
1621
cy.tag('method:e2e');
1722
const label = randomLabel();

packages/manager/cypress/e2e/core/images/create-linode-from-image.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { linodeFactory } from '@linode/utilities';
22
import { firewallFactory, imageFactory } from '@src/factories';
3+
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
34
import { mockGetFirewalls } from 'support/intercepts/firewalls';
45
import { mockGetAllImages } from 'support/intercepts/images';
56
import { ui } from 'support/ui';
@@ -81,6 +82,10 @@ const createLinodeWithImageMock = (url: string, preselectedImage: boolean) => {
8182
};
8283

8384
describe('create linode from image, mocked data', () => {
85+
beforeEach(() => {
86+
mockAppendFeatureFlags({ privateImageSharing: false });
87+
});
88+
8489
/*
8590
* - Confirms UI flow when user attempts to create a Linode from images without having any images.
8691
*/

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { grantsFactory, profileFactory } from '@linode/utilities';
22
import { accountUserFactory } from '@src/factories/accountUsers';
33
import { mockGetUser } from 'support/intercepts/account';
4+
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
45
import { mockGetAllImages } from 'support/intercepts/images';
56
import {
67
mockGetProfile,
@@ -13,6 +14,7 @@ describe('Images empty landing page', () => {
1314
beforeEach(() => {
1415
// Mock setup to display the Image landing page in an empty state
1516
mockGetAllImages([]).as('getImages');
17+
mockAppendFeatureFlags({ privateImageSharing: false });
1618
});
1719

1820
/*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { profileFactory } from '@linode/utilities';
22
import { grantsFactory } from '@linode/utilities';
33
import { mockGetUser } from 'support/intercepts/account';
4+
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
45
import {
56
mockGetCustomImages,
67
mockGetRecoveryImages,
@@ -74,6 +75,9 @@ describe('image landing checks for non-empty state with restricted user', () =>
7475
});
7576
});
7677

78+
// Disable Private Image Sharing feature flag.
79+
mockAppendFeatureFlags({ privateImageSharing: false });
80+
7781
// Mock setup to display the Image landing page in an non-empty state
7882
mockGetCustomImages(mockCustomImages).as('getCustomImages');
7983
mockGetRecoveryImages(mockRecoveryImages).as('getRecoveryImages');

packages/manager/cypress/e2e/core/images/smoke-create-image.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from '@linode/utilities';
66
import { mockGetUser } from 'support/intercepts/account';
77
import { mockGetEvents } from 'support/intercepts/events';
8+
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
89
import { mockCreateImage } from 'support/intercepts/images';
910
import { mockGetLinodeDisks, mockGetLinodes } from 'support/intercepts/linodes';
1011
import {
@@ -19,6 +20,10 @@ import { linodeDiskFactory } from 'src/factories/disk';
1920
import { imageFactory } from 'src/factories/images';
2021

2122
describe('create image (using mocks)', () => {
23+
beforeEach(() => {
24+
mockAppendFeatureFlags({ privateImageSharing: false });
25+
});
26+
2227
it('create image from a linode', () => {
2328
const mockDisks = [
2429
linodeDiskFactory.build({ filesystem: 'ext4', label: 'Debian 12 Disk' }),

packages/manager/cypress/e2e/core/linodes/rebuild-linode.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ describe('rebuild linode', () => {
171171
iam: {
172172
enabled: false,
173173
},
174+
privateImageSharing: false,
174175
});
175176
});
176177

@@ -525,6 +526,7 @@ describe('rebuild linode', () => {
525526
enabled: true,
526527
la: true,
527528
},
529+
privateImageSharing: false,
528530
}).as('getFeatureFlags');
529531
mockGetRegionAvailability(linodeCreatePayload.region, []).as(
530532
'getRegionAvailability'

0 commit comments

Comments
 (0)