Skip to content

Commit

Permalink
Account for region ID query param in clone test (#9890)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdamore-linode authored Nov 13, 2023
1 parent c5e1324 commit bb8ee0b
Showing 1 changed file with 7 additions and 11 deletions.
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

0 comments on commit bb8ee0b

Please sign in to comment.