Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { linodeFactory, regionFactory } from '@linode/utilities';
import { firewallFactory } from '@src/factories';
import { mockGetAccountAgreements } from 'support/intercepts/account';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import { mockCreateLinode } from 'support/intercepts/linodes';
import { mockGetRegions } from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { randomLabel, randomString } from 'support/util/random';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomNumber, randomString } from 'support/util/random';

import type { Region } from '@linode/api-v4';

Expand Down Expand Up @@ -100,6 +103,11 @@ describe('GDPR agreement', () => {
});

it('needs the agreement checked to submit the form', () => {
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});
mockGetFirewalls([mockFirewall]).as('getFirewalls');
mockGetRegions(mockRegions).as('getRegions');
mockGetAccountAgreements({
billing_agreement: false,
Expand Down Expand Up @@ -127,6 +135,12 @@ describe('GDPR agreement', () => {

cy.findByLabelText('Root Password').type(rootpass);

// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

cy.get('[data-testid="eu-agreement-checkbox"]')
.as('euAgreement')
.scrollIntoView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'cypress-file-upload';
import { mockGetAccount } from 'support/intercepts/account';
import { mockGetDomains } from 'support/intercepts/domains';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import {
mockCreateLinodeAccountLimitError,
mockGetLinodeDetails,
Expand All @@ -31,6 +32,7 @@ import {
} from 'support/util/random';
import { chooseRegion } from 'support/util/regions';

import { firewallFactory } from 'src/factories';
import {
accountFactory,
domainFactory,
Expand Down Expand Up @@ -378,6 +380,10 @@ describe('open support tickets', () => {
planLabel: 'Nanode 1 GB',
planId: 'g6-nanode-1',
};
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});

const mockLinode = linodeFactory.build();

Expand All @@ -393,6 +399,7 @@ describe('open support tickets', () => {
mockGetSupportTicket(mockAccountLimitTicket);
mockGetSupportTicketReplies(mockAccountLimitTicket.id, []);
mockGetLinodes([mockLinode]);
mockGetFirewalls([mockFirewall]).as('getFirewalls');

cy.visitWithLogin('/linodes/create');

Expand All @@ -401,6 +408,8 @@ describe('open support tickets', () => {
linodeCreatePage.selectRegionById(mockRegion.id);
linodeCreatePage.selectPlan(mockPlan.planType, mockPlan.planLabel);
linodeCreatePage.setRootPassword(randomString(32));
// Select a firewall
linodeCreatePage.selectFirewall(mockFirewall.label, 'Assign Firewall');

// Attempt to create Linode and confirm mocked account limit error with support link is present.
ui.button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { linodeFactory } from '@linode/utilities';
import { imageFactory } from '@src/factories';
import { firewallFactory, imageFactory } from '@src/factories';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import { mockGetAllImages } from 'support/intercepts/images';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { apiMatcher } from 'support/util/intercepts';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';
Expand All @@ -20,8 +22,14 @@ const mockImage = imageFactory.build({
label: randomLabel(),
});

const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});

const createLinodeWithImageMock = (url: string, preselectedImage: boolean) => {
mockGetAllImages([mockImage]).as('mockImage');
mockGetFirewalls([mockFirewall]).as('getFirewalls');

cy.intercept('POST', apiMatcher('linode/instances'), (req) => {
req.reply({
Expand Down Expand Up @@ -52,6 +60,11 @@ const createLinodeWithImageMock = (url: string, preselectedImage: boolean) => {
cy.findByText('Shared CPU').click();
cy.get('[id="g6-nanode-1"][type="radio"]').click();
cy.get('[id="root-password"]').type(randomString(32));
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

ui.button
.findByTitle('Create Linode')
Expand Down
31 changes: 29 additions & 2 deletions packages/manager/cypress/e2e/core/linodes/alerts-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@
import { mockGetAccountSettings } from 'support/intercepts/account';
import { mockGetAlertDefinition } from 'support/intercepts/cloudpulse';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import { interceptCreateLinode } from 'support/intercepts/linodes';
import {
mockGetRegionAvailability,
mockGetRegions,
} from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { randomLabel, randomString } from 'support/util/random';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomNumber, randomString } from 'support/util/random';

import { accountSettingsFactory, alertFactory } from 'src/factories';
import {
accountSettingsFactory,
alertFactory,
firewallFactory,
} from 'src/factories';
import {
ALERTS_BETA_MODE_BANNER_TEXT,
ALERTS_BETA_MODE_BUTTON_TEXT,
ALERTS_LEGACY_MODE_BANNER_TEXT,
ALERTS_LEGACY_MODE_BUTTON_TEXT,
} from 'src/features/Linodes/constants';

const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});

describe('Create flow when beta alerts enabled by region and feature flag', function () {
beforeEach(() => {
const mockEnabledRegion = regionFactory.build({
Expand Down Expand Up @@ -54,6 +65,7 @@
interfaces_for_new_linodes: 'legacy_config_default_but_linode_allowed',
});
mockGetAccountSettings(mockInitialAccountSettings).as('getSettings');
mockGetFirewalls([mockFirewall]).as('getFirewalls');
});

it('Alerts panel becomes visible after switching to region w/ alerts enabled', function () {
Expand Down Expand Up @@ -88,6 +100,11 @@
const enabledRegion = this.mockRegions[0];
mockGetRegionAvailability(enabledRegion.id, []).as('getRegionAvailability');
ui.regionSelect.find().type(`${enabledRegion.label}{enter}`);
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'

Check warning on line 106 in packages/manager/cypress/e2e/core/linodes/alerts-create.spec.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Define a constant instead of duplicating this literal 3 times. Raw Output: {"ruleId":"sonarjs/no-duplicate-string","severity":1,"message":"Define a constant instead of duplicating this literal 3 times.","line":106,"column":7,"nodeType":"Literal","endLine":106,"endColumn":34}
);

// legacy alerts panel appears
cy.wait('@getRegionAvailability');
Expand Down Expand Up @@ -208,6 +225,11 @@
const enabledRegion = this.mockRegions[0];
mockGetRegionAvailability(enabledRegion.id, []).as('getRegionAvailability');
ui.regionSelect.find().type(`${enabledRegion.label}{enter}`);
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

// legacy alerts panel appears
cy.wait('@getRegionAvailability');
Expand Down Expand Up @@ -437,6 +459,11 @@
'getRegionAvailability'
);
ui.regionSelect.find().type(`${disabledRegion.label}{enter}`);
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

cy.wait('@getRegionAvailability');
// enter plan and password form fields to enable "View Code Snippets" button
Expand Down
10 changes: 10 additions & 0 deletions packages/manager/cypress/e2e/core/linodes/clone-linode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { LINODE_CREATE_TIMEOUT } from 'support/constants/linodes';
import { mockGetLinodeConfigs } from 'support/intercepts/configs';
import { interceptEvents } from 'support/intercepts/events';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import {
interceptCloneLinode,
mockCloneLinode,
Expand All @@ -44,6 +45,8 @@ import {
} from 'support/util/random';
import { chooseRegion, extendRegion } from 'support/util/regions';

import { firewallFactory } from 'src/factories';

import type { Linode } from '@linode/api-v4';

/**
Expand Down Expand Up @@ -195,8 +198,13 @@ describe('clone linode', () => {
id: mockLinode.id + 1,
label: newLinodeLabel,
};
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});

mockGetVLANs([mockVlan]);
mockGetFirewalls([mockFirewall]).as('getFirewalls');
mockCreateLinode(mockLinode).as('createLinode');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeVolumes(clonedLinode.id, [mockVolume]).as('getLinodeVolumes');
Expand Down Expand Up @@ -229,6 +237,8 @@ describe('clone linode', () => {
.type(mockVlan.cidr_block);
});

// Select a firewall
linodeCreatePage.selectFirewall(mockFirewall.label, 'Assign Firewall');
// Confirm that VLAN attachment is listed in summary, then create Linode.
cy.get('[data-qa-linode-create-summary]').scrollIntoView();
cy.get('[data-qa-linode-create-summary]').within(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
regionFactory,
} from '@linode/utilities';
import { LINODE_CREATE_TIMEOUT } from 'support/constants/linodes';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import {
mockCreateLinode,
mockGetLinodeTypes,
Expand All @@ -14,7 +15,11 @@ import {
mockGetRegions,
} from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomString } from 'support/util/random';
import { randomNumber } from 'support/util/random';

import { firewallFactory } from 'src/factories';

const mockEnabledRegion = regionFactory.build({
id: 'us-east',
Expand All @@ -37,10 +42,15 @@ const mockBlackwellLinodeTypes = new Array(4).fill(null).map((_, index) =>
const selectedBlackwell = mockBlackwellLinodeTypes[0];

describe('smoketest for Nvidia blackwell GPUs in linodes/create page', () => {
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});
beforeEach(() => {
mockGetRegions([mockEnabledRegion, mockDisabledRegion]).as('getRegions');

mockGetLinodeTypes(mockBlackwellLinodeTypes).as('getLinodeTypes');
mockGetFirewalls([mockFirewall]).as('getFirewalls');
});

/*
Expand Down Expand Up @@ -120,6 +130,11 @@ describe('smoketest for Nvidia blackwell GPUs in linodes/create page', () => {
cy.findByLabelText('Linode Label').type(newLinodeLabel);
cy.get('[type="password"]').should('be.visible').scrollIntoView();
cy.get('[id="root-password"]').type(randomString(12));
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);
cy.scrollTo('bottom');
const mockLinode = linodeFactory.build({
label: randomLabel(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { linodeFactory, regionFactory } from '@linode/utilities';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import { mockCreateLinode } from 'support/intercepts/linodes';
import {
mockGetRegionAvailability,
Expand All @@ -8,6 +9,9 @@ import {
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomString } from 'support/util/random';
import { randomNumber } from 'support/util/random';

import { firewallFactory } from 'src/factories';

describe('Create Linode in a Core Region', () => {
/*
Expand All @@ -30,6 +34,10 @@ describe('Create Linode in a Core Region', () => {
region: mockRegion1.id,
});
const rootPass = randomString(32);
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});

mockAppendFeatureFlags({
gecko2: {
Expand All @@ -39,6 +47,7 @@ describe('Create Linode in a Core Region', () => {
}).as('getFeatureFlags');
mockGetRegions(mockRegions).as('getRegions');
mockGetRegionAvailability(mockRegion1.id, []).as('getRegionAvailability');
mockGetFirewalls([mockFirewall]).as('getFirewalls');
mockCreateLinode(mockLinode).as('createLinode');

cy.visitWithLogin('/linodes/create');
Expand All @@ -55,6 +64,11 @@ describe('Create Linode in a Core Region', () => {
linodeCreatePage.selectImage('Debian 11');
linodeCreatePage.setRootPassword(rootPass);
linodeCreatePage.selectPlan('Shared CPU', 'Nanode 1 GB');
// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

ui.button
.findByTitle('Create Linode')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
regionFactory,
} from '@linode/utilities';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetFirewalls } from 'support/intercepts/firewalls';
import {
mockCreateLinode,
mockGetLinodeTypes,
Expand All @@ -14,9 +15,11 @@ import {
} from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomString } from 'support/util/random';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { extendRegion } from 'support/util/regions';

import { firewallFactory } from 'src/factories';

import type { Region } from '@linode/api-v4';

describe('Create Linode in Distributed Region', () => {
Expand All @@ -42,6 +45,10 @@ describe('Create Linode in Distributed Region', () => {
label: randomLabel(),
region: mockRegion.id,
});
const mockFirewall = firewallFactory.build({
id: randomNumber(),
label: randomLabel(),
});
const rootPass = randomString(32);

mockAppendFeatureFlags({
Expand All @@ -51,6 +58,7 @@ describe('Create Linode in Distributed Region', () => {
},
}).as('getFeatureFlags');
mockGetRegions([mockRegion]).as('getRegions');
mockGetFirewalls([mockFirewall]).as('getFirewalls');
mockGetLinodeTypes(mockLinodeTypes).as('getLinodeTypes');
mockGetRegionAvailability(mockRegion.id, []).as('getRegionAvailability');
mockCreateLinode(mockLinode).as('createLinode');
Expand All @@ -75,6 +83,12 @@ describe('Create Linode in Distributed Region', () => {
.click();
});

// Select a firewall
linodeCreatePage.selectFirewall(
mockFirewall.label,
'Public Interface Firewall'
);

ui.button
.findByTitle('Create Linode')
.should('be.visible')
Expand Down
Loading