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

fix: Account for region ID query param in Cypress clone test #9890

Merged
merged 2 commits into from
Nov 13, 2023
Merged
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
18 changes: 7 additions & 11 deletions packages/manager/cypress/e2e/core/linodes/clone-linode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,13 @@ import { cleanUp } from 'support/util/cleanup';
* Returns the Cloud Manager URL to clone a given Linode.
*
* @param linode - Linode for which to retrieve clone URL.
* @param withRegion - Whether to append a region query to the URL.
*
* @returns Cloud Manager Clone URL for Linode.
*/
const getLinodeCloneUrl = (
linode: Linode,
withRegion: boolean = true
): string => {
const regionQuery = withRegion ? `&regionID=${linode.region}` : '';
const getLinodeCloneUrl = (linode: Linode): string => {
const regionQuery = `&regionID=${linode.region}`;
const typeQuery = `&typeID=${linode.type}`;
return `/linodes/create?linodeID=${linode.id}&type=Clone+Linode${typeQuery}${regionQuery}`;
return `/linodes/create?linodeID=${linode.id}${regionQuery}&type=Clone+Linode${typeQuery}`;
};

authenticate();
Expand Down Expand Up @@ -69,6 +65,9 @@ describe('clone linode', () => {
mockGetFeatureFlagClientstream().as('getClientStream');

cy.defer(createLinode(linodePayload)).then((linode: Linode) => {
const linodeRegion = getRegionById(linodePayload.region);
const linodeRegionLabel = `${linodeRegion.label} (${linodeRegion.id})`;

interceptCloneLinode(linode.id).as('cloneLinode');
cy.visitWithLogin(`/linodes/${linode.id}`);

Expand All @@ -81,10 +80,7 @@ describe('clone linode', () => {
.click();

ui.actionMenuItem.findByTitle('Clone').should('be.visible').click();

// Cloning from Linode Details page does not pre-select a region.
// (Cloning from the Linodes landing does pre-select a region, however.)
cy.url().should('endWith', getLinodeCloneUrl(linode, false));
cy.url().should('endWith', getLinodeCloneUrl(linode));

// Select clone region and Linode type.
ui.regionSelect.find().click();
Expand Down