Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: [M3-8526] - Update remaining Linode Create Cypress tests run against Linode Create v2 #10889

Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10889-tests-1725485099504.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Update remaining Linode Create Cypress tests run against Linode Create v2 ([#10889](https://github.com/linode/manager/pull/10889))
67 changes: 39 additions & 28 deletions packages/manager/cypress/e2e/core/general/gdpr-agreement.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { ui } from 'support/ui';
import { fbtClick, getClick } from 'support/helpers';
import { regionFactory } from '@src/factories';
import { linodeFactory, regionFactory } from '@src/factories';
import { randomString, randomLabel } from 'support/util/random';
import { mockGetRegions } from 'support/intercepts/regions';
import { mockGetAccountAgreements } from 'support/intercepts/account';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';

import type { Region } from '@linode/api-v4';
import { mockCreateLinode } from 'support/intercepts/linodes';

const mockRegions: Region[] = [
regionFactory.build({
Expand Down Expand Up @@ -102,15 +97,7 @@ describe('GDPR agreement', () => {
cy.get('[data-testid="eu-agreement-checkbox"]').should('not.exist');
});

it('needs the agreement checked to validate the form', () => {
// This test does not apply to Linode Create v2 because
// Linode Create v2 allows you to press "Create Linode"
// without checking the GDPR checkbox. (The user will
// get a validation error if they have not agreed).
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(false),
});
mockGetFeatureFlagClientstream();
it('needs the agreement checked to submit the form', () => {
mockGetRegions(mockRegions).as('getRegions');
mockGetAccountAgreements({
privacy_policy: false,
Expand All @@ -120,26 +107,50 @@ describe('GDPR agreement', () => {
const linodeLabel = randomLabel();

cy.visitWithLogin('/linodes/create');
cy.wait(['@getAgreements', '@getRegions']);
cy.wait(['@getRegions']);

// Paris should have the agreement
ui.regionSelect.find().click();
ui.regionSelect.findItemByRegionId('fr-par').click();
cy.get('[data-testid="eu-agreement-checkbox"]').should('be.visible');

// Fill out the form
fbtClick('Shared CPU');
getClick('[id="g6-nanode-1"]');
getClick('#linode-label').clear().type(linodeLabel);
cy.get('#root-password').type(rootpass);
cy.wait('@getAgreements');

cy.findByText('Shared CPU').click();

cy.get('[id="g6-nanode-1"]').click();

cy.findByLabelText('Linode Label').clear().type(linodeLabel);

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

// expect the button to be disabled
cy.get('[data-qa-deploy-linode="true"]').should('be.disabled');
cy.get('[data-testid="eu-agreement-checkbox"]')
.scrollIntoView()
.should('be.visible');

cy.findByText('Create Linode')
.scrollIntoView()
.should('be.enabled')
.should('be.visible')
.click();

cy.findByText(
'You must agree to the EU agreement to deploy to this region.'
).should('be.visible');

// check the agreement
getClick('#gdpr-checkbox');
cy.get('#gdpr-checkbox').click();

cy.findByText(
'You must agree to the EU agreement to deploy to this region.'
).should('not.exist');

mockCreateLinode(linodeFactory.build()).as('createLinode');

cy.findByText('Create Linode')
.should('be.enabled')
.should('be.visible')
.click();

// expect the button to be enabled
cy.get('[data-qa-deploy-linode="true"]').should('not.be.disabled');
cy.wait('@createLinode');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,10 @@ import { MOBILE_VIEWPORTS } from 'support/constants/environment';
import { linodeCreatePage } from 'support/ui/pages';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { ui } from 'support/ui';
import { mockCreateLinode } from 'support/intercepts/linodes';

describe('Linode create mobile smoke', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

MOBILE_VIEWPORTS.forEach((viewport) => {
/*
* - Confirms Linode create flow can be completed on common mobile screen sizes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('Create Linode', () => {
beforeEach(() => {
mockAppendFeatureFlags({
apicliDxToolsAdditions: makeFeatureFlagData(true),
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});
Expand Down Expand Up @@ -155,7 +154,6 @@ describe('Create Linode', () => {
beforeEach(() => {
mockAppendFeatureFlags({
apicliDxToolsAdditions: makeFeatureFlagData(false),
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import { linodeFactory } from 'src/factories';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import {
mockCreateLinode,
mockGetLinodeDetails,
} from 'support/intercepts/linodes';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';

describe('Create Linode with Add-ons', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Confirms UI flow to create a Linode with backups using mock API data.
* - Confirms that backups is reflected in create summary section.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import {
firewallFactory,
firewallTemplateFactory,
} from 'src/factories';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import {
mockCreateLinode,
mockGetLinodeDetails,
Expand All @@ -19,19 +15,10 @@ import {
} from 'support/intercepts/firewalls';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';

describe('Create Linode with Firewall', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Confirms UI flow to create a Linode with an existing Firewall using mock API data.
* - Confirms that Firewall is reflected in create summary section.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import {
linodeFactory,
sshKeyFactory,
} from 'src/factories';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';
import { mockGetUser, mockGetUsers } from 'support/intercepts/account';
Expand All @@ -17,14 +12,6 @@ import { ui } from 'support/ui';
import { mockCreateSSHKey } from 'support/intercepts/profile';

describe('Create Linode with SSH Key', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Confirms UI flow when creating a Linode with an authorized SSH key.
* - Confirms that existing SSH keys are listed on page and can be selected.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { imageFactory, linodeFactory, regionFactory } from 'src/factories';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { mockGetAllImages, mockGetImage } from 'support/intercepts/images';
import {
mockCreateLinode,
Expand All @@ -11,18 +7,10 @@ import {
import { mockGetRegions } from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { randomLabel, randomNumber, randomString } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';

describe('Create Linode with user data', () => {
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Confirms UI flow to create a Linode with cloud-init user data specified.
* - Confirms that outgoing API request contains expected user data payload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { linodeFactory, regionFactory, VLANFactory } from 'src/factories';
import { mockGetRegions } from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { linodeCreatePage } from 'support/ui/pages';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { chooseRegion } from 'support/util/regions';
import {
randomIp,
Expand All @@ -18,14 +13,6 @@ import { mockGetVLANs } from 'support/intercepts/vlans';
import { mockCreateLinode } from 'support/intercepts/linodes';

describe('Create Linode with VLANs', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Uses mock API data to confirm VLAN attachment UI flow during Linode create.
* - Confirms that outgoing Linode create API request contains expected data for VLAN.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import {
subnetFactory,
vpcFactory,
} from 'src/factories';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import {
mockCreateLinode,
mockGetLinodeDetails,
Expand All @@ -21,7 +17,6 @@ import {
} from 'support/intercepts/vpc';
import { ui } from 'support/ui';
import { linodeCreatePage, vpcCreateDrawer } from 'support/ui/pages';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import {
randomIp,
randomLabel,
Expand All @@ -32,14 +27,6 @@ import {
import { chooseRegion } from 'support/util/regions';

describe('Create Linode with VPCs', () => {
// TODO Remove feature flag mocks when `linodeCreateRefactor` flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* - Confirms UI flow to create a Linode with an existing VPC assigned using mock API data.
* - Confirms that VPC assignment is reflected in create summary section.
Expand Down
14 changes: 0 additions & 14 deletions packages/manager/cypress/e2e/core/linodes/create-linode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import { LINODE_CREATE_TIMEOUT } from 'support/constants/linodes';
import { cleanUp } from 'support/util/cleanup';
import { linodeCreatePage } from 'support/ui/pages';
import { authenticate } from 'support/api/authentication';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import {
interceptCreateLinode,
mockCreateLinodeError,
} from 'support/intercepts/linodes';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { interceptGetProfile } from 'support/intercepts/profile';
import { Region, VLAN, Config, Disk } from '@linode/api-v4';
import { getRegionById } from 'support/util/regions';
Expand Down Expand Up @@ -62,15 +57,6 @@ describe('Create Linode', () => {
cleanUp('ssh-keys');
});

// Enable the `linodeCreateRefactor` feature flag.
// TODO Delete these mocks once `linodeCreateRefactor` feature flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(true),
});
mockGetFeatureFlagClientstream();
});

/*
* End-to-end tests to create Linodes for each available plan type.
*/
Expand Down
Loading
Loading